作者主页:夜未央5788
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
项目介绍
学生;游客角色包含以下功能:
信息播报,器材管理,成绩浏览,赛事安排,选手浏览,登录页面等功能。
管理员界面包含以下功能:
参赛成绩设置,参赛资料,器材管理,成绩查询,裁判管理,赛事安排,选手资料,项目设置,首页等功能。
由于本程序规模不大,可供课程设计,毕业设计学习演示之用
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.数据库:MySql 5.7版本;
6.是否Maven项目:否;
技术栈
1. 后端:mysql+Spring+hibernate
2. 前端:HTML+CSS+JavaScript+jsp
使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入localhost:8080/ 登录
运行截图
相关代码
班级管理控制器
@RolesAllowed("ADMIN")
@Controller
@RequestMapping("classes")
public class ClassesController {
@Autowired
private ClassesService classesService;
/**
* 查询所有班级信息
*
* @return
*/
@RequestMapping("/findAll.do")
public ModelAndView findAll() {
ModelAndView mv = new ModelAndView();
List<Classes> classesList = classesService.findAll();
mv.addObject("classesList", classesList);
mv.setViewName("classes-list");
return mv;
}
/**
* 查询班级详细信息
*
* @param cId
* @return
*/
@RequestMapping("/findDetailsBycId.do")
public ModelAndView findDetailsBycId(Integer cId) {
ModelAndView mv = new ModelAndView();
Map<String, Object> map = classesService.findDetailsBycId(cId);
Classes classes = (Classes) map.get("classes");
List<Student> studentList = (List<Student>) map.get("studentList");
mv.addObject("studentList", studentList);
mv.addObject("classes", classes);
mv.setViewName("classes-details");
return mv;
}
/**
* 删除班级
*
* @param cId
* @return
*/
@RequestMapping("/deleteByPK.do")
public String deleteByIds(Integer[] cId) {
classesService.deleteByPK(cId);
return "redirect:findAll.do";
}
/**
* 遍历所有出班级
*
* @return
*/
@RequestMapping(value = "/findAllClasses.do", produces = "application/json; charset=utf-8")
@ResponseBody
public List<Classes> findAllClasses() {
return classesService.findAllClasses();
}
/**
* 根据id查找班级信息,获取信息到模态框上
*
* @param id
* @return
*/
@RequestMapping(value = "/findById.do", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
@ResponseBody
public Classes findById(@RequestParam(name = "id") Integer id) {
return classesService.findById(id);
}
/**
* 插入班级信息
*
* @param classes
* @return
*/
@RequestMapping(value = "/insert.do", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public String insert(@RequestBody Classes classes) {
try {
classesService.insert(classes);
} catch (Exception e) {
return "新增失败!";
}
return "200";
}
/**
* 修改班级信息
*
* @param classes
* @return
*/
@RequestMapping(value = "/update.do", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public String update(@RequestBody Classes classes) {
try {
classesService.update(classes);
} catch (Exception e) {
return "修改失败!";
}
return "200";
}
}
器械管理控制器
@Controller
@RequestMapping("/equipment")
public class EquipmentController {
@Autowired
private EquipmentService equipmentService;
@Autowired
private BorrowService borrowService;
/**
* 查询所有运动器材信息
*
* @return
*/
@RequestMapping("/findAll.do")
public ModelAndView findAll() {
ModelAndView mv = new ModelAndView();
List<Equipment> equipmentList = equipmentService.findAll();
mv.addObject("equipment", equipmentList);
mv.setViewName("equipment-list");
return mv;
}
/**
* 器材借还记录
*
* @param eId
* @return
*/
@RequestMapping("/findDetailsByeId.do")
public ModelAndView findDetailsByeId(Integer eId) {
ModelAndView mv = new ModelAndView();
List<Borrow> borrowList = borrowService.selectByeId(eId);
mv.addObject("borrow", borrowList);
mv.setViewName("equipment-details");
return mv;
}
/**
* 器材管理
*
* @return
*/
@RequestMapping("/manage.do")
public ModelAndView manage() {
ModelAndView mv = new ModelAndView();
List<Equipment> equipmentList = equipmentService.findAll();
mv.addObject("equipment", equipmentList);
mv.setViewName("equipment-manage");
return mv;
}
/**
* 器材购入
*
* @param equipment
* @return
*/
@RequestMapping(value = "/insert.do", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public String insert(@RequestBody Equipment equipment) {
try {
equipmentService.insert(equipment);
} catch (Exception e) {
return "新增失败!";
}
return "200";
}
/**
* 器材信息修改
*
* @param equipment
* @return
*/
@RequestMapping(value = "/update.do", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public String update(@RequestBody Equipment equipment) {
System.out.println(equipment);
try {
equipmentService.update(equipment);
} catch (Exception e) {
return "修改失败!";
}
return "200";
}
/**
* 遍历器材列表
*
* @param id
* @return
*/
@RequestMapping(value = "/findById.do", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
@ResponseBody
public Equipment findById(@RequestParam(name = "id") Integer id) {
return equipmentService.findById(id);
}
/**
* 删除器材
*
* @param id
* @return
*/
@RequestMapping("/deleteById.do")
public String deleteByIds(Integer[] id) {
equipmentService.deleteById(id);
return "redirect:manage.do";
}
}
赛事管理控制器
@Controller
@RequestMapping("/matches")
public class MatchesController {
@Autowired
private MatchesService matchesService;
@Autowired
private EventService eventService;
/**
* 查询所有赛事成绩信息
*
* @return
*/
@RequestMapping("/findAll.do")
public ModelAndView findAll() {
ModelAndView mv = new ModelAndView();
List<Matches> matchesList = matchesService.findAll();
mv.addObject("matches", matchesList);
mv.setViewName("matches-list");
return mv;
}
/**
* 查询赛事成绩详细信息
*
* @param mId
* @return
*/
@RequestMapping("/findDetailsBymId.do")
public ModelAndView findDetailsBysId(Integer mId) {
ModelAndView mv = new ModelAndView();
Map<String, Object> map = matchesService.findDetailsBymId(mId);
Matches matches = (Matches) map.get("matches");
mv.addObject("matches", matches);
mv.setViewName("matches-details");
return mv;
}
/**
* 学生的参赛列表
*
* @param uId
* @return
*/
@RequestMapping("/myParticipate.do")
public ModelAndView myParticipate(String uId) {
ModelAndView mv = new ModelAndView();
List<Matches> matchesList = matchesService.selectMyParticipate(uId);
mv.addObject("matches", matchesList);
mv.setViewName("user-participate");
return mv;
}
@RequestMapping("/concle.do")
public void concle(Integer id){
matchesService.concle(id);
}
/**
* 成绩管理页面
*
* @return
*/
@RequestMapping("/manage.do")
public ModelAndView manage() {
ModelAndView mv = new ModelAndView();
List<Matches> matchesList = matchesService.findAll();
mv.addObject("matches", matchesList);
mv.setViewName("matches-manage");
return mv;
}
/**
* 成绩信息插入
*
* @param matches
* @return
*/
@RequestMapping(value = "/insert.do", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public String insert(@RequestBody Matches matches) {
try {
matchesService.insert(matches);
} catch (Exception e) {
return "新增失败!";
}
return "200";
}
/**
* 成绩信息修改
*
* @param matches
* @return
*/
@RequestMapping(value = "/update.do", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public String update(@RequestBody Matches matches) {
try {
matchesService.update(matches);
} catch (Exception e) {
return "修改失败!";
}
return "200";
}
/**
* 根据id过去成绩信息到模态框
*
* @param id
* @return
*/
@RequestMapping(value = "/findById.do", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
@ResponseBody
public Matches findById(@RequestParam(name = "id") Integer id) {
return matchesService.findById(id);
}
/**
* 删除成绩信息
*
* @param id
* @return
*/
@RequestMapping("/deleteById.do")
public String deleteByIds(Integer[] id) {
matchesService.deleteById(id);
return "redirect:manage.do";
}
/**
* 成绩录入
*
* @return
*/
@RequestMapping("/input.do")
public ModelAndView input() {
ModelAndView mv = new ModelAndView();
List<Event> eventList = eventService.findNoScore();
mv.addObject("event", eventList);
mv.setViewName("matches-input");
return mv;
}
/**
* 修改成绩
*
* @param matches
* @return
*/
@RequestMapping(value = "/updateScore.do", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@ResponseBody
public String updateScore(@RequestBody Matches matches) {
try {
matchesService.updateScore(matches);
} catch (Exception e) {
return "录入失败!";
}
return "200";
}
}
如果也想学习本系统,下面领取。关注并回复:033ssh