博主主页:猫头鹰源码
博主简介:Java领域优质创作者、博客专家、公司架构师、全网粉丝5万+、专注Java技术领域和毕业设计项目实战
主要内容:毕业设计(Javaweb项目|小程序等)、简历模板、学习资料、面试题库、技术咨询
文末联系获取
项目介绍:
该系统基于ssm整合开发,数据层为MyBatis,mysql数据库,具有完整的业务逻辑,适合选题:学生、学生成绩、成绩管理等。
项目功能:
系统分为两个角色:管理员,学生。
管理员:
注册登录
个人信息管理
学生管理:增加、修改、删除学生信息,条件查询
课程管理:增加、修改、删除学生信息,条件查询
成绩管理:增加、修改、删除学生信息,条件查询
统计管理:课程平均分统计、不及格学生统计
公告管理:增加、修改、删除学生信息,条件查询
管理员管理:增加、修改、删除学生信息,条件查询
学生:
注册登录
个人信息管理
课程管理:查看课程
成绩管理:查看个人课程
公告管理:查看公告
系统包含技术:
技术:Spring,SpringMVC,Mybatis,前端框架H-ui
开发工具:idea
数据库:mysql 5.7
JDK版本:jdk1.8
服务器:tomcat8
部分截图说明:
下面是首页,可以进行登录注册
管理员的首页
管理员对学生进行维护
管理员对课程进行管理
管理员对成绩进行管理
管理员对课程统计
管理员查看不及格学生统计
更新信息
学生查看成绩
部分代码截图:
拦截器
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
boolean flag = true;
if (request.getSession().getAttribute("username") == null) {
flag = false;
throw new MtyException("请退出后重新登录!");
}
return flag;
}
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
}
@Override
public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception {
}
课程操作
/*
* @description: 跳转到首页
* @author: mty
*/
@RequestMapping("/courseIndex")
public String courseIndex(HttpServletRequest request,Model model) throws Exception{
List<Course> courseList = courseService.queryByAll();
int total = courseList.size();
HttpSession session = request.getSession();
String type = session.getAttribute("type").toString();
model.addAttribute("courseList", courseList);
model.addAttribute("total", total);
model.addAttribute("type", type);
return "course/CourseIndex";
}
/*
* @description:进入修改
* @author: mty
*/
@RequestMapping("/courseEdit/{id}")
public ModelAndView courseEdit(@PathVariable("id") String id,Model model) throws Exception{
ModelAndView mv = new ModelAndView();
Course course = courseService.queryById(id);
model.addAttribute("course", course);
mv.setViewName("course/CourseEdit");
return mv;
}
/*
* @description:修改
* @author: mty
*/
@RequestMapping("/courseEditSubmit")
public String courseEditSubmit(Course course,Model model,HttpServletRequest request) throws Exception{
try{
List<Course> courseList = courseService.queryByAll();
for(int i = 0;i<courseList.size();i++){
if(course.getCno().equals(courseList.get(i).getCno())){
request.setAttribute("msg", "课程代号重复,请重试!");
return "course/CourseAdd";
}
}
courseService.update(course);
request.setAttribute("msg", "修改成功!");
return "course/CourseEdit";
}catch (Exception e){
request.setAttribute("msg", "修改失败!");
return "course/CourseEdit";
}
}
/*
* @description:进入添加
* @author: mty
*/
@RequestMapping("/courseAdd")
public String courseAdd(Model model,HttpServletRequest request) throws Exception{
return "course/CourseAdd";
}
/*
* @description:增加
* @author: mty
*/
@RequestMapping("/courseAddSub")
public String courseAddSub(Course course,Model model,HttpServletRequest request) throws Exception{
try{
List<Course> courseList = courseService.queryByAll();
for(int i = 0;i<courseList.size();i++){
if(course.getCno().equals(courseList.get(i).getCno())){
request.setAttribute("msg", "课程代号重复,请重试!");
return "course/CourseAdd";
}
}
courseService.add(course);
request.setAttribute("msg", "添加成功!");
return "course/CourseAdd";
}catch (Exception e){
request.setAttribute("msg", "添加失败!");
return "course/CourseAdd";
}
}
/*
* @description:根据ID删除
* @author: mty
*/
@RequestMapping("/courseDel/{id}")
public ModelAndView courseDel(@PathVariable("id") String id,HttpServletRequest reuqest, Model model) throws Exception{
ModelAndView mv = new ModelAndView();
courseService.deleteById(id);
mv.setViewName("course/CourseIndex");
return mv;
}
登录操作
/*
* @description:登录校验
* @author: mty
*/
@RequestMapping("/userSubmit/{username}/{password}/{type}")
@ResponseBody
public String studentSubmit(@PathVariable("username") String username,@PathVariable("password") String password,@PathVariable("type") String type,HttpServletRequest request) throws Exception{
HttpSession session = request.getSession();
ModelAndView modelAndView = new ModelAndView();
if("01".equals(type)){
List<User> list = userService.queryByOne(username,password);
if(list.size()==0) {
request.setAttribute("msg", "对不起,用户不存在,请重试!");
return "201";
}else {
if(list.size()!=1){
request.setAttribute("msg", "数据库错误,请重试!");
return "202";
}else{
User user = list.get(0);
session.setAttribute("username", user.getUsername());
session.setAttribute("type", "01");
session.setAttribute("id", user.getId());
return "index1";
}
}
}else{
List<Admin> list = adminService.queryByOne(username,password);
if(list.size()==0) {
request.setAttribute("msg", "对不起,用户不存在,请重试!");
return "201";
}else {
if(list.size()!=1){
request.setAttribute("msg", "数据库错误,请重试!");
return "202";
}else{
Admin admin = list.get(0);
session.setAttribute("username", admin.getUsername());
session.setAttribute("type", "02");
session.setAttribute("id", admin.getId());
modelAndView.setViewName("index2");
return "index2";
}
}
}
}
以上就是部分功能展示,从整体上来看,本系统功能是十分完整的,界面设计简洁大方,交互友好,数据库设计也很合理,规模适中,代码工整,清晰,适合学习使用。
好了,今天就到这儿吧,小伙伴们点赞、收藏、评论,一键三连走起呀,下期见~~