1.包含源程序,数据库脚本。代码和数据库脚本都有详细注释。
2.课题设计仅供参考学习使用,可以在此基础上进行扩展完善
开发环境: 代码已经上传github,下载地址:https://github.com/21503882/citybus
Eclipse ,MYSQL,JDK1.8,Tomcat 8.5
涉及技术点:
MVC模式、SpringBoot、Mybatis、Redis、HTML、log4j、druid、Bootstrap、
Semantic UI、Thymeleaf、JavaScript、CSS、JQUERY、Ajax等
适合学习J2EE的一段时间的熟手,代码思路清晰,注解详细,数据库用的是mysql5.1,服务器用的tomcat8.5,JDK版本1.8. 编程软件Eclispe J2EE版本。是典型MVC架构,并且前后台分离
package com.linxf.ticketsale.controller;
import com.linxf.ticketsale.pojo.Station;
import com.linxf.ticketsale.pojo.Train;
import com.linxf.ticketsale.service.TrainService;
import com.linxf.ticketsale.util.JedisUtil;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import java.util.*;
@Controller
@RequestMapping("/trainController")
public class TrainController {
private static final Logger LOG = Logger.getLogger(TrainController.class);
@Resource
private TrainService trainService;
// 根据车辆类型获取车辆信息列表
@RequestMapping("/getTrainList.action")
@ResponseBody
public List<Train> getTrainList(String ttype) {
List<Train> list = null;
if (ttype == null) {
return list;
}
try {
list = trainService.getTrainList(ttype);
} catch (Exception e) {
LOG.info("getTrainList出错:" + e);
e.printStackTrace();
}
return list;
}
// 获取所有车辆的编号
@RequestMapping("/getTidList.action")
@ResponseBody
public List<String> getTidList() {
List<String> list = null;
try {
list = trainService.getTidList();
} catch (Exception e) {
LOG.info("getTidList出错:" + e);
e.printStackTrace();
}
return list;
}
// 根据编号获取车辆信息
@RequestMapping("/getTrainInfoById.action")
@Response