Food review system based on SpringBoot

1 Introduction

With the development of society, all walks of life in society are taking advantage of the information age. The dominance and popularity of computers necessitated the development of various information systems.

Food review management system, the main modules include home page, personal center, user management, restaurant management, gourmet restaurant management, regional management, cuisine management, restaurant review management, system management and other functions. The administrator in the system is mainly to store and manage all kinds of information safely and effectively, and can also manage, update and maintain the system, and has corresponding operation authority on the background.

In order to realize the various functions of the food review management system, it needs the strong support of the background database. A large amount of data such as the administrator verifying the registration information, the collected information, and the related information obtained from the analysis are all managed by the database. In this paper, the database server uses Mysql as the background database, which makes the Web and the database closely linked. During the design process, the system code is fully guaranteed to be readable, practical, easy to expand, universal, easy to maintain later, easy to operate, and the page is concise.

The development of this system makes it more convenient and quick to obtain the information of the food review management system, and also makes the management information of the food review management system more systematic and orderly. The system interface is more friendly and easy to operate.

2. Development technology

2.1 Spring Boot framework

The Spring framework is an open source application framework on the Java platform that provides a container with inversion of control features. Although the Spring framework itself has no restrictions on the programming model, its frequent use in Java applications made it so popular that it was later used as a supplement or even a substitute for the EJB (EnterpriseJavaBeans) model. The Spring framework provides a series of solutions for development, such as using the core features of inversion of control, and implementing inversion of control through dependency injection to realize the containerization of the management object life cycle, using aspect-oriented programming for declarative transaction management, and integrating A variety of persistence technologies manage data access, provide a large number of excellent web frameworks to facilitate development, and so on. The Spring framework has the feature of inversion of control (IOC). IOC is designed to facilitate project maintenance and testing. It provides a method for unified configuration and management of Java objects through the Java reflection mechanism. The Spring framework uses the container to manage the life cycle of objects. The container can configure objects by scanning XML files or specific Java annotations on classes. Developers can obtain objects through dependency lookup or dependency injection. The Spring framework has an aspect-oriented programming (AOP) framework. The Spring AOP framework is based on the proxy mode and is configurable at runtime. The AOP framework is mainly modularized for cross concerns between modules. The AOP framework of the Spring framework only provides basic AOP features. Although it cannot be compared with the AspectJ framework, it can also meet the basic needs through integration with AspectJ. Functions such as transaction management and remote access under the Spring framework can be realized by using Spring AOP technology. Spring's transaction management framework brings an abstraction mechanism to the Java platform that enables local and global transactions, as well as nested transactions, to work with savepoints and in almost any environment on the Java platform.

2.2 Introduction to Java language

Java was launched by Sun, which was acquired by Oracle in 2010. Java was originally the English name of an Indonesian island called Java, so java is the logo of a cup of steaming coffee. The Java language has significant advantages and broad prospects in the context of the mobile Internet. It is object-oriented, distributed, dynamic, and has platform independence, security, and robustness. The basic statement syntax of the Java language is the same as that of C++, but its object-oriented technology is more thorough, because Java requires that all content must be encapsulated into classes, and classes are used as the basic unit of programs. Because variables and methods outside the class are not allowed. The distribution of the Java language is reflected in the data distribution and operation distribution. It is a network-oriented language that can handle the TCP/IP protocol, and it also supports the client/server computing model. The dynamic nature of the Java language means that classes are dynamically installed at runtime, enabling Java to maintain programs dynamically. Java does not support pointers, and all operations on memory access are realized through object instantiation, which avoids errors that are easy to occur in pointer operations, and also prevents viruses from destroying and threatening the system.

The programming style of the Java language is very close to that of the C language. It inherits the core of the C++ object-oriented technology. People in the industry call it "compile once, execute everywhere". Of course, java also has disadvantages. After each execution of compilation, the bytecode needs to consume a certain amount of time, which reduces performance to some extent. But this does not affect java as the choice of design language. The Java language is easy to learn, the programming time is short, and the functionality is strong, making it easier and faster for developers to learn. The main features of Java are as follows:

1. Object-oriented

Object-oriented has four characteristics: encapsulation, inheritance, polymorphism, and abstraction. Abstraction means ignoring the minor parts of a problem and focusing on the main ones. Polymorphism refers to different responses to the same message. Inheritance refers to adding its own unique method on the basis of the original parent class method without changing the original parent class.

2. Platform independence,

What Java compiles is bytecode, which is directly executed by the virtual machine. On any platform, as long as there is a Java virtual machine, Java code can run.

3. Reliability and safety

Java's access to memory must be implemented through object instance variables, avoiding errors in pointers.

4. Multithreading

Java provides multi-threading function, which uses programming to realize the function of working at the same time at the same time.

2.3 Implementation method of accessing database

(1) First introduce the basic steps of web database search on the Internet:

Step 1: Check the consumer's data,

Step 2: You have to establish a connection to the database;

Step 3: Search the database;

The fourth step: the structure of the data;

Step 5: The results for that user are shown.

(2) The system until my MYSQL5.0 PHP integrated development environment, such as using the WAMP server is powered on, and the report development environment for easier access to the database:

A connection to the MySQL database server Mysql_connect-;

Syntax: mysql_connect resource(host, username, password);

Please select the database: mysql_select_db(name of database link ID);

Close the database: then mysql_close();

2.4 Two connection methods of the system to the MySQL database

Active MySQL/MySQL library, or using the ODBC interface, the MySQL database is a two-way link. Permanent and non-permanent connections.

(1) Permanent connection: The biggest advantage of a more permanent connection request is that it can be very effective for clients to stand in close contact. When connecting to the MySQL server, it is even better. Every child in the drafting of the page is in the process, not just at any time, only during the lifetime of the connection to the MySQL server request, once connected. This subprocess is to establish a separate connection to the server which can be permanent.

(2) Non-permanent connection: it is a short circuit. The submission goes on the way to the web server, the server processes the request and the requested page you want to send to the browser client, and then the connection is broken. For most websites, it's often about being efficient by being effective, but in most cases the connection is used, but it's a full time to avoid any problems and can increase the capacity the server hosts.

2.5 MySql database

The language of Mysql is unstructured, and users can work on the data. Because the language and structure of Mysql are relatively simple, but the function and the amount of stored information are very powerful, its speed, reliability and adaptability have attracted much attention and been widely used. The role of Mysql database in the programming process is very extensive, which brings convenience for users to query data. The application characteristics of Mysql database: strong flexibility, powerful functions, and relatively concise language. 

Data flow analysis is mainly a storage room for data storage, which is performed on a computer, not a storage room in reality. Database management is mainly data storage, modification and addition, and the establishment of data tables. The establishment of the data table can adjust the data in the data table, recombine and reconstruct the data to ensure the security of the data. Due to the powerful features of the database, the development of this system mainly uses Mysql to manage the data.

3. Functional design

The system architecture diagram belongs to the system design stage. The system architecture diagram is only a product of this stage. The overall architecture of the system determines the mode of the entire system and is the basis of the system. The overall structural design of the food review management system is shown in the figure.

4. Functional renderings

4.1 System function modules

Food review management system, on the home page of the system, you can view the home page, gourmet restaurants, website announcements, personal center, background management and other information for detailed operations, as shown in Figure 4-1. 

Figure 4-1 System homepage interface diagram

Gourmet restaurant, on the gourmet restaurant page, you can check the restaurant name, cuisine, region, specific address, per capita consumption, total score, business hours, clicks and other information, and perform immediate comment, special food or comment operations; as shown in Figure 4-2 shown.

Figure 4-2 interface diagram of gourmet restaurant

User registration, complete user registration by filling in user account, password, confirmation password, user name, contact information and other information on the user registration page, as shown in Figure 4-3.

Figure 4-3 User registration interface diagram

On the personal center page, modify personal information by filling in user account, password, user name, uploaded picture, gender, contact information and other information, and operate my favorites as needed, as shown in Figure 4-4.

Figure 4-4 Personal center interface diagram

4.2 Administrator function module

Administrator login, the administrator enters the user name, password, selects the role and other information, and then clicks Login to log in to the system for system use, as shown in Figure 4-5.

Figure 4-5 Administrator login interface

After the administrator logs into the system, he can view all the information, including the home page, personal center, user management, restaurant management, gourmet restaurant management, area management, cuisine management, restaurant review management, system management, etc. It can be operated and managed accordingly, as shown in Figure 4-6.

Figure 4-6 Administrator function interface diagram

User management, in the user management page, you can perform operations such as details, modification or deletion of index, user account, user name, photo, gender, contact information and other information, as shown in Figure 4-7.

Figure 4-7 User management interface diagram

Restaurant management, on the restaurant management page, you can perform detailed operations such as index, restaurant name, restaurant picture, specific address, contact person, contact number, business scope, review reply, review status, review and other information, modify or delete, as shown in the figure 5-8 shown.

Figure 4-8 Restaurant management interface diagram

Gourmet restaurant management, on the gourmet restaurant management page, you can perform operations such as detailing, modifying, viewing comments or deleting information such as index, restaurant name, environment picture, cuisine, region, specific address, per capita consumption, total score, business hours, etc., such as As shown in Figure 5-9.

Figure 4-9 Gourmet restaurant management interface diagram

Region management. On the region management page, you can perform operations such as detailing, modifying or deleting information such as indexes and regions, as shown in Figure 4-10.

Figure 4-10 Regional management interface diagram

Cuisine management, in the cuisine management page, you can perform operations such as details, modification or deletion of index, cuisine and other information, as shown in Figure 4-11.

Figure 4-11 Cuisine Management Interface Diagram

System management, in the carousel map management page, you can perform detailed operations such as index, name, and value information, modify operations, and operate website announcements as required, as shown in Figure 4-12.

Figure 4-12 System management interface diagram

4.3 User function modules

After logging in to the system, the user can view the home page, personal center, restaurant review management and other information for detailed operations, as shown in Figure 5-13.

Figure 4-13 User Function Interface Diagram 

Personal center, modify personal information by filling in user account, photo, gender, user name, contact information and other information on the personal center page, as shown in Figure 4-14.

Figure 4-14 Personal center interface diagram

Restaurant review management, in the restaurant review management page, you can perform operations such as details or deletion of index, restaurant name, environment picture, taste, service, environment, total score, evaluation time, user account, user name and other information, as shown in Figure 4- 15.

Figure 4-15 Restaurant review management interface diagram

4.4 Restaurant functional modules

After the restaurant logs in to the system, you can view the home page, personal center, gourmet restaurant management, restaurant review management and other information for detailed operations, as shown in Figure 4-16.

Figure 4-16 Restaurant function interface diagram

Restaurant review management, in the restaurant review management page, you can perform operations such as details or deletion of index, restaurant name, environment picture, taste, service, environment, total score, evaluation time, user account, user name and other information, as shown in Figure 4- 17.

Figure 4-17 Restaurant review management interface diagram

5. Core code

/**
 * 菜系
 * 后端接口
 * @author 
 * @email 
 * @date 2022-08-01 21:25:36
 */
@RestController
@RequestMapping("/caixi")
public class CaixiController {
    @Autowired
    private CaixiService caixiService;


    


    /**
     * 后端列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,CaixiEntity caixi,
		HttpServletRequest request){
        EntityWrapper<CaixiEntity> ew = new EntityWrapper<CaixiEntity>();

		PageUtils page = caixiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, caixi), params), params));

        return R.ok().put("data", page);
    }
    
    /**
     * 前端列表
     */
	@IgnoreAuth
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params,CaixiEntity caixi, 
		HttpServletRequest request){
        EntityWrapper<CaixiEntity> ew = new EntityWrapper<CaixiEntity>();

		PageUtils page = caixiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, caixi), params), params));
        return R.ok().put("data", page);
    }

	/**
     * 列表
     */
    @RequestMapping("/lists")
    public R list( CaixiEntity caixi){
       	EntityWrapper<CaixiEntity> ew = new EntityWrapper<CaixiEntity>();
      	ew.allEq(MPUtil.allEQMapPre( caixi, "caixi")); 
        return R.ok().put("data", caixiService.selectListView(ew));
    }

	 /**
     * 查询
     */
    @RequestMapping("/query")
    public R query(CaixiEntity caixi){
        EntityWrapper< CaixiEntity> ew = new EntityWrapper< CaixiEntity>();
 		ew.allEq(MPUtil.allEQMapPre( caixi, "caixi")); 
		CaixiView caixiView =  caixiService.selectView(ew);
		return R.ok("查询菜系成功").put("data", caixiView);
    }
	
    /**
     * 后端详情
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        CaixiEntity caixi = caixiService.selectById(id);
        return R.ok().put("data", caixi);
    }

    /**
     * 前端详情
     */
	@IgnoreAuth
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id){
        CaixiEntity caixi = caixiService.selectById(id);
        return R.ok().put("data", caixi);
    }
    



    /**
     * 后端保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody CaixiEntity caixi, HttpServletRequest request){
    	caixi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    	//ValidatorUtils.validateEntity(caixi);
        caixiService.insert(caixi);
        return R.ok();
    }
    
    /**
     * 前端保存
     */
    @RequestMapping("/add")
    public R add(@RequestBody CaixiEntity caixi, HttpServletRequest request){
    	caixi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    	//ValidatorUtils.validateEntity(caixi);
        caixiService.insert(caixi);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @Transactional
    public R update(@RequestBody CaixiEntity caixi, HttpServletRequest request){
        //ValidatorUtils.validateEntity(caixi);
        caixiService.updateById(caixi);//全部更新
        return R.ok();
    }
    

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        caixiService.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<CaixiEntity> wrapper = new EntityWrapper<CaixiEntity>();
		if(map.get("remindstart")!=null) {
			wrapper.ge(columnName, map.get("remindstart"));
		}
		if(map.get("remindend")!=null) {
			wrapper.le(columnName, map.get("remindend"));
		}


		int count = caixiService.selectCount(wrapper);
		return R.ok().put("count", count);
	}

}
/**
 * 餐厅
 * 后端接口
 * @author 
 * @email 
 * @date 2022-08-01 21:25:36
 */
@RestController
@RequestMapping("/canting")
public class CantingController {
    @Autowired
    private CantingService cantingService;


    
	@Autowired
	private TokenService tokenService;
	
	/**
	 * 登录
	 */
	@IgnoreAuth
	@RequestMapping(value = "/login")
	public R login(String username, String password, String captcha, HttpServletRequest request) {
		CantingEntity user = cantingService.selectOne(new EntityWrapper<CantingEntity>().eq("cantingmingcheng", username));
		if(user==null || !user.getMima().equals(password)) {
			return R.error("账号或密码不正确");
		}
		
                if("否".equals(user.getSfsh())) return R.error("账号已锁定,请联系管理员审核。");
		String token = tokenService.generateToken(user.getId(), username,"canting",  "餐厅" );
		return R.ok().put("token", token);
	}
	
	/**
     * 注册
     */
	@IgnoreAuth
    @RequestMapping("/register")
    public R register(@RequestBody CantingEntity canting){
    	//ValidatorUtils.validateEntity(canting);
    	CantingEntity user = cantingService.selectOne(new EntityWrapper<CantingEntity>().eq("cantingmingcheng", canting.getCantingmingcheng()));
		if(user!=null) {
			return R.error("注册用户已存在");
		}
		Long uId = new Date().getTime();
		canting.setId(uId);
        cantingService.insert(canting);
        return R.ok();
    }

	
	/**
	 * 退出
	 */
	@RequestMapping("/logout")
	public R logout(HttpServletRequest request) {
		request.getSession().invalidate();
		return R.ok("退出成功");
	}
	
	/**
     * 获取用户的session用户信息
     */
    @RequestMapping("/session")
    public R getCurrUser(HttpServletRequest request){
    	Long id = (Long)request.getSession().getAttribute("userId");
        CantingEntity user = cantingService.selectById(id);
        return R.ok().put("data", user);
    }
    
    /**
     * 密码重置
     */
    @IgnoreAuth
	@RequestMapping(value = "/resetPass")
    public R resetPass(String username, HttpServletRequest request){
    	CantingEntity user = cantingService.selectOne(new EntityWrapper<CantingEntity>().eq("cantingmingcheng", username));
    	if(user==null) {
    		return R.error("账号不存在");
    	}
        user.setMima("123456");
        cantingService.updateById(user);
        return R.ok("密码已重置为:123456");
    }


    /**
     * 后端列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,CantingEntity canting,
		HttpServletRequest request){
        EntityWrapper<CantingEntity> ew = new EntityWrapper<CantingEntity>();

		PageUtils page = cantingService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, canting), params), params));

        return R.ok().put("data", page);
    }
    
    /**
     * 前端列表
     */
	@IgnoreAuth
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params,CantingEntity canting, 
		HttpServletRequest request){
        EntityWrapper<CantingEntity> ew = new EntityWrapper<CantingEntity>();

		PageUtils page = cantingService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, canting), params), params));
        return R.ok().put("data", page);
    }

	/**
     * 列表
     */
    @RequestMapping("/lists")
    public R list( CantingEntity canting){
       	EntityWrapper<CantingEntity> ew = new EntityWrapper<CantingEntity>();
      	ew.allEq(MPUtil.allEQMapPre( canting, "canting")); 
        return R.ok().put("data", cantingService.selectListView(ew));
    }

	 /**
     * 查询
     */
    @RequestMapping("/query")
    public R query(CantingEntity canting){
        EntityWrapper< CantingEntity> ew = new EntityWrapper< CantingEntity>();
 		ew.allEq(MPUtil.allEQMapPre( canting, "canting")); 
		CantingView cantingView =  cantingService.selectView(ew);
		return R.ok("查询餐厅成功").put("data", cantingView);
    }
	
    /**
     * 后端详情
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        CantingEntity canting = cantingService.selectById(id);
        return R.ok().put("data", canting);
    }

    /**
     * 前端详情
     */
	@IgnoreAuth
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id){
        CantingEntity canting = cantingService.selectById(id);
        return R.ok().put("data", canting);
    }
    



    /**
     * 后端保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody CantingEntity canting, HttpServletRequest request){
    	canting.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    	//ValidatorUtils.validateEntity(canting);
    	CantingEntity user = cantingService.selectOne(new EntityWrapper<CantingEntity>().eq("cantingmingcheng", canting.getCantingmingcheng()));
		if(user!=null) {
			return R.error("用户已存在");
		}
		canting.setId(new Date().getTime());
        cantingService.insert(canting);
        return R.ok();
    }
    
    /**
     * 前端保存
     */
    @RequestMapping("/add")
    public R add(@RequestBody CantingEntity canting, HttpServletRequest request){
    	canting.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    	//ValidatorUtils.validateEntity(canting);
    	CantingEntity user = cantingService.selectOne(new EntityWrapper<CantingEntity>().eq("cantingmingcheng", canting.getCantingmingcheng()));
		if(user!=null) {
			return R.error("用户已存在");
		}
		canting.setId(new Date().getTime());
        cantingService.insert(canting);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @Transactional
    public R update(@RequestBody CantingEntity canting, HttpServletRequest request){
        //ValidatorUtils.validateEntity(canting);
        cantingService.updateById(canting);//全部更新
        return R.ok();
    }
    

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        cantingService.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<CantingEntity> wrapper = new EntityWrapper<CantingEntity>();
		if(map.get("remindstart")!=null) {
			wrapper.ge(columnName, map.get("remindstart"));
		}
		if(map.get("remindend")!=null) {
			wrapper.le(columnName, map.get("remindend"));
		}


		int count = cantingService.selectCount(wrapper);
		return R.ok().put("count", count);
	}
	

}

/**
 * 餐厅点评
 * 后端接口
 * @author 
 * @email 
 * @date 2022-08-01 21:25:36
 */
@RestController
@RequestMapping("/cantingdianping")
public class CantingdianpingController {
    @Autowired
    private CantingdianpingService cantingdianpingService;


    


    /**
     * 后端列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,CantingdianpingEntity cantingdianping,
		HttpServletRequest request){
		String tableName = request.getSession().getAttribute("tableName").toString();
		if(tableName.equals("canting")) {
			cantingdianping.setCantingmingcheng((String)request.getSession().getAttribute("username"));
		}
		if(tableName.equals("yonghu")) {
			cantingdianping.setYonghuzhanghao((String)request.getSession().getAttribute("username"));
		}
        EntityWrapper<CantingdianpingEntity> ew = new EntityWrapper<CantingdianpingEntity>();

		PageUtils page = cantingdianpingService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, cantingdianping), params), params));

        return R.ok().put("data", page);
    }
    
    /**
     * 前端列表
     */
	@IgnoreAuth
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params,CantingdianpingEntity cantingdianping, 
		HttpServletRequest request){
        EntityWrapper<CantingdianpingEntity> ew = new EntityWrapper<CantingdianpingEntity>();

		PageUtils page = cantingdianpingService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, cantingdianping), params), params));
        return R.ok().put("data", page);
    }

	/**
     * 列表
     */
    @RequestMapping("/lists")
    public R list( CantingdianpingEntity cantingdianping){
       	EntityWrapper<CantingdianpingEntity> ew = new EntityWrapper<CantingdianpingEntity>();
      	ew.allEq(MPUtil.allEQMapPre( cantingdianping, "cantingdianping")); 
        return R.ok().put("data", cantingdianpingService.selectListView(ew));
    }

	 /**
     * 查询
     */
    @RequestMapping("/query")
    public R query(CantingdianpingEntity cantingdianping){
        EntityWrapper< CantingdianpingEntity> ew = new EntityWrapper< CantingdianpingEntity>();
 		ew.allEq(MPUtil.allEQMapPre( cantingdianping, "cantingdianping")); 
		CantingdianpingView cantingdianpingView =  cantingdianpingService.selectView(ew);
		return R.ok("查询餐厅点评成功").put("data", cantingdianpingView);
    }
	
    /**
     * 后端详情
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        CantingdianpingEntity cantingdianping = cantingdianpingService.selectById(id);
        return R.ok().put("data", cantingdianping);
    }

    /**
     * 前端详情
     */
	@IgnoreAuth
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id){
        CantingdianpingEntity cantingdianping = cantingdianpingService.selectById(id);
        return R.ok().put("data", cantingdianping);
    }
    



    /**
     * 后端保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody CantingdianpingEntity cantingdianping, HttpServletRequest request){
    	cantingdianping.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    	//ValidatorUtils.validateEntity(cantingdianping);
        cantingdianpingService.insert(cantingdianping);
        return R.ok();
    }
    
    /**
     * 前端保存
     */
    @RequestMapping("/add")
    public R add(@RequestBody CantingdianpingEntity cantingdianping, HttpServletRequest request){
    	cantingdianping.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    	//ValidatorUtils.validateEntity(cantingdianping);
        cantingdianpingService.insert(cantingdianping);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @Transactional
    public R update(@RequestBody CantingdianpingEntity cantingdianping, HttpServletRequest request){
        //ValidatorUtils.validateEntity(cantingdianping);
        cantingdianpingService.updateById(cantingdianping);//全部更新
        return R.ok();
    }
    

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        cantingdianpingService.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<CantingdianpingEntity> wrapper = new EntityWrapper<CantingdianpingEntity>();
		if(map.get("remindstart")!=null) {
			wrapper.ge(columnName, map.get("remindstart"));
		}
		if(map.get("remindend")!=null) {
			wrapper.le(columnName, map.get("remindend"));
		}

		String tableName = request.getSession().getAttribute("tableName").toString();
		if(tableName.equals("canting")) {
			wrapper.eq("cantingmingcheng", (String)request.getSession().getAttribute("username"));
		}
		if(tableName.equals("yonghu")) {
			wrapper.eq("yonghuzhanghao", (String)request.getSession().getAttribute("username"));
		}

		int count = cantingdianpingService.selectCount(wrapper);
		return R.ok().put("count", count);
	}


}

6. Reference Papers

Summary

1 System overview

1.1 Overview

1.2 Significance of the topic

1.3 Main content

2 System development environment

2.1 Spring Boot framework

2.2 Introduction to Java language

2.3 Implementation method of accessing database

2.4 Two connection methods of the system to the MySQL database

2.5 MySql database

3 Demand Analysis

3.1 Technical Feasibility: Technical Background

3.2 Economic feasibility

3.3 Operation Feasibility

3.4 System Design Rules

3.5 System flow and logic

4 System Outline Design

4.1 Overview

4.2 System structure

4.3. Database design

4.3.1 Database entities

4.3.2 Database Design Table

5 System detailed design

5.1 System function modules

5.2 Administrator function module

5.3 User function modules

5.4 Restaurant functional modules

6 System Test

6.1 Purpose of system testing

6.2 System Test Method

6.3 Test results

in conclusion

thank you

7. Summary

Through the introduction of java and Mysql database, this system illustrates the feasibility of food review management system from both sides of hardware and software. Responsive display. Through the research and implementation of this food review management system, I feel that there is no limit to learning, and learning has no end. It is inevitable that there will be many ill-considered places. For example, there must be a beautiful interface and more complete functions in order to attract more users.

Since I didn't have a deep understanding of java knowledge before this, I encountered many difficulties from the beginning, such as irregular page display at the beginning, problems with the database connection, and the transfer of parameters could not be realized, etc. However, I searched for relevant information on the Internet. And with the help of my classmates, I finally got a solution. In the process, I not only learned a lot of knowledge, but also improved my ability to solve problems, especially learning how to filter out the useful information from a large amount of information. I have realized more deeply that although most of the knowledge in books is valuable and correct, in fact, everyone's programming ideas and data processing methods and ideas are different, which requires us to pass Practice can find solutions to problems. In this graduation design activity, I have continuously improved myself and gained valuable experience, which I believe will be of great help to my future development.

Through the development of this food review management system, I referred to many examples of related systems, learned from each other, absorbed the strengths of other systems, and gradually improved the system, but the system still has many shortcomings, which need to be further improved in the future study.

Practice has proved that the food review management system has a very good development prospect. After testing and running, the functions of the system are very perfect, the interface is beautiful, easy to use, easy to operate, and it has matured in technology theory.

Guess you like

Origin blog.csdn.net/lf21qp/article/details/131429919