2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
🙊作者简介:拥有多年开发工作经验,分享技术代码帮助学生学习,独立完成自己的项目或者毕业设计。
- 代码可以私聊博主获取。🌹
- We provide 600 excel files of computer graduation project topics for free to help universities choose topics.
- A project proposal template is provided to help you write the project proposal.
The author's complete code directory is for you to choose:
- "Springboot website project" 400 sets
- 《ssm website project》800 sets
- 300 sets of "Mini Program Project"
- 《App Project》500 sets
- "Python Website Project" 600 sets
⚡If you are interested, please follow and collect it. More project information will be updated later. ⚡
With the rapid development of my country's economy, people's demand for mobile phones is increasing, and various mobile phone software are also being widely used. However, for mobile phone data information management, various mobile phone software are also very popular among users. News information is widely used by users. In order to facilitate users to manage news information data at any time, a management system based on news information has been specially developed.
The design of news information mainly considers the functions to be achieved by the system in detail, and then designs the interface after determining the functions to be achieved. In the meantime, we also need to consider how to better combine the functions and pages, so that users can easily and clearly find the information they need, as well as the operability of the system platform in the later stage, and carry out technical development through detailed understanding of the information content.
The development of news information utilizes existing mature technology references, takes source code as a template, analyzes function adjustments and combines them with the actual needs of news information management, and discusses the use of news information management.
Keywords: news information; PHP language; MySQL database
The Internet is a basic need of human beings, especially in modern society, where personal pressure is increasing and the pace of social operation is high. With the rapid development of the Internet, user needs are also increasing. Users will increasingly rely on the Internet rather than on themselves to obtain information, which has led to the development of various software programs.
In recent years, with the continuous development of my country's economy, the management system of the platform has become more and more. Each news information will also be operated intelligently as a whole through computers. The data involved in the news information function are all related data information content such as news information through users, and can be managed; management end; home page, personal center, news category management, news information management, user management, administrator management, system management, user end; home page, news information, mine, can be distributed through the system, and the traditional management method information can no longer meet the needs of users. For this reason, this news information was developed to provide users with a news-based information system that is convenient for administrators to operate on information. The system meets the user's needs for obtaining news information, and the information can be viewed in a timely, accurate and effective manner, and can be systematic, standardized and effective.
With the development of society and the progress of science and technology, Internet technology is becoming more and more popular. The lifestyle of network communication is gradually loved by the general public. More and more Internet enthusiasts are beginning to meet their basic needs on the Internet, and at the same time gradually enter the daily life of each user. The Internet has many advantages, such as convenience, speed, high efficiency and low cost. Therefore, similar to news information, meeting the needs of users who are busy at work is not only a way to facilitate users to check information at any time, but also improves management efficiency.
This paper first takes the basic issues of the news information process as the research object. Before developing the system, we conducted a detailed investigation and analysis of the existing situation. Finally, we used computer technology to develop a complete and appropriate set of news information. The main advantages of the system are: the system is mainly developed using computer technology, it is convenient and fast; the system can view all information management of users through the administrator interface.
News information management system software is a convenient, fast and practical information service query software. With the increasing popularity of intelligent networks in the global market and the use of various intelligent platforms, the development of the system is related to people's daily needs. As China's mainstream intelligent technology development system, it naturally needs such software to meet the needs and experience of more users.
Development and implementation of news information, required work content:
(1) The first step is to determine the topic, determine the system to be built, and make a preliminary confirmation of the system background and some of the current problems.
(2) After the system is confirmed, the technology used for system development is confirmed in combination with the system development requirements. The development of this news information uses PHP technology, and the database is used to build and develop the platform. After the technology used is confirmed, a technical analysis is conducted to determine whether the technology used can complete the realization of the news information.
(3) Determine the technology used by the system, conduct online confirmation of the user roles divided by the system, and determine the functional modules to be designed based on the user role division. The design of the news information system is mainly divided into administrator and user roles, and the functional modules used are also different accordingly. However, the content implemented by the system database is interactive, and users can obtain news information at any time according to their needs. System staff can process and operate online information according to their own responsibilities. Administrators obtain detailed data information of all users and handle and solve them as soon as possible according to needs.
(4) After the functional modules of the system are confirmed, the program and interface are designed. After the design is completed, it is tested to determine whether the program is complete. For system testing, different users are required to edit and submit different content, and use different testing methods to find out the loopholes in the program, and solve the loopholes in the program online. If there is no problem with the test system, the system can be uploaded for formal operation.
WeChat developer tools are now being developed and run by the mini program development team. Currently, WeChat developer tools are still being improved and need to be updated frequently when developing mini programs. You can log in to the developer tools by scanning the WeChat QR code. The developer tools will use the information of this WeChat account to develop and debug mini programs.
Model selection: The mini program uses the screen size of smartphones as the design standard for image cutting.
Preview interface: After writing the view layout, click Compile to refresh the view interface.
Console: convenient for debugging and printing output information.
Upload code: Upload to Tencent server, which is a necessary step for submission and review. You can fill in the version number and remarks when uploading the code.
Resource file: Generally, you can perform breakpoint debugging in the file directory of the corresponding project in the resource file.
Display remote debugging: Joint debugging of mobile phone and PC development tools is very practical for users.
Local data storage: displays the data stored locally.
View debugging: The labeled components are presented in a child-parent hierarchy for easy debugging.
WeChat limits the code size to less than 2M; legal domain name information is generally not verified during development; the mini program backend needs to configure the server domain name.
The above are the functions commonly used in WeChat developer tools during the development process. WeChat developer tools are also constantly being improved.
The entire mini program framework system is divided into two parts:Logical LayerandView Layer. The goal of the Mini Program Development Framework is to allow developers to develop services with a native Mini Program experience in WeChat in the simplest and most efficient way possible. Mini Programs provide a data transmission and event system between the view layer and the logic layer, and provide their own view layer and logic layer framework, allowing developers to focus on data and logic. The core of the framework is a responsive data binding system that makes it very easy to keep data and views in sync. Modifying data in the logic layer will result in corresponding updates in the view layer. The framework provides a set of basic components that come with WeChat-style styles and special logic. Developers can create powerful WeChat Mini Programs by combining basic components.
PHP is a web page that runs on the server. When a user uses a browser to access the system, the server will use the corresponding engine to respond to and run the requested event, and finally feed back the result graph generated by the response to the browser to display it to the client. There are three stages in the execution of PHP:
The first step is the response phase, where the page server receives the requested event and gives a response result, then translates it and displays the result.
The second step is the compilation phase, where the Web container compiles the PHP file into a bytecode file (.class file)
In the third step, the system executes the event. The Web container will execute the event or request responded by the server, respond to the final result to the client and display it in the form of interface effect.
Since the official release of PHP, it has become the main application language in current programming. Since entering the Internet era, it has been well developed and applied in J2EE applications, and its linearity and scalability have become the application objects of developers. The safety, cross-platform, and security of PHP have been widely used in the Internet. Its applications and advantages can shorten the time of many programmers and make it more convenient.
For PHP language, it is like the flowers in our world. As long as you make different combinations of each flower, it will give you a new surprise. The Internet age has developed into people's lives. It is gradually used by people in their lives. It has been well applied in e-commerce and e-government. Just like the current network cannot be used in the traditional web, it cannot meet the needs of customers. If you want to achieve it, you can add some code to enter, so that you can meet the needs of users. From now on, if we want to generate some dynamic web pages, we can apply PHP and PHP, etc. For PHP, it has the following characteristics: 1. It can realize the recombination of code. 2. Re-highlight the important components. 3. The page can be re-identified. 4. It can be expanded and developed again.
Database is an indispensable part of the system development process. In terms of WEB applications, MySQL AB has developed a MySQL relational database management system with great advantages. MySQL can store data in different tables, which is very flexible and can also increase the speed of the system in practical applications. Database access is most commonly used in the standard SQL language, and MySQL is used for the SQL language, so it has a high degree of compatibility. Database operations are indispensable, including functions such as adding, deleting, modifying, and querying database tables. Nowadays, databases can be divided into relational databases and non-relational databases. Mysql belongs to a relational database. Mysql database is a small relational database. It has its own characteristics: small size, fast speed, low cost, etc. Mysql database is currently the most popular open source database.
In WEB application technology, MySQL database supports different operating system platforms. Although the installation and configuration on different platforms are different, the difference is not very big. MySQL has two installation methods on Windows platform, binary version and free installation version. After installing MySQL database, you need to start the service process, and the corresponding client can connect to the database. The client can log in to the database through the command line or graphical interface tool.
Before any project is developed and researched, a serious analysis of the needs of the R&D system itself is required. Market research cannot be ignored. The functional requirements of users should be determined from actual scenarios to clarify the goals and have a more accurate positioning of the development of the entire system. In this chapter, it is necessary to analyze the system's performance, business process, and data. The overall interface of news information is simple and functional.
The feasibility of the requirements is to analyze and discuss what kind of requirements the developed system can meet. Whether the developed system platform meets the previous requirements. Only in the development of the pre-evaluation system can the requirements be completed before the system is developed and implemented. If you do not have the feasibility of developing a system with unqualified functions, it is a development failure. Whether the developed system is useful and can complete the requirements discussed before, the following analyzes the actual needs of news information.
System design needs to start with the actual needs of users and administrators to understand what functions they need to implement and what management work they can include.
Considering the characteristics of news information system design, several requirements should be met:
(1) It can carry out news information management work through the Internet and promote news information management.
(2) Learning methods become more diverse and management more standardized;
(3) It provides a free channel to ensure real-time and effective communication of data.
The news information uses PHP technology to develop a complete and easy-to-use front-end application, and establishes and maintains a back-end database system with complete data, security and strong stability.
The system uses PHP technology and Mysql database as design tools, which can be learned and operated simply and easily. It is worth trying to develop a set of news information by combining user roles. Data integrity and many qualities provide a basis for the functional allocation and management of data. It is also an important part of the database security platform and an important means to improve and enhance data security. In addition, in order to provide a smoother, smarter and more effective basic control method, the steps required to simultaneously build support for a secure computing environment and help maintain security are defined. Because of the powerful and free functions and good interface of these two development tools, news information is technically feasible.
Desktop news information management is developed by the developers themselves. There is no need to purchase other software or ports. Moreover, the market research and other news information done before the development of news information management are free of charge. Through the efforts of the developers themselves, all the work is done by themselves. When encountering problems that are difficult to solve by themselves, most of the relevant information is solved with the help of classmates and instructors. Therefore, the development of news information is completely feasible economically and there is no expense.
The use of PHP technology is a relatively mature technology, so there is no problem in economically developing news information.
Operability is mainly about the user experience after the news information system is designed. Administrators can manage relevant data information at any time through the system, and both administrators and users can enter their own system interface simply and clearly. The interface navigation menu can operate the function module simply and clearly, which is convenient for user information needs and data information. For the operation of the system, no professional personnel are required to directly operate and manage the function module, so the operability of the system is completely acceptable. The operation of this system also uses the interface window for login, so the operator only needs to know simple computer operations.
For performance analysis, compared with the traditional management method, the traditional management method is to use manual work with paper and pen to count and manage data information, and this method is more troublesome for storing and searching certain data information. With the advent of computer networks, this traditional method is difficult to adapt to the development of today's society. It not only reduces people's work efficiency, but also requires a lot of manpower and material resources. The time and cost of use are relatively high. In order to reduce costs and improve user work efficiency, a set of news information based on computer and network technology is developed.
The development and design of news information is an independent system, which uses popular databases for data storage and development. It is mainly to realize the user roles and corresponding functional modules of news information, so that there will be no management differences and inefficiency in the management of news information. Instead, it is exactly the opposite of traditional management information. The realization of news information can save resources and improve the processing speed of business, with fast speed, high efficiency and powerful functionality.
The first step for system security isIf a user wants to enter the system, he must go through the login window and enter his login information before logging in. Only when the information entered by the user is accurate can he enter the operating system interface and perform corresponding operations on the functional modules. If the information entered by the user is incorrect, a prompt box will appear in the window, and the user login fails. Return to the first step to re-enter the information, as shown in Figure 3-1.
Figure 3-1 Login operation flow chart
For news information, you need to add the required data information at any time. For user-added information, you need to fill in the data information to be added according to the addition interface and the content of the selection box. After the information is entered, determine whether the data information meets the requirements. If it meets the requirements, it is added. If the information added by the user does not meet the requirements, you need to return to the first step, re-enter the data information, and then perform the judgment operation, as shown in Figure 3-2.
Figure 3-2 Information adding flow chart
Regardless of which user role enters the different system operation interfaces, different information content operations can be performed. For deleting system data information, once the user deletes the information, the deleted data information cannot be restored. Therefore, when deleting data, the user must determine whether the deleted content is confirmed to be deleted. After confirming that it is correct, select Confirm Deletion Operation, as shown in Figure 3-3.
Figure 3-3 Information deletion flow chart
The overview, design and analysis of the news information system project mainly includes the specific analysis of the platform and the design of the database. The data uses the MySQL database, and the system design adopts a more user-friendly operation design. Error messages in the system can be processed and fed back in a timely manner.
The design based on news information is based on existing mobile phones and can realize management functions such as home page, personal center, news category management, news information management, user management, administrator management, and system management. It is convenient for users to have a detailed understanding and statistical analysis of the home page, news information, and mine. The module relationship diagram established according to the system function requirements is as follows:
Figure 4-1 Administrator function module diagram
Figure 4-2 User function module diagram
The development of news information analyzes the management module and the database used by the system, writes generation development, planning and operation are the necessary three steps to build an information management application, which determines whether the system can truly realize the preset functions and whether it can be implemented after successful design. In the development process, each stage must be developed strictly in a linear order, and each work generated in the corresponding stage can be verified and checked by technology. Ensure that one stage is correct after completion, and will not cause the next stage to drag, so that the system is guaranteed after completing the design function.
From the successful development experience of news information, the above method is the most effective and reduces the complexity of system development to the greatest extent, as shown in Figure 4-3.
Figure 4-3 Development system flow chart
Database is the foundation and core of information system. The quality of database design directly affects the success or failure of information system development. To create a database table, first determine the attributes of the entity and the relationship between entities. Create a data table based on the relationship.
Database is the most important step in the entire software programming. The database problem mainly determines the number of databases and the creation of structural formulas. The display system uses MySQL to manage the database to ensure the security and stability of the data.
The design of the conceptual model is to abstract the information of the real world and model the information world. It is a powerful tool for database design. Database conceptual model design can describe the conceptual model of the real world through ER diagram. The ER diagram of the system shows the links between entities in the system. Moreover, the Mysql database is a database with strong self-protection capabilities. The following figure is mainly an ER diagram of database entities:
(1) User management ER diagram, as shown in Figure 4-4:
Figure 4-4 User management entity attribute diagram
(2) The system announcement ER diagram is shown in Figure 4-5:
Figure 4-5 System announcement entity diagram
These functions can fully meet the needs of news information. This system has comprehensive functions. The system function structure is shown in Figure 4-6.
Figure 4-6 System functional structure diagram
We can analyze the data structure in detail according to the requirements, we analyze the input and output data volume requirements, determine what tables and the relationship between the structures, we can verify, adjust and improve, query and browse the process, and implement the database to enable users to have more requirements for data and functions.
Based on the characteristics of the database management system used by the system, the conceptual model of the database was converted and constructed. However, this system only needs to fully consider the function of news information, and the organization is relatively clear.
Table 4-1: allusers table
Column Name | type of data | length | constraint |
ID | int | 11 | PRIMARY KEY |
username | varchar | 50 | DEFAULT NULL |
pwd | varchar | 50 | DEFAULT NULL |
cx | varchar | 50 | DEFAULT NULL |
Table 4-2: xinwenleibie table
Column Name | type of data | length | constraint |
id | int | 11 | PRIMARY KEY |
addtime | varchar | 50 | DEFAULT NULL |
xinwenleibie | varchar | 50 | DEFAULT NULL |
Table 4-3: xinwenxinxi table
Column Name | type of data | length | constraint |
id | int | 11 | PRIMARY KEY |
addtime | varchar | 50 | DEFAULT NULL |
xinwenbiaoti | varchar | 50 | DEFAULT NULL |
xinwenleibie | varchar | 50 | DEFAULT NULL |
xinwentupian | varchar | 50 | DEFAULT NULL |
xinwenshipin | varchar | 50 | DEFAULT NULL |
xinwenxiangqing | varchar | 50 | DEFAULT NULL |
faburiqi | varchar | 50 | DEFAULT NULL |
Table 4-4: Yonghu table
Column Name | type of data | length | constraint |
id | int | 11 | PRIMARY KEY |
addtime | varchar | 50 | DEFAULT NULL |
yonghuming | varchar | 50 | DEFAULT NULL |
mima | varchar | 50 | DEFAULT NULL |
xingming | varchar | 50 | DEFAULT NULL |
xingbie | varchar | 50 | DEFAULT NULL |
touxiang | varchar | 50 | DEFAULT NULL |
shouji | varchar | 50 | DEFAULT NULL |
youxiang | varchar | 50 | DEFAULT NULL |
The user logs in through the user name and password line page, enters the news information main interface, enters the operation interface, and performs corresponding operations, as shown in Figure 5-1.
Figure 5-1 User login interface
On the user home page, you can view the home page, news information, personal information, and other information, and perform submission operations, as shown in Figure 5-2.
Figure 5-2 Home page interface
When users enter the news information page, they can fill in the news title, news category, news picture, news video, release date and other information and submit it, as shown in Figure 5-3.
Figure 5-3 News information interface
When the user enters the add comment page, he can fill in the comment content and other information and submit it, as shown in Figure 5-4.
Figure 5-4 Add comment interface
When the user enters the user information page, he can fill in the user name, password, name, gender, avatar, mobile phone number, email address and other information, and save and log out, as shown in Figure 5-5.
Figure 5-5 User information interface
When users enter my page, they can fill in news information and other information and submit it, as shown in Figure 5-6.
Figure 5-6 My interface
The administrator confirms through news information, enters the main interface of news information, enters the operation interface, fills in his/her user name, password and role online through the login window to log in, and after successful login, enters the system operation interface to obtain the corresponding information, as shown in Figure 5-7.
Figure 5-7 Administrator login main interface
The administrator enters the interface and, through the task hall of the interface, enters the system after successful login to view the homepage, personal center, news category management, news information management, user management, administrator management, system management and other functional modules, and perform corresponding operations, as shown in Figure 5-8.
Figure 5-8 Administrator function interface
The administrator can click on the personal information page to view user name and other information, and perform details, modification, and deletion operations, as shown in Figure 5-9.
Figure 5-9 Personal information interface
The administrator enters the news category management interface through the task hall of the interface. After successful login, he can enter the system to view news categories and other information, and perform details, modification, and deletion operations, as shown in Figure 5-10.
Figure 5-10 News category management interface
The administrator enters the news information management interface through the task hall of the interface. After logging in successfully, he can enter the system to view news titles, news categories, news pictures, news videos, release dates and other information, and perform details, modification and deletion operations, as shown in Figure 5-11.
Figure 5-11 News information management interface
The administrator enters the user management interface through the task hall of the interface. After successful login, he can enter the system to view the user name, password, name, gender, avatar, mobile phone, email and other information, and perform details, modification and deletion operations, as shown in Figure 5-12.
Figure 5-12 User management interface
The administrator enters the administrator management interface through the task hall of the interface. After successful login, the administrator can enter the system to view user name, password, role and other information, and perform details, modification and deletion operations, as shown in Figure 5-13.
Figure 5-13 Administrator management interface
The administrator enters the system announcement interface through the task hall of the interface. After successful login, he can enter the system to view the title, introduction, pictures and other information, and perform details, modification and deletion operations, as shown in Figure 5-14.
Figure 5-14 System announcement interface
Slideshow: This page is the slideshow management interface. Administrators can manage the slideshow on the homepage on this page. They can add new pictures to the slideshow through the create operation, modify the uploaded pictures, and delete the pictures, as shown in Figure 5-15.
Figure 5-15 Carousel management interface
Program design cannot guarantee that there are no errors. This is a development process. It is difficult to avoid errors or mistakes in the process. This is inevitable, but we cannot allow these errors to always exist in the system. Errors may cause immeasurable consequences such as system crashes, security information, the system cannot start normally, causing the user's mobile phone screen to be installed, etc. In order to avoid these problems, we need to test the program, and find these problems, and correct them, and make the system more stable and mature for a longer time. The role of this chapter is to find these problems and modify them. Although it is time-consuming and laborious, it is very important and necessary for the long-term development of the system.
Software testing is the same as the development process, and must be carried out in accordance with the formal principles of software engineering and management theory. However, domestic software testing has accumulated a lot of experience and methods, the steps are relatively mature, and the efficiency of software testing is getting higher and higher.
The realization of news information, the realization and operation of functional modules in the system must be tested to judge whether the system can be accurately realized. System testing is a must before the news information is officially uploaded and used. Errors found in the test must be corrected in a timely manner to ensure that the system is accurately provided to users.
1. Functional testing
From the user's perspective, the internal structure of the newly developed software is not known during testing, so the system can be compared to a black box, and the system can be checked for feedback after blindly inputting input. This type of testing belongs to black box testing, and the system will report an error if the wrong information is input during the test.
2. Performance Testing
Testing the overall health of a software program (known as performance testing) typically uses automated testing tools to test the overall functionality of the system, split between load testing and stress testing, and in some cases, combining the two. While stress testing tests the highest level of service a system can provide, load testing tests how the system responds to increased load.
The testing method for evaluating system quality is not limited to system coding and processes, but should be closely related to software design work and historical requirements analysis.
Software testing should follow the following principles:
(1) Software testing should be carried out as quickly as possible, and the entire testing part should be carried out throughout the entire process of software development and design. If errors are found, they should be dealt with immediately, which will greatly reduce the time of software development and improve the quality of the software.
(2) In various software tests, the plans and reports used in the testing process should be properly handled and stored. The main purpose is to facilitate future system maintenance.
(3) Clustering phenomenon in the entire process of software testing should be given priority.
(4) For software testing, we should try not to refer to the system we designed, but to test the other party's program to ensure the objectivity and fairness of the software testing results.
(5) The entire testing plan is carried out strictly in accordance with the specific implementation rules of software testing.
(6) Conduct a comprehensive review of the entire test results to avoid repeated errors.
This news information meets the requirements and needs of users, and the use of this news information can effectively increase user utilization.
6.3 Test Results
The performance and use cases obtained after the test show that the system has sufficient correctness, reliability, and stability, and can accurately process and respond to input data. The user experience of the test also received good feedback and response time. A reasonable range can be compatible with all mainstream browsers and the desired effect is designed.
In this design, I spent a lot of time to understand the knowledge used in system development, and finally completed the system design after this period of hard work. Through this stage of learning, I discovered my shortcomings and fully mastered the necessary application skills. Further learning enabled me to enrich my knowledge base and complete this arduous task. When I encountered problems, I promptly sought help from teachers and solved them through professional websites and forums. Their help allowed me to successfully overcome difficult problems step by step. The system design process is not easy, you need to constantly enrich yourself and have the courage to overcome difficulties. Some functions of system development are not perfect, and need to be further improved. After that, the perfect system will be modified through user experience to give users a better experience. I feel very happy because this is the first time I have realized this system through my own efforts, but it is by no means my last one. In the future, I will strive to realize more excellent systems.
In the system implementation of some programming languages, I was not familiar with the vocabulary, which led to difficulties in development, but I solved this big problem through the appropriate dictionary software. From this, I learned my English defects. After that, I continued to improve my English knowledge so that I would not have any future work and life. I felt very deeply about the graduation design process. I was not familiar with the development technology from the beginning. I used it step by step, and came into contact with literature and information. It was not difficult to understand that the system was implemented again and again, and the system itself was useful for online learning. I benefited a lot from this design. The writing of the thesis requires one's own willingness to achieve a little, the courage to learn all the problems in life, and the process of learning is the process of learning. Graduation design, I learned to apply theoretical knowledge to practice. Let me know what to do, we must take it seriously. Have the courage to overcome difficulties and believe in the future, I will do better.
The completion of news information and how to achieve it better requires a lot of effort, and this time will be unforgettable.
The design of news information can be completed smoothly. First of all, I would like to thank my instructor, who helped me in time when I encountered design problems and gave me full guidance when I was confused about the design. With his help, I can complete a high-quality graduation project. In the design and development of news information, the instructor put forward many practical opinions and suggestions, and provided me with a lot of relevant research materials, which enabled me to have a deeper understanding of the design. Only under the guidance of the teacher can I succeed in the graduation project. Here, I would like to express my deep gratitude to the instructor.
Here, I would also like to thank my classmates, who provided many reference opinions for my design and discussed the problems in the design with me, thus making my design mature step by step.
- /**
- * 公告通知
- * 后端接口
- * @author
- * @email
- * @date 2021-03-09 11:33:59
- */
- @RestController
- @RequestMapping("/news")
- public class NewsController {
- @Autowired
- private NewsService newsService;
-
-
-
- /**
- * 后端列表
- */
- @RequestMapping("/page")
- public R page(@RequestParam Map<String, Object> params,NewsEntity news, HttpServletRequest request){
- EntityWrapper<NewsEntity> ew = new EntityWrapper<NewsEntity>();
- PageUtils page = newsService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, news), params), params));
-
- return R.ok().put("data", page);
- }
-
- /**
- * 前端列表
- */
- @IgnoreAuth
- @RequestMapping("/list")
- public R list(@RequestParam Map<String, Object> params,NewsEntity news, HttpServletRequest request){
- EntityWrapper<NewsEntity> ew = new EntityWrapper<NewsEntity>();
- PageUtils page = newsService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, news), params), params));
- return R.ok().put("data", page);
- }
-
- /**
- * 列表
- */
- @RequestMapping("/lists")
- public R list( NewsEntity news){
- EntityWrapper<NewsEntity> ew = new EntityWrapper<NewsEntity>();
- ew.allEq(MPUtil.allEQMapPre( news, "news"));
- return R.ok().put("data", newsService.selectListView(ew));
- }
-
- /**
- * 查询
- */
- @RequestMapping("/query")
- public R query(NewsEntity news){
- EntityWrapper< NewsEntity> ew = new EntityWrapper< NewsEntity>();
- ew.allEq(MPUtil.allEQMapPre( news, "news"));
- NewsView newsView = newsService.selectView(ew);
- return R.ok("查询公告通知成功").put("data", newsView);
- }
-
- /**
- * 后端详情
- */
- @RequestMapping("/info/{id}")
- public R info(@PathVariable("id") Long id){
- NewsEntity news = newsService.selectById(id);
- return R.ok().put("data", news);
- }
-
- /**
- * 前端详情
- */
- @IgnoreAuth
- @RequestMapping("/detail/{id}")
- public R detail(@PathVariable("id") Long id){
- NewsEntity news = newsService.selectById(id);
- return R.ok().put("data", news);
- }
-
-
-
-
- /**
- * 后端保存
- */
- @RequestMapping("/save")
- public R save(@RequestBody NewsEntity news, HttpServletRequest request){
- news.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
- //ValidatorUtils.validateEntity(news);
- newsService.insert(news);
- return R.ok();
- }
-
- /**
- * 前端保存
- */
- @RequestMapping("/add")
- public R add(@RequestBody NewsEntity news, HttpServletRequest request){
- news.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
- //ValidatorUtils.validateEntity(news);
- newsService.insert(news);
- return R.ok();
- }
-
- /**
- * 修改
- */
- @RequestMapping("/update")
- public R update(@RequestBody NewsEntity news, HttpServletRequest request){
- //ValidatorUtils.validateEntity(news);
- newsService.updateById(news);//全部更新
- return R.ok();
- }
-
-
- /**
- * 删除
- */
- @RequestMapping("/delete")
- public R delete(@RequestBody Long[] ids){
- newsService.deleteBatchIds(Arrays.asList(ids));
- return R.ok();
- }
-
- /**
- * 提醒接口
- */
- @RequestMapping("/remind/{columnName}/{type}")
- public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
- @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
- map.put("column", columnName);
- map.put("type", type);
-
- if(type.equals("2")) {
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
- Calendar c = Calendar.getInstance();
- Date remindStartDate = null;
- Date remindEndDate = null;
- if(map.get("remindstart")!=null) {
- Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
- c.setTime(new Date());
- c.add(Calendar.DAY_OF_MONTH,remindStart);
- remindStartDate = c.getTime();
- map.put("remindstart", sdf.format(remindStartDate));
- }
- if(map.get("remindend")!=null) {
- Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
- c.setTime(new Date());
- c.add(Calendar.DAY_OF_MONTH,remindEnd);
- remindEndDate = c.getTime();
- map.put("remindend", sdf.format(remindEndDate));
- }
- }
-
- Wrapper<NewsEntity> wrapper = new EntityWrapper<NewsEntity>();
- if(map.get("remindstart")!=null) {
- wrapper.ge(columnName, map.get("remindstart"));
- }
- if(map.get("remindend")!=null) {
- wrapper.le(columnName, map.get("remindend"));
- }
-
-
- int count = newsService.selectCount(wrapper);
- return R.ok().put("count", count);
- }
-
-
-
- }