音乐介绍网站怎么做小白怎么学室内设计
音乐介绍网站怎么做,小白怎么学室内设计,色块网站设计,广告信息发布平台博主主页#xff1a;Java旅途 简介#xff1a;分享计算机知识、学习路线、系统源码及教程 文末获取源码 一、项目介绍
教务管理系统基于SpringSpringMVCMybatis开发#xff0c;功能和学生成绩管理系统#xff0c;学生选课管理系统类似#xff0c;也可以做学生成绩管理系统… 博主主页Java旅途 简介分享计算机知识、学习路线、系统源码及教程 文末获取源码 一、项目介绍
教务管理系统基于SpringSpringMVCMybatis开发功能和学生成绩管理系统学生选课管理系统类似也可以做学生成绩管理系统学生选课管理系统。系统分为管理员教师学生三种角色。
管理员功能如下
课程管理学生管理教师管理
教师功能如下
我的课程成绩打分
学生功能如下
查看课程选课退课查看成绩
二、技术框架
后端SpringSpringmvcMybatis前端bootstrap
三、安装教程
用idea打开项目在idea中配置jdk环境配置maven环境并下载依赖配置tomcat8.0新建数据库导入数据库文件在mysql.properties文件中将数据库账号密码改成自己本地的启动运行 管理员账号密码 admin/123456教师账号密码 1001/123456学生账号密码 10001/123456
四、项目截图 五、相关代码
LoginController
package com.system.controller;import com.system.po.Userlogin;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;Controller
public class LoginController {//登录跳转RequestMapping(value /login, method {RequestMethod.GET})public String loginUI() throws Exception {return ../../login;}//登录表单处理RequestMapping(value /login, method {RequestMethod.POST})public String login(Userlogin userlogin) throws Exception {//Shiro实现登录UsernamePasswordToken token new UsernamePasswordToken(userlogin.getUsername(),userlogin.getPassword());Subject subject SecurityUtils.getSubject();//如果获取不到用户名就是登录失败但登录失败的话会直接抛出异常subject.login(token);if (subject.hasRole(admin)) {return redirect:/admin/showCourse;} else if (subject.hasRole(teacher)) {return redirect:/teacher/showCourse;} else if (subject.hasRole(student)) {return redirect:/student/showCourse;}return /login;}}
StudentController
package com.system.controller;import com.system.exception.CustomException;
import com.system.po.*;
import com.system.service.CourseService;
import com.system.service.SelectedCourseService;
import com.system.service.StudentService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;import javax.annotation.Resource;
import java.util.List;Controller
RequestMapping(value /student)
public class StudentController {Resource(name courseServiceImpl)private CourseService courseService;Resource(name studentServiceImpl)private StudentService studentService;Resource(name selectedCourseServiceImpl)private SelectedCourseService selectedCourseService;RequestMapping(value /showCourse)public String stuCourseShow(Model model, Integer page) throws Exception {ListCourseCustom list null;//页码对象PagingVO pagingVO new PagingVO();//设置总页数pagingVO.setTotalCount(courseService.getCountCouse());if (page null || page 0) {pagingVO.setToPageNo(1);list courseService.findByPaging(1);} else {pagingVO.setToPageNo(page);list courseService.findByPaging(page);}model.addAttribute(courseList, list);model.addAttribute(pagingVO, pagingVO);return student/showCourse;}// 选课操作RequestMapping(value /stuSelectedCourse)public String stuSelectedCourse(int id) throws Exception {//获取当前用户名Subject subject SecurityUtils.getSubject();String username (String) subject.getPrincipal();SelectedCourseCustom selectedCourseCustom new SelectedCourseCustom();selectedCourseCustom.setCourseid(id);selectedCourseCustom.setStudentid(Integer.parseInt(username));SelectedCourseCustom s selectedCourseService.findOne(selectedCourseCustom);if (s null) {selectedCourseService.save(selectedCourseCustom);} else {throw new CustomException(该门课程你已经选了不能再选);}return redirect:/student/selectedCourse;}// 退课操作RequestMapping(value /outCourse)public String outCourse(int id) throws Exception {Subject subject SecurityUtils.getSubject();String username (String) subject.getPrincipal();SelectedCourseCustom selectedCourseCustom new SelectedCourseCustom();selectedCourseCustom.setCourseid(id);selectedCourseCustom.setStudentid(Integer.parseInt(username));selectedCourseService.remove(selectedCourseCustom);return redirect:/student/selectedCourse;}// 已选课程RequestMapping(value /selectedCourse)public String selectedCourse(Model model) throws Exception {//获取当前用户名Subject subject SecurityUtils.getSubject();StudentCustom studentCustom studentService.findStudentAndSelectCourseListByName((String) subject.getPrincipal());ListSelectedCourseCustom list studentCustom.getSelectedCourseList();model.addAttribute(selectedCourseList, list);return student/selectCourse;}// 已修课程RequestMapping(value /overCourse)public String overCourse(Model model) throws Exception {//获取当前用户名Subject subject SecurityUtils.getSubject();StudentCustom studentCustom studentService.findStudentAndSelectCourseListByName((String) subject.getPrincipal());ListSelectedCourseCustom list studentCustom.getSelectedCourseList();model.addAttribute(selectedCourseList, list);return student/overCourse;}//修改密码RequestMapping(value /passwordRest)public String passwordRest() throws Exception {return student/passwordRest;}} 大家点赞、收藏、关注、评论啦 、点开下方卡片关注后回复 102
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/bicheng/89264.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!