作者主页:源码空间站2022
简介: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 8.0版本;
6.是否Maven项目:是;
技术栈
1. 后端:SpringBoot
2. 前端:Thymeleaf+HTML+CSS+jQuery
使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入localhost:8080/ 登录
管理员账号/密码:10001/123456
学生账号/密码:1001/123456
运行截图
代码相关
成绩管理控制器
@Controller
public 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";
}
}
}
运动管理控制器
@Controller
public 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","该学生已存在成绩,请不要重复录入!");
}
}
}
如果也想学习本系统,下面领取。回复:075springboot