Springboot+vue project train booking management system

Get the source code at the end of the article

Development language: Java

Development tools: IDEA/Eclipse

Database: MYSQL5.7

Application service:Tomcat7/Tomcat8

Use framework: springboot+vue

JDK version: jdk1.8

The main users of the train booking management system are divided into administrators and users. The functions include administrators: home page, personal center, user management, model information management, train information management, ticket order management, change order management, and refund order. Management, system management, user: home page, personal center, ticket order management, change order management, refund order management, front page home page; home page, train information, train information, personal center, background management and other functions.

Database Design

A good database can be related to the pros and cons of program development. Database design is inseparable from the design of table structure, as well as the relationship between tables, as well as information such as the content of data tables that need to be designed for system development. During the database design, it is necessary to carry out targeted development and design of the database according to the actual situation.

 Database ER diagram design

This train booking management system uses MYSQL database, which is fast in data storage, because the train booking management system is mainly about the management of information, and there is a lot of information content, which requires a good database to be well designed, and the classification must be clear , when the information cannot be added, the information is too confusing. The designed database first needs to express the relationship between the various entities clearly. The ER diagram of the system is shown in the following figure:

1. User information entity diagram is shown in the figure

2. The entity diagram of train information management is shown in the figure 

3. The entity diagram of model information management is shown in the figure

 

System detailed design 

Front page home function module

In the train booking management system, you can view the home page, train information, train information, personal center, background management, etc. on the home page of the system, as shown in the figure 

Login, user registration, on the user registration page, you can fill in the user name, password, name, gender, avatar, ID card, mobile phone and other information to register, as shown in the figure 

Train information, fill in the train name, train name, license plate, picture, starting station, terminal station, route, date, departure time, duration, seat type, price, number of tickets and other information on the train information page. As shown 

Administrator function module

Admin login interface diagram 

Personal information interface diagram

 

User management interface diagram

 

Model information management interface diagram

 

Train information management interface diagram

 

User function module

Personal center interface diagram

 

 Personal information interface diagram

Change order management interface diagram

 

Part of the core code: 

package com.controller;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;

import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;

import com.entity.ChecixinxiEntity;
import com.entity.view.ChecixinxiView;

import com.service.ChecixinxiService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;


/**
 * 车次信息
 * 后端接口
 * @author 
 * @email 
 * @date 2021-02-27 11:45:54
 */
@RestController
@RequestMapping("/checixinxi")
public class ChecixinxiController {
    @Autowired
    private ChecixinxiService checixinxiService;
    


    /**
     * 后端列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,ChecixinxiEntity checixinxi, HttpServletRequest request){
        EntityWrapper<ChecixinxiEntity> ew = new EntityWrapper<ChecixinxiEntity>();
		PageUtils page = checixinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, checixinxi), params), params));

        return R.ok().put("data", page);
    }
    
    /**
     * 前端列表
     */
	@IgnoreAuth
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params,ChecixinxiEntity checixinxi, HttpServletRequest request){
        EntityWrapper<ChecixinxiEntity> ew = new EntityWrapper<ChecixinxiEntity>();
		PageUtils page = checixinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, checixinxi), params), params));
        return R.ok().put("data", page);
    }

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

	 /**
     * 查询
     */
    @RequestMapping("/query")
    public R query(ChecixinxiEntity checixinxi){
        EntityWrapper< ChecixinxiEntity> ew = new EntityWrapper< ChecixinxiEntity>();
 		ew.allEq(MPUtil.allEQMapPre( checixinxi, "checixinxi")); 
		ChecixinxiView checixinxiView =  checixinxiService.selectView(ew);
		return R.ok("查询车次信息成功").put("data", checixinxiView);
    }
	
    /**
     * 后端详情
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        ChecixinxiEntity checixinxi = checixinxiService.selectById(id);
        return R.ok().put("data", checixinxi);
    }

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



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

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

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


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


}

Guess you like

Origin blog.csdn.net/m0_49113107/article/details/123810272