您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
这期内容当中小编将会给大家带来有关Java怎样实现毕业设计管理系统,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。
功能包括: 该系统不错分为学生,教师,管理员,教导主任四种角 色,包括学生管理,教师管理,学生选题,教师选题,主 任审核,管理员审核,开题报告,中期检查,论文提交, 文件管理等等非常不错。
环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)
项目技术: JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等。
/** * 用户管理操作 */ @Controller @RequestMapping("/user") public class UserController { @Autowired private UserService userService; /** * 用户添加页面 * @return */ @GetMapping("/add") public String create() { return "user/add"; } /** * 用户添加操作 * @param user * @return */ @PostMapping("/add") @ResponseBody public Map<String, Object> add(@RequestBody User user) { if(StringUtils.isEmpty(user.getUserName())){ return MapControl.getInstance().error("请填写用户名").getMap(); } if(StringUtils.isEmpty(user.getName())){ return MapControl.getInstance().error("请填写名称").getMap(); } if(StringUtils.isEmpty(user.getUserPwd())){ return MapControl.getInstance().error("请填写密码").getMap(); } int result = userService.create(user); if (result <= 0) { return MapControl.getInstance().error().getMap(); } return MapControl.getInstance().success().getMap(); } /** * 根据id删除 * @param id * @return */ @PostMapping("/delete/{id}") @ResponseBody public Map<String, Object> delete(@PathVariable("id") Integer id) { int result = userService.delete(id); if (result <= 0) { return MapControl.getInstance().error().getMap(); } return MapControl.getInstance().success().getMap(); } //批量删除 @PostMapping("/delete") @ResponseBody public Map<String, Object> delete(String ids) { int result = userService.delete(ids); if (result <= 0) { return MapControl.getInstance().error().getMap(); } return MapControl.getInstance().success().getMap(); } /** * 编辑用户信息操作 * @param user * @return */ @PostMapping("/edit") @ResponseBody public Map<String, Object> edit(@RequestBody User user) { if(StringUtils.isEmpty(user.getUserName())){ return MapControl.getInstance().error("请填写用户名").getMap(); } if(StringUtils.isEmpty(user.getName())){ return MapControl.getInstance().error("请填写名称").getMap(); } if(StringUtils.isEmpty(user.getUserPwd())){ return MapControl.getInstance().error("请填写密码").getMap(); } int result = userService.update(user); if (result <= 0) { return MapControl.getInstance().error().getMap(); } return MapControl.getInstance().success().getMap(); } /** * 根据id查询,跳转修改页面 * @param id * @param modelMap * @return */ @GetMapping("/edit/{id}") public String edit(@PathVariable("id") Integer id, ModelMap modelMap) { User user = userService.detail(id); modelMap.addAttribute("user", user); return "user/edit"; } //查询所有 @PostMapping("/query") @ResponseBody public Map<String, Object> query(@RequestBody User user) { List<User> list = userService.query(user); Integer count = userService.count(user); return MapControl.getInstance().success().page(list, count).getMap(); } //跳转列表页面 @GetMapping("/list") public String list() { return "user/list"; } }
@Controller public class IndexController { @Autowired UserService userService; @Autowired TeacherService teacherService; @Autowired StudentService studentService; @Autowired ClazzService clazzService; @Autowired SubjectService subjectService; @Autowired CourseService courseService; @Autowired SectionService sectionService; @Autowired ScoreService scoreService; //跳转系统主页 @GetMapping("/index") public String login() { return "index"; } //跳转用户基本信息页面 @GetMapping("/info") public String info() { return "info"; } //跳转修改密码页面 @GetMapping("/pwd") public String pwd() { return "pwd"; } //修改密码 根据旧密码来修改密码 @PostMapping("/pwd") @ResponseBody public Map<String,Object> pwd(String sourcePwd,String newPwd,String type,Integer id) { //先判断类型 if("1".equals(type)) { User user = userService.detail(id); //比较原密码是否相同 注意:原密码也要加密后再进行比较,因为数据库中存储的是加密后的密码 if(user.getUserPwd().equals(MD5Utils.getMD5(sourcePwd))) { User entity = new User(); entity.setId(id); entity.setUserPwd(MD5Utils.getMD5(newPwd)); //主要要加密 int result = userService.update(entity); if(result <= 0) { return MapControl.getInstance().error().getMap(); } else { return MapControl.getInstance().success().getMap(); } } else { return MapControl.getInstance().error("原密码错误").getMap(); } } if("2".equals(type)) { Teacher teacher = teacherService.detail(id); //比较原密码 if(teacher.getTeacherPwd().equals(MD5Utils.getMD5(sourcePwd))) { Teacher entity = new Teacher(); entity.setId(id); entity.setTeacherPwd(MD5Utils.getMD5(newPwd)); int result = teacherService.update(entity); if(result <= 0) { return MapControl.getInstance().error().getMap(); } else { return MapControl.getInstance().success().getMap(); } } else { return MapControl.getInstance().error("原密码错误").getMap(); } } if("3".equals(type)) { Student student = studentService.detail(id); //比较原密码 if(student.getStuPwd().equals(MD5Utils.getMD5(sourcePwd))) { Student entity = new Student(); entity.setId(id); entity.setStuPwd(MD5Utils.getMD5(newPwd)); int result = studentService.update(entity); if(result <= 0) { return MapControl.getInstance().error().getMap(); } else { return MapControl.getInstance().success().getMap(); } } else { return MapControl.getInstance().error("原密码错误").getMap(); } } return MapControl.getInstance().error().getMap(); } //跳转系统主页(数据概览) @GetMapping("/main") public String main(ModelMap modelMap) { //1.系统数据概览 List<Clazz> clazzes = clazzService.query(null); List<Subject> subjects = subjectService.query(null); List<Teacher> teachers = teacherService.query(null); List<Course> courses = courseService.query(null); List<Section> sections = sectionService.query(null); List<Student> students = studentService.query(null); modelMap.addAttribute("clazzCnt",clazzes.size()); modelMap.addAttribute("subjectCnt",subjects.size()); modelMap.addAttribute("teacherCnt",teachers.size()); modelMap.addAttribute("courseCnt",courses.size()); modelMap.addAttribute("studentCnt",students.size()); modelMap.addAttribute("sectionCnt",sections.size()); //2.班级学生数量 List<Map<String,Object>> mapList = new ArrayList<>(); for(Clazz clazz : clazzes) { Map<String,Object> map = new HashMap<>(); map.put("name",clazz.getClazzName()); //设置班级名称 int cnt = 0; //统计学生数量 for(Student student : students) { if(student.getClazzId() == clazz.getId()) { cnt++; } } map.put("cnt",cnt); //设置学生数量 mapList.add(map); } modelMap.addAttribute("mapList",mapList); //3.查询各科平均成绩(根据专业查询各科平均成绩) List<HashMap> mapList2 = scoreService.queryAvgScoreBySection(); modelMap.addAttribute("mapList2",mapList2); return "main"; } }
/** * 公告管理控制器 */ @Controller @RequestMapping("/notice") public class NoticeController { @Autowired private NoticeService noticeService; //跳转添加页面 @GetMapping("/add") public String add() { return "notice/add"; } /** * 公告添加 * @param notice * @return */ @PostMapping("/add") @ResponseBody public Map<String, Object> add(Notice notice, HttpServletRequest request) { if(StringUtils.isEmpty(notice.getTitle())){ return MapControl.getInstance().error("请填写公告标题").getMap(); } if(StringUtils.isEmpty(notice.getContent())){ return MapControl.getInstance().error("请填写公告内容").getMap(); } User user = (User) request.getSession().getAttribute("user"); notice.setAuthor(user.getUserName()); notice.setAuth("1"); int result = noticeService.create(notice); if (result <= 0) { //新增失败 return MapControl.getInstance().error().getMap(); } return MapControl.getInstance().success().getMap(); } //根据id删除 @PostMapping("/delete/{id}") @ResponseBody public Map<String, Object> delete(@PathVariable("id") Integer id) { int result = noticeService.delete(id); if (result <= 0) { return MapControl.getInstance().error().getMap(); } return MapControl.getInstance().success().getMap(); } //批量删除 @PostMapping("/delete") @ResponseBody public Map<String, Object> delete(String ids) { int result = noticeService.delete(ids); if (result <= 0) { return MapControl.getInstance().error().getMap(); } return MapControl.getInstance().success().getMap(); } /** * 修改公告操作 * @param notice * @return */ @PostMapping("/edit") @ResponseBody public Map<String, Object> edit(@RequestBody Notice notice) { if(StringUtils.isEmpty(notice.getTitle())){ return MapControl.getInstance().error("请填写公告标题").getMap(); } if(StringUtils.isEmpty(notice.getContent())){ return MapControl.getInstance().error("请填写公告内容").getMap(); } int result = noticeService.update(notice); if (result <= 0) { return MapControl.getInstance().error().getMap(); } return MapControl.getInstance().success().getMap(); } //根据id查询,跳转修改页面 @GetMapping("/edit/{id}") public String edit(@PathVariable Integer id, ModelMap modelMap) { //查询要修改的老师 Notice notice = noticeService.detail(id); modelMap.addAttribute("notice", notice); return "notice/edit"; } //根据id查询,跳转添加页面 @GetMapping("/look/{id}") public String look(@PathVariable Integer id, ModelMap modelMap) { Notice notice = noticeService.detail(id); modelMap.addAttribute("notice", notice); return "notice/look"; } //查询所有 @PostMapping("/query") @ResponseBody public Map<String, Object> query(@RequestBody Notice notice) { List<Notice> list = noticeService.query(notice); Integer count = noticeService.count(notice); return MapControl.getInstance().success().put("data", list).put("count", count).getMap(); } //跳转列表页面 @GetMapping("/list") public String list() { return "notice/list"; } }
@Controller public class LoginController { @Autowired private UserService userService; @Autowired private TeacherService teacherService; @Autowired private StudentService studentService; //跳转登录页面 @GetMapping("/login") public String login() { return "login"; } //登录操作 @PostMapping("/login") @ResponseBody public Map<String, Object> login(String userName, String password, String captcha, String type, HttpSession session) { //判断用户名、密码、用户类型、验证码是否为空 if (StringUtils.isEmpty(userName) || StringUtils.isEmpty(password) || StringUtils.isEmpty(captcha) || StringUtils.isEmpty(type)) { return MapControl.getInstance().error("用户名或密码不能为空").getMap(); } //获取系统生成的验证码 String _captcha = (String) session.getAttribute("captcha"); //先判断验证码是否正确 if (!(captcha.toLowerCase()).equals(_captcha.toLowerCase())) { //验证码错误 return MapControl.getInstance().error("验证码错误").getMap(); } //判断用户类型 if ("1".equals(type)) { //管理员验证登录 User user = userService.login(userName, MD5Utils.getMD5(password)); //对密码进行加密处理,因为数据库中存储的是加密后的密码 if (user != null) { session.setAttribute("user", user); session.setAttribute("type", 1); return MapControl.getInstance().success().add("data", user).getMap(); } else { return MapControl.getInstance().error("用户名或密码错误").getMap(); } } if ("2".equals(type)) { //老师验证登录 Teacher teacher = teacherService.login(userName, MD5Utils.getMD5(password)); if (teacher != null) { session.setAttribute("user", teacher); session.setAttribute("type", "2"); return MapControl.getInstance().success().add("data", teacher).getMap(); } else { return MapControl.getInstance().error("用户名或密码错误").getMap(); } } if ("3".equals(type)) { //学生验证登录 Student student = studentService.login(userName, MD5Utils.getMD5(password)); if (student != null) { session.setAttribute("user", student); session.setAttribute("type", "3"); return MapControl.getInstance().success().add("data", student).getMap(); } else { return MapControl.getInstance().error("用户名或密码错误").getMap(); } } return MapControl.getInstance().getMap(); } }
上述就是小编为大家分享的Java怎样实现毕业设计管理系统了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注亿速云行业资讯频道。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。