——————————DescriptionStart——————————
运行环境 Java≥8、MySQL≥5.7、Tomcat≥8
开发工具 eclipse/idea/myeclipse/sts等均可配置运行
适用 课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SSM+Maven教务信息查询系统(java+ssm+bootstrap+c3p0+maven+mysql)
项目简介
该项目是一个简单的教务查询系统,分别授予管理员,教师,学生不同的权限,达到基本的数据查询与修改操作。
管理员主要功能: 课程管理、学生管理、教师管理; 教师主要功能: 查看我教授的课程列表、查看学生成绩列表、给学生打分; 学生主要功能:
查看所有课程列表、选课、查看所修课程等;
环境需要
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.是否Maven项目: 是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目 6.数据库:MySql 5.7版本;
使用技术
IOC容器:Spring Web框架:SpringMVC ORM框架:Mybatis 安全框架:Shiro 数据源:C3P0 日志:log4j 前端框架:Bootstrap
使用说明
使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,下载所需jar包;
使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 3. 将项目中mysql.properties配置文件中的数据库配置改为自己的配置 4. 配置tomcat,然后运行项目,输入localhost:8080/xxx 登录 5. 管理员账户:admin 密码:123 教师账号:1001 密码:123
学生账号:10001 密码:123
——————————CodeStart——————————
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 } @RequestMapping(value = "/addStudent", method = {RequestMethod.POST}) public String addStudent (StudentCustom studentCustom, Model model) throws Exception { Boolean result = studentService.save(studentCustom); if (!result) { model.addAttribute("message" , "学号重复" ); return "error" ; } Userlogin userlogin = new Userlogin(); userlogin.setUsername(studentCustom.getUserid().toString()); userlogin.setPassword("123" ); userlogin.setRole(2 ); userloginService.save(userlogin); return "redirect:/admin/showStudent" ; } @RequestMapping(value = "/editStudent", method = {RequestMethod.GET}) public String editStudentUI (Integer id, Model model) throws Exception { if (id == null ) { return "redirect:/admin/showStudent" ; } StudentCustom studentCustom = studentService.findById(id); if (studentCustom == null ) { throw new CustomException("未找到该名学生" ); } List<College> list = collegeService.finAll(); model.addAttribute("collegeList" , list); model.addAttribute("student" , studentCustom); return "admin/editStudent" ; } @RequestMapping(value = "/editStudent", method = {RequestMethod.POST}) public String editStudent (StudentCustom studentCustom) throws Exception {
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 @RequestMapping(value = "/selectedCourse") public String selectedCourse (Model model) throws Exception { Subject subject = SecurityUtils.getSubject(); StudentCustom studentCustom = studentService.findStudentAndSelectCourseListByName((String) subject.getPrincipal()); List<SelectedCourseCustom> 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()); List<SelectedCourseCustom> list = studentCustom.getSelectedCourseList(); model.addAttribute("selectedCourseList" , list); return "student/overCourse" ; } @RequestMapping(value = "/passwordRest") public String passwordRest () throws Exception { return "student/passwordRest" ; } } package com.demo.controller;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 return "admin/showCourse" ; } @RequestMapping("/userPasswordRest") public String userPasswordRestUI () throws Exception { return "admin/userPasswordRest" ; } @RequestMapping(value = "/userPasswordRest", method = {RequestMethod.POST}) public String userPasswordRest (Userlogin userlogin) throws Exception { Userlogin u = userloginService.findByName(userlogin.getUsername()); if (u != null ) { if (u.getRole() == 0 ) { throw new CustomException("该账户为管理员账户,没法修改" ); } u.setPassword(userlogin.getPassword()); userloginService.updateByName(userlogin.getUsername(), u); } else { throw new CustomException("没找到该用户" ); } return "admin/userPasswordRest" ; } @RequestMapping("/passwordRest") public String passwordRestUI () throws Exception { return "admin/passwordRest" ; } } package com.demo.controller;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 public String removeCourse (Integer id) throws Exception { if (id == null ) { return "admin/showCourse" ; } courseService.removeById(id); return "redirect:/admin/showCourse" ; } @RequestMapping(value = "selectCourse", method = {RequestMethod.POST}) public String selectCourse (String findByName, Model model) throws Exception { List<CourseCustom> list = courseService.findByName(findByName); model.addAttribute("courseList" , list); return "admin/showCourse" ; } @RequestMapping(value = "selectCourse2") public String selectCourse (String findByName) throws Exception { System.out.println("444444444444444" +findByName); System.out.println("444444444444444" ); System.out.println("444444444444444" ); System.out.println("444444444444444" ); return "admin/showCourse" ; } @RequestMapping(value = "selectCourse3") public String selectCourse () throws Exception { System.out.println("444444444444444" ); System.out.println("444444444444444" ); System.out.println("444444444444444" ); System.out.println("444444444444444" ); return "admin/showCourse" ; } @RequestMapping("/userPasswordRest") public String userPasswordRestUI () throws Exception {
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 } @RequestMapping("/showTeacher") public String showTeacher (Model model, Integer page) throws Exception { List<TeacherCustom> list = null ; PagingVO pagingVO = new PagingVO(); pagingVO.setTotalCount(teacherService.getCountTeacher()); if (page == null || page == 0 ) { pagingVO.setToPageNo(1 ); list = teacherService.findByPaging(1 ); } else { pagingVO.setToPageNo(page); list = teacherService.findByPaging(page); } model.addAttribute("teacherList" , list); model.addAttribute("pagingVO" , pagingVO); return "admin/showTeacher" ; } @RequestMapping(value = "/addTeacher", method = {RequestMethod.GET}) public String addTeacherUI (Model model) throws Exception { List<College> list = collegeService.finAll(); model.addAttribute("collegeList" , list); return "admin/addTeacher" ; } @RequestMapping(value = "/addTeacher", method = {RequestMethod.POST}) public String addTeacher (TeacherCustom teacherCustom, Model model) throws Exception {
——————————PayStart——————————
项目链接: https://javayms.github.io?id=501422312105200jb https://javayms.pages.dev?id=501422312105200jb