项目介绍
该高校运动会信息管理系统是以B/S架构为设计基础并基于SSM框架开发的系统。系统采用了Java语言和MySQL数据库来实现。
系统按预定的算法完成了创办运动会、广播公告公示、赛事项目拟订、报名参赛、赛后成绩录入、查看比赛成绩、院系人员的信息存储、反馈建议、访问日记等功能。
主要功能:
1.完成校运动会项目管理。具体包括项目的新增、修改、查询等功能。项目信息包括项目编号、项目名称、项目类别(男、女)、项目性质(团体、个人)等
2.完成运动员信息的管理。具体包括运动员信息的新增、修改、查询、删除等功能。运动员信息包括运动员编号、姓名、所在班级、性别等;
3.报名管理。完成运动员选择参赛项目的过程。
本项目分为管理员、教师、学生三种角色;
环境需要
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. 后端:Spring SpringMVC Mybatis
2. 前端:JSP CSS JavaScript jQuery
使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中dbconfig.properties配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入http://localhost:8080/ 登录
运动项目管理控制层:
@Controllerpublic class SportsController { @Autowired private SportsService sportsService; @Autowired private RefereeService refereeService; @Autowired private StudentService studentService; //分页显示运动项目 @RequestMapping("/admin/getSports/{pn}") public String getStuWithJson(@PathVariable(value = "pn") Integer pn,Model model){ PageHelper.startPage(pn,5); //startPage后面紧跟的这个查询就是一个分页查询 List<Sports> sports=sportsService.querySports(); List sportsName = sportsService.querySportsName(); model.addAttribute("sports",sports); model.addAttribute("sportsName",sportsName); PageInfo page=new PageInfo(sports,5); //System.out.println(page); model.addAttribute("pageInfo",page); model.addAttribute("sign","getSports"); return "admin/sports-list"; } String sportsName; String sportsType; //分页显示运动项目----带条件 @RequestMapping("/admin/querySportsWithCondition/{pn}") public String querySportsWithCondition(@RequestParam(value = "sportsName",required = false)String sportsName, @RequestParam(value = "sportsType",required = false)String sportsType, @PathVariable(value = "pn") Integer pn, Model model){ if(sportsName!=null||sportsType!=null) { this.sportsName = sportsName; this.sportsType = sportsType; }// System.out.println(this.id "-->" this.gender "-->" this.school); List sportsName1 = sportsService.querySportsName(); model.addAttribute("sportsName",sportsName1); model.addAttribute("sports",this.sportsName); model.addAttribute("sportsType",this.sportsType); PageHelper.startPage(pn,5); List<Sports> sports=sportsService.querySportsWithCondition(this.sportsName,this.sportsType); PageInfo page=new PageInfo(sports,5); model.addAttribute("pageInfo",page); model.addAttribute("sign","querySportsWithCondition"); return "admin/sports-list"; } //去添加运动项目页面,展示裁判姓名 @RequestMapping("/admin/toAddSports") public String toAdd(Model model) { List referee = refereeService.queryReferee(); model.addAttribute("referee",referee); return "admin/sports-add"; } //添加运动项目 @RequestMapping("/admin/addSports") @ResponseBody public Msg addStu(Sports sports) { //System.out.println(sports); sportsService.addSports(sports); return Msg.success(); } //去运动项目修改页面 @RequestMapping("/admin/toUpdSports/{sportsId}") public String toUpdSports(@PathVariable("sportsId")Integer sportsId , Model model) { Sports sports = sportsService.querySportsById(sportsId); model.addAttribute("sports",sports); List referee = refereeService.queryReferee(); model.addAttribute("referee",referee); return "admin/sports-update"; } //修改运动项目 @RequestMapping("/admin/updSports") @ResponseBody public Msg updSports(Sports sports, Model model) { //System.out.println(sports); sportsService.updSports(sports); return Msg.success().add("msg","修改成功!"); } //删除运动项目 @RequestMapping(value = "/admin/toDelSports/{sportsId}",method = RequestMethod.DELETE) @ResponseBody public Msg toDelSports(@PathVariable("sportsId") String sportsId){ int sportsId2=Integer.parseInt(sportsId); sportsService.delSportsById(sportsId2); return Msg.success().add("msg","删除成功!"); }// 根据类型查询运动项目// @RequestMapping(value = "/admin/querySportsByType",method = RequestMethod.GET)// @ResponseBody// public Msg querySportsByType(@RequestParam("sportsType") String sportsType,// Model model) {// List list = sportsService.querySportsByType(sportsType);// System.out.println(list);// model.addAttribute("sports",list);// return Msg.success().add("sports",list);// } //分页显示报名信息 @RequestMapping("/admin/toEntryForm/{pn}") public String toEntryForm(@PathVariable(value = "pn") Integer pn,Model model){ PageHelper.startPage(pn,5); List list = sportsService.entryForm(); List sportsName = sportsService.querySportsName(); //System.out.println(list); model.addAttribute("list",list); model.addAttribute("sportsName",sportsName); PageInfo page=new PageInfo(list,5); //System.out.println(page); model.addAttribute("pageInfo",page); model.addAttribute("sign","getSports"); return "admin/entry-form"; } //分页显示报名信息----带条件 @RequestMapping("/admin/toEntryFormWithCondition/{pn}") public String toEntryFormWithCondition(@RequestParam(value = "sportsName",required = false)String sportsName, @RequestParam(value = "sportsType",required = false)String sportsType, @PathVariable(value = "pn") Integer pn, Model model){ if(sportsName!=null||sportsType!=null) { this.sportsName = sportsName; this.sportsType = sportsType; } List sportsName1 = sportsService.querySportsName(); model.addAttribute("sportsName",sportsName1); model.addAttribute("sports",this.sportsName); model.addAttribute("sportsType",this.sportsType); PageHelper.startPage(pn,5); List<EntryForm> entryForm=sportsService.entryFormWithCondition(this.sportsName,this.sportsType); PageInfo page=new PageInfo(entryForm,5); model.addAttribute("pageInfo",page); model.addAttribute("sign","querySportsWithCondition"); return "admin/entry-form"; } //去录入成绩页面 @RequestMapping("/admin/toAddGrade/{idAndsportsId}") public String toAddGrade(@PathVariable("idAndsportsId")String idAndsportsId, Model model) { //System.out.println(idAndsportsId); String[] split = idAndsportsId.split("-"); int stuId=Integer.parseInt(split[0]); int sportsId=Integer.parseInt(split[1]); String sportsType=split[2]; model.addAttribute("stuId",stuId); model.addAttribute("sportsIdScore",sportsId); model.addAttribute("sportsType",sportsType);// List list = sportsService.querySports();// model.addAttribute("sports",list); return "admin/grade-add"; } //添加成绩 @RequestMapping("/admin/addGrade") @ResponseBody public Msg addGrade(SportsScore sportsScore){ //System.out.println(sportsScore); SportsScore stuScore = sportsService.queryStuScore(sportsScore.getStuId(), sportsScore.getSportsIdScore()); if(stuScore==null) {//没有成绩,可以录入 sportsService.addGrade(sportsScore); return Msg.success().add("msg", "录入成功!"); }else{ return Msg.fail().add("msg","该学生已存在成绩,请不要重复录入!"); } }}
学生管理控制层:
@Controllerpublic class StudentController { @Autowired private StudentService studentService; // @RequestMapping("/admin/getStu") public String getStu(Model model){ Collection<Student> list = studentService.queryStu(); model.addAttribute("students",list); return "admin/student-list"; } //分页显示学生 @RequestMapping("/admin/getStu/{pn}") public String getStuWithJson(@PathVariable(value = "pn") Integer pn,Model model){ //这不是分页查询 //引入PageHelper分页插件 //在查询之前只需要调用,传入页码,以及每页的大小 PageHelper.startPage(pn,5); //startPage后面紧跟的这个查询就是一个分页查询 List<Student> students=studentService.queryStu(); List schooltype = studentService.querySchool();// System.out.println(school); model.addAttribute("schooltype",schooltype); //使用PageInfo包装查询后的结果,只需要将page交给页面就行了 //封装了详细的分页信息,包括我们查询出来的数据,传入连续显示的页数 PageInfo page=new PageInfo(students,5); //System.out.println(page); model.addAttribute("pageInfo",page); model.addAttribute("sign","getStu"); return "admin/student-list"; } Integer id; String gender; String school; //分页显示学生----带条件 @RequestMapping("/admin/queryStuWithCondition/{pn}") public String queryStuWithCondition(@RequestParam(value = "school",required = false)String school, @RequestParam(value = "gender",required = false)String gender, @RequestParam(value = "id",required = false)Integer id, @PathVariable(value = "pn") Integer pn, Model model){ //System.out.println(id "-->" gender "-->" school); if(id!=null||gender!=null||school!=null) { this.id = id; this.gender = gender; this.school = school; }// System.out.println(this.id "-->" this.gender "-->" this.school); List schooltype = studentService.querySchool();// System.out.println(school); model.addAttribute("schooltype",schooltype); model.addAttribute("id",this.id); model.addAttribute("school",this.school); model.addAttribute("gender",this.gender); if(this.id==null){ PageHelper.startPage(pn,5); List<Student> students=studentService.queryStuWithCondition(this.gender,this.school); PageInfo page=new PageInfo(students,5); model.addAttribute("pageInfo",page); model.addAttribute("sign","getStuWithCondition"); return "admin/student-list"; } else { PageHelper.startPage(pn,5); List<Student> students=studentService.queryStuWithCondition2(this.id,this.gender,this.school); PageInfo page=new PageInfo(students,5); model.addAttribute("pageInfo",page); model.addAttribute("sign","getStuWithCondition"); return "admin/student-list"; } } //去添加学生页面 @RequestMapping("/admin/toAdd") public String toAdd(){ return "admin/student-add"; } @PostMapping("/admin/addStu") public String addStu(Student student) { // System.out.println(student); studentService.addStu(student); return "redirect:admin/getStu/100"; } //去修改学生页面 @RequestMapping("/admin/toUpd/{stuId}") public String toUpd(@PathVariable("stuId")String stuId,Model model){ int id=Integer.parseInt(stuId); Student student = studentService.queryStuById(id); model.addAttribute("student",student); return "admin/student-update"; } //修改学生信息 @RequestMapping("/admin/updStu") @ResponseBody public Msg updStu(Student student){ // System.out.println(student); studentService.updStu(student); return Msg.success(); } @RequestMapping(value = "/admin/delStuById/{stuId}",method = RequestMethod.DELETE) public String delStuById(@PathVariable("stuId") String stuId){ int id=Integer.parseInt(stuId); studentService.delStuById(id); return "redirect:admin/getStu/1"; }}
成绩管理控制层:
@Controllerpublic class GradeController { @Autowired GradeService gradeService; @Autowired SportsService sportsService; @Autowired StudentService studentService; //去显示成绩页面 @RequestMapping("/admin/toGetScore") public String toGetScore(Model model){ //将项目名称返回 List list = sportsService.querySports(); model.addAttribute("list",list); //一加载页面默认查出一个项目的成绩 List scoreDefault = gradeService.selectWithStuAndSportsDefault(); //System.out.println(scoreDefault); model.addAttribute("scoreDefault",scoreDefault); return "admin/scorelist-byOne"; } //显示单项目成绩 @RequestMapping("/admin/getScoreBySportsName") public String getScoreBySportsName(@RequestParam("sportsId") Integer sportsId,Model model ){ //将项目名称返回 List list = sportsService.querySports(); model.addAttribute("list",list); //将sportsId返回 model.addAttribute("sportsId",sportsId); //System.out.println(sportsId); List scoreList = gradeService.selectWithStuAndSports(sportsId); model.addAttribute("scoreDefault",scoreList); return "admin/scorelist-byOne"; } //去修改成绩页面 @RequestMapping("/admin/toUpdGrade/{idAndsportsId}") public String toUpdGrade(@PathVariable("idAndsportsId") String idAndsportsId,Model model){ //System.out.println(idAndsportsId); String[] split = idAndsportsId.split("-"); int stuId=Integer.parseInt(split[0]); int sportsId=Integer.parseInt(split[1]); //System.out.println(stuId ",,>" sportsId); SportsScore sportsScore = sportsService.queryStuScore(stuId, sportsId); //System.out.println(sportsScore); model.addAttribute("sportsScore",sportsScore); return "admin/grade-upd"; } //修改成绩 @RequestMapping("/admin/updScore") @ResponseBody public Msg updScore(SportsScore sportsScore,Model model){ //System.out.println(sportsScore); gradeService.updScore(sportsScore); return Msg.success().add("msg","修改成功"); } //查询总项目情况 @RequestMapping("/admin/toGetScoreAll/{pn}") public String toGetScoreAll(@PathVariable(value = "pn") Integer pn,Model model){ List schoolName = studentService.querySchool(); model.addAttribute("schoolName",schoolName); PageHelper.startPage(pn,5); List scoreAll = gradeService.getScoreAll(); PageInfo page=new PageInfo(scoreAll,5); model.addAttribute("pageInfo",page); model.addAttribute("sign","toGetScoreAll"); model.addAttribute("signTable","toGetScoreAll"); //System.out.println(page); return "admin/score-all"; } String gender; String school; //查询总项目情况--带条件 @RequestMapping("/admin/getScoreAllWithCondition/{pn}") public String getScoreAllWithCondition(@RequestParam(value = "school",required = false)String school, @RequestParam(value = "gender",required = false)String gender, @PathVariable(value = "pn") Integer pn, Model model){ if(school!=null||gender!=null) { this.school = school; this.gender = gender; }// System.out.println(this.id "-->" this.gender "-->" this.school); List schoolName = studentService.querySchool(); model.addAttribute("schoolName",schoolName); model.addAttribute("school",this.school); model.addAttribute("gender",this.gender); PageHelper.startPage(pn,5); List scoreAllWithCondition = gradeService.getScoreAllWithCondition(this.school, this.gender); PageInfo page=new PageInfo(scoreAllWithCondition,5); model.addAttribute("pageInfo",page); model.addAttribute("sign","scoreAllWithCondition"); model.addAttribute("signTable","toGetScoreAll"); return "admin/score-all"; } //查询学校总分情况 String sportsType; @RequestMapping("/admin/scoreAll/{pn}") public String scoreAll(@RequestParam(value = "sportsType",required = false)String sportsType, @PathVariable(value = "pn") Integer pn, Model model){ //System.out.println(this.sportsType); if(sportsType!=null) this.sportsType=sportsType; List schoolName = studentService.querySchool(); model.addAttribute("schoolName",schoolName); if(this.sportsType==""||this.sportsType==null){ PageHelper.startPage(pn,5); List scoreBySchoolAll = gradeService.getScoreBySchoolAll(); PageInfo page=new PageInfo(scoreBySchoolAll,5); //System.out.println(page); model.addAttribute("pageInfo",page); model.addAttribute("sign","scoreAll"); model.addAttribute("signTable","scoreAll"); return "admin/score-all"; } else { model.addAttribute("sportsType",this.sportsType); PageHelper.startPage(pn,5); List scoreBySchoolTypeAll = gradeService.getScoreBySchoolTypeAll(this.sportsType); PageInfo page=new PageInfo(scoreBySchoolTypeAll,5); //System.out.println(page); model.addAttribute("pageInfo",page); model.addAttribute("sign","scoreAll");//分页 model.addAttribute("signTable","scoreAllBySportsType");//表格 return "admin/score-all"; } }}
原文链接:blog.csdn.net/m0_66863468/article/details/125198553?utm_source=tuicool&utm_medium=referral
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。