项目介绍
本项目分为管理员、教师、学生三种角色,
管理员角色包含以下功能:
公告管理,写公告,学生增删改查,教师增删改查,查看成绩报表,管理员首页,课程表增删改查等功能。
教师角色包含以下功能:
修改密码,按照条件查询,查看学生信息,管理课程,登陆页面等功能。
学生角色包含以下功能:
查看成绩信息,查看课程信息,选课操作等功能。
环境需要
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项目:否;
技术栈
- 后端:Spring+SpringMVC+Mybatis
- 前端:HTML+LayUI
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
- 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; - 将项目中application.yml配置文件中的数据库配置改为自己的配置;
- 运行项目,输入localhost:8080/ 登录
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
}
return rs;
}
//标识请求地址
@RequestMapping("/deleteStudent")
public ResultObject<Object> deleteStudent(@RequestParam("studentNo") int studentNo) {
Integer total=studentService.deleteStudent(studentNo);
//统一返回
ResultObject<Object> rs=new ResultObject<Object>();
if(null==total||0==total) {
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<TStudent>> studentSelect() {
ResultObject<List<TStudent>> rs=new ResultObject<List<TStudent>>();
List<TStudent> list=studentService.selectAllStudent();
ResultObject<Object> rs=new ResultObject<Object>();
request.getSession().removeAttribute("user");
//数据
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg("退出成功");
return rs;
}
//标识请求地址
@RequestMapping("/studentLogin")
public ResultObject<List<TStudent>> studentLogin(User user,HttpServletRequest request) {
//查询用户列表
TStudent student=new TStudent();
student.setStudentNo(Integer.parseInt(user.getUserName()));
student.setStuPass(user.getPassword());
List<TStudent> list= studentService.selectloginStudent(student);
ResultObject<List<TStudent>> rs=new ResultObject<List<TStudent>>();
if(list.isEmpty()) {
//状态码
rs.setCode(Constant.FAILURE_RETUEN_CODE);
//提示
rs.setMsg("登录失败");
}else {
//状态码
@RequestMapping("/getAllSumScore")
public ResultObject<List<TStudent>> getAllSumScore(TStudent student,@RequestParam("limit") int limit,@RequestParam("page") int page) {
PageInfo<TStudent> pageInfo =scoreService.getAllFinalScore(student, limit, page);
ResultObject<List<TStudent>> rs=new ResultObject<List<TStudent>>();
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg("查询成功");
rs.setData(pageInfo.getList());
rs.setCount(pageInfo.getTotal());
return rs;
}
//获取我的成绩
@RequestMapping("/getMyScore")
public ResultObject<List<TStudent>> getAllSumScore(HttpServletRequest request,@RequestParam("limit") int limit,@RequestParam("page") int page) {
TStudent student = (TStudent)request.getSession().getAttribute("student");
PageInfo<TStudent> pageInfo =scoreService.getAllFinalScore(student, limit, page);
ResultObject<List<TStudent>> rs=new ResultObject<List<TStudent>>();
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg("查询成功");
rs.setData(pageInfo.getList());
ResultObject<Object> rs=new ResultObject<Object>();
if(null==total||0==total) {
rs.setCode(Constant.FAILURE_RETUEN_CODE);
rs.setMsg("删除学生成绩信息失败");
}else {
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg("删除学生成绩信息成功");
}
return rs;
}
@RequestMapping("/getAllSumScore")
public ResultObject<List<TStudent>> getAllSumScore(TStudent student,@RequestParam("limit") int limit,@RequestParam("page") int page) {
PageInfo<TStudent> pageInfo =scoreService.getAllFinalScore(student, limit, page);
ResultObject<List<TStudent>> rs=new ResultObject<List<TStudent>>();
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg("查询成功");
rs.setData(pageInfo.getList());
rs.setCount(pageInfo.getTotal());
return rs;
}
//获取我的成绩
@RequestMapping("/getMyScore")
public ResultObject<List<TStudent>> getAllSumScore(TStudent student,@RequestParam("limit") int limit,@RequestParam("page") int page) {
PageInfo<TStudent> pageInfo =scoreService.getAllFinalScore(student, limit, page);
ResultObject<List<TStudent>> rs=new ResultObject<List<TStudent>>();
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg("查询成功");
rs.setData(pageInfo.getList());
rs.setCount(pageInfo.getTotal());
return rs;
}
//获取我的成绩
@RequestMapping("/getMyScore")
public ResultObject<List<TStudent>> getAllSumScore(HttpServletRequest request,@RequestParam("limit") int limit,@RequestParam("page") int page) {
TStudent student = (TStudent)request.getSession().getAttribute("student");
PageInfo<TStudent> pageInfo =scoreService.getAllFinalScore(student, limit, page);
ResultObject<List<TStudent>> rs=new ResultObject<List<TStudent>>();
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg("查询成功");
Long a=Long.parseLong(String.valueOf(total));
rs.setCount(a);
return rs;
}
}
用户管理控制层:
@RequestMapping("/user")
@RestController //标识为返回类型为Json的控制器
public class UserController {
//自动注入服务类
@Autowired
private IUserService userService;
@Autowired
private TStudentService studentService;
//标识请求地址
@RequestMapping("/login")
public ResultObject<List<User>> getUsers(User user,HttpServletRequest request) {
//查询用户列表
List<User> list= userService.getUser(user);
}
//标识请求地址
@RequestMapping("/addStudent")
public ResultObject<Object> addStudent(TStudent student) {
Integer studentNo=student.getStudentNo();
student.setStuPass(studentNo.toString());
TStudent result=studentService.selectByNo(studentNo);
//统一返回
ResultObject<Object> rs=new ResultObject<Object>();
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<Object> updateStudent(TStudent student) {
Integer total=studentService.updateStudent(student);
//统一返回
ResultObject<Object> rs=new ResultObject<Object>();
if(null==total||0==total) {
ResultObject<Object> rs=new ResultObject<Object>();
if(null==total||0==total) {
rs.setCode(Constant.FAILURE_RETUEN_CODE);
rs.setMsg("修改学生成绩信息失败");
}else {
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg("修改学生成绩信息成功");
}
return rs;
}
//标识请求地址
@RequestMapping("/deleteScore")
public ResultObject<Object> deleteScore(TScore score) {
}
return rs;
}
@RequestMapping("/getAllSumScore")
public ResultObject<List<TStudent>> getAllSumScore(TStudent student,@RequestParam("limit") int limit,@RequestParam("page") int page) {
PageInfo<TStudent> pageInfo =scoreService.getAllFinalScore(student, limit, page);
ResultObject<List<TStudent>> rs=new ResultObject<List<TStudent>>();
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg("查询成功");
rs.setData(pageInfo.getList());
rs.setCount(pageInfo.getTotal());
return rs;
}
//获取我的成绩
@RequestMapping("/getMyScore")
public ResultObject<List<TStudent>> getAllSumScore(HttpServletRequest request,@RequestParam("limit") int limit,@RequestParam("page") int page) {
TStudent student = (TStudent)request.getSession().getAttribute("student");
PageInfo<TStudent> pageInfo =scoreService.getAllFinalScore(student, limit, page);
ResultObject<List<TStudent>> rs=new ResultObject<List<TStudent>>();
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
//状态码
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
request.getSession().setAttribute("student", list.get(0));
//提示
rs.setMsg("登录成功");
}
//数据
rs.setData(list);
return rs;
}
@RequestMapping("/studentloginOut")
public ResultObject<Object> studentloginOut(HttpServletRequest request) {
//查询用户列表