基于javaweb的学生学籍管理系统(java+ssm+layui+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+SSM的学生学籍管理系统(java+SSM+layui+maven+mysql)
项目介绍
SSM项目-学生学籍管理系统。该项目分管理员、老师、学生三种用户角色。每种角色分别对应不同的菜单;
以下分别介绍各个角色对应的功能模块:
管理员角色:
- 用户登录和退出 - 权限控制 - 系统管理 - 专业管理 - 班级管理 - 学生管理 - 老师管理 - 课程管理 - 开课管理 - 用户管理
老师角色:
- 老师管理 - 成绩管理 - 学生查询
学生角色:
- 学生管理 - 选课管理 - 成绩查询
技术路线
- 开发工具:IDEA 2020.1 - 技术框架:Spring、SpringMVC、MyBatis - Web容器:Tomcat 8.5.7 - 数据库:MySQL 5.7 - 前端UI框架:LayUI - 项目管理:Maven 3.6.3
使用说明
- 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,下载所需jar包; 2. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 3. 将项目中application.yml配置文件中的数据库配置改为自己的配置 4. 配置tomcat,然后运行项目,输入localhost:8080 登录
用户管理控制层:
@RequestMapping(“/user”)
@RestController //标识为返回类型为Json的控制器
public class UserController {
//自动注入服务类
@Autowired
private IUserService userService;
@Autowired
private TStudentService studentService;
//标识请求地址
@RequestMapping(“/login”)
public ResultObject<List> getUsers(User user,HttpServletRequest request) {
//查询用户列表
List list= userService.getUser(user);
ResultObject<List> rs=new ResultObject<List>();
if(list.isEmpty()) {
//状态码
rs.setCode(Constant.FAILURE_RETUEN_CODE);
//提示
rs.setMsg(“登录失败”);
}else {
//状态码
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
request.getSession().setAttribute(“user”, list.get(0));
//提示
rs.setMsg(“登录成功”);
//数据
rs.setData(list);
return rs;
@RequestMapping(“/loginOut”)
public ResultObject loginOut(HttpServletRequest request) {
//查询用户列表
ResultObject rs=new ResultObject();
request.getSession().removeAttribute(“user”);
//数据
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg(“退出成功”);
return rs;
//标识请求地址
@RequestMapping(“/studentLogin”)
public ResultObject<List> studentLogin(User user,HttpServletRequest request) {
//查询用户列表
TStudent student=new TStudent();
student.setStudentNo(Integer.parseInt(user.getUserName()));
student.setStuPass(user.getPassword());
List list= studentService.selectloginStudent(student);
ResultObject<List> rs=new ResultObject<List>();
if(list.isEmpty()) {
//状态码
rs.setCode(Constant.FAILURE_RETUEN_CODE);
//提示
rs.setMsg(“登录失败”);
}else {
//状态码
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
request.getSession().setAttribute(“student”, list.get(0));
//提示
rs.setMsg(“登录成功”);
//数据
rs.setData(list);
return rs;
@RequestMapping(“/studentloginOut”)
public ResultObject studentloginOut(HttpServletRequest request) {
//查询用户列表
ResultObject rs=new ResultObject();
request.getSession().removeAttribute(“student”);
//数据
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg(“退出成功”);
return rs;
学生管理控制层:
@RequestMapping(“/student”)
@RestController //标识为返回类型为Json的控制
public class StudentController {
@Autowired
private TStudentService studentService;
//标识请求地址
@RequestMapping(“/getAllStudent”)
public ResultObject<List> getUsers(TStudent student,@RequestParam(“limit”) int limit,@RequestParam(“page”) int page) {
PageInfo pageInfo=studentService.getAll(student, page, limit);
ResultObject<List> rs=new ResultObject<List>();
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg(“查询成功”);
rs.setData(pageInfo.getList());
rs.setCount(pageInfo.getTotal());
return rs;
//标识请求地址
@RequestMapping(“/addStudent”)
public ResultObject addStudent(TStudent student) {
Integer studentNo=student.getStudentNo();
student.setStuPass(studentNo.toString());
TStudent result=studentService.selectByNo(studentNo);
//统一返回
ResultObject rs=new ResultObject();
if(null==result) {
studentService.addStudent(student);
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg(“增加学生信息成功”);
}else {
rs.setCode(Constant.HASE_RETUEN_CODE);
rs.setMsg(“学号已存在”);
return rs;
//标识请求地址
@RequestMapping(“/updateStudent”)
public ResultObject updateStudent(TStudent student) {
Integer total=studentService.updateStudent(student);
//统一返回
ResultObject rs=new ResultObject();
if(nulltotal||0total) {
rs.setCode(Constant.FAILURE_RETUEN_CODE);
rs.setMsg(“修改学生信息失败”);
}else {
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg(“修改学生信息成功”);
return rs;
//标识请求地址
@RequestMapping(“/deleteStudent”)
public ResultObject deleteStudent(@RequestParam(“studentNo”) int studentNo) {
Integer total=studentService.deleteStudent(studentNo);
//统一返回
ResultObject rs=new ResultObject();
if(nulltotal||0total) {
rs.setCode(Constant.FAILURE_RETUEN_CODE);
rs.setMsg(“修改学生信息失败”);
}else {
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg(“修改学生信息成功”);
return rs;
/**
• 获取学生下拉框
• @return
*/
@RequestMapping(“/studentSelect”)
public ResultObject<List> studentSelect() {
ResultObject<List> rs=new ResultObject<List>();
List list=studentService.selectAllStudent();
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg(“查询成功”);
rs.setData(list);
int total=list.size();
Long a=Long.parseLong(String.valueOf(total));
rs.setCount(a);
return rs;
成绩管理控制层:
@RequestMapping(“/score”)
@RestController //标识为返回类型为Json的控制
public class ScoreController {
/**
• 注入成绩
*/
@Autowired
private IScoreService scoreService;
//标识请求地址
@RequestMapping(“/addScore”)
public ResultObject addScore(TScore score) {
ResultObject rs=scoreService.insertScore(score);
return rs;
//标识请求地址
@RequestMapping(“/getAllScore”)
public ResultObject<List> getAllScore(TScore score,@RequestParam(“limit”) int limit,@RequestParam(“page”) int page) {
PageInfo pageInfo=scoreService.getAllScore(score,limit, page);
ResultObject<List> rs=new ResultObject<List>();
List list=pageInfo.getList();
for(TScore temp:list) {
String type=temp.getScoreType();
if(“1”.equals(type)) {
temp.setScoreTypeName(“习题”);
if(“2”.equals(type)) {
temp.setScoreTypeName(“测验”);
if(“3”.equals(type)) {
temp.setScoreTypeName(“考试成绩”);
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg(“查询成功”);
rs.setData(list);
rs.setCount(pageInfo.getTotal());
return rs;
//标识请求地址
@RequestMapping(“/updateScore”)
public ResultObject updateScore(TScore score) {
Integer total=scoreService.updateScore(score);
//统一返回
ResultObject rs=new ResultObject();
if(nulltotal||0total) {
rs.setCode(Constant.FAILURE_RETUEN_CODE);
rs.setMsg(“修改学生成绩信息失败”);
}else {
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg(“修改学生成绩信息成功”);
return rs;
//标识请求地址
@RequestMapping(“/deleteScore”)
public ResultObject deleteScore(TScore score) {
Integer total=scoreService.deleteScore(score.getScoreId());
//统一返回
ResultObject rs=new ResultObject();
if(nulltotal||0total) {
rs.setCode(Constant.FAILURE_RETUEN_CODE);
rs.setMsg(“删除学生成绩信息失败”);
}else {
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg(“删除学生成绩信息成功”);
return rs;
@RequestMapping(“/getAllSumScore”)
public ResultObject<List> getAllSumScore(TStudent student,@RequestParam(“limit”) int limit,@RequestParam(“page”) int page) {
PageInfo pageInfo =scoreService.getAllFinalScore(student, limit, page);
ResultObject<List> rs=new ResultObject<List>();
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg(“查询成功”);
rs.setData(pageInfo.getList());
rs.setCount(pageInfo.getTotal());
return rs;
//获取我的成绩
@RequestMapping(“/getMyScore”)
public ResultObject<List> getAllSumScore(HttpServletRequest request,@RequestParam(“limit”) int limit,@RequestParam(“page”) int page) {
TStudent student = (TStudent)request.getSession().getAttribute(“student”);
PageInfo pageInfo =scoreService.getAllFinalScore(student, limit, page);
ResultObject<List> rs=new ResultObject<List>();
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg(“查询成功”);
rs.setData(pageInfo.getList());
rs.setCount(pageInfo.getTotal());
return rs;
@RequestMapping(“/getMyScoreInfo”)
public ResultObject<List> getMyScoreInfo(HttpServletRequest request,@RequestParam(“limit”) int limit,@RequestParam(“page”) int page) {
TStudent student = (TStudent)request.getSession().getAttribute(“student”);
TScore score=new TScore();
score.setStudentId(student.getStudentNo());
PageInfo pageInfo=scoreService.getAllScore(score,limit, page);
ResultObject<List> rs=new ResultObject<List>();
List list=pageInfo.getList();
for(TScore temp:list) {
String type=temp.getScoreType();
if(“1”.equals(type)) {
temp.setScoreTypeName(“习题”);
if(“2”.equals(type)) {
temp.setScoreTypeName(“测验”);
if(“3”.equals(type)) {
temp.setScoreTypeName(“考试成绩”);
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg(“查询成功”);
rs.setData(list);
rs.setCount(pageInfo.getTotal());
return rs;