基于javaweb的教务管理系统(java+springboot+thymeleaf+layui+html+mysql)

基于javaweb的教务管理系统(java+springboot+thymeleaf+layui+html+mysql)

运行环境

Java≥8、MySQL≥5.7

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

20220519000842

20220519000843

20220519000844

20220519000845

20220519000846

20220519000848

基于javaweb+SpringBoot的教务管理系统(java+SpringBoot+Thymeleaf+LayUI+HTML+mysql)

项目介绍

1.系统默认超级管理员账号为admin,默认密码为123456 系统配置:用户管理、角色管理、权限管理 默认已配置好基本数据:用户默认只有一个超级管理员,角色有三种:管理员、教师、学生,权限已按照角色分配完成。 2.系统建设 a.建设简介: 学校建设需要按照系部 > 专业 > 年级 > 班级的顺序进行建设。每项管理均提供精确/条件查询,可快速定位所需信息。 b.系部建设 c.专业建设 d.年级建设 3,课目建设 a.课目介绍 b.添加必修课目 c.添加选修课目 d.课目启动与暂停 4.教师管理 a.教师授课管理 b.录入教师 c.教师信息查询 5.学生管理: a,退学信息 b.录入学生 c.学生信息查询 6.成绩管理 a.学生成绩管理 b.教师成绩管理 7.校园新闻: a,新闻管理

b.发布新闻

环境需要

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项目:是;

技术栈

  1. 后端:SpringBoot+Thymeleaf

  2. 前端:HTML+CSS+jQuery+LayUI

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;

  2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;

若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;

  1. 将项目中application.yml配置文件中的数据库配置改为自己的配置;注:要修改最下方profiles:dev相关的配置; 4. 运行项目,输入localhost:8080/home 登录 管理员账号/密码:admin/123456 教师账号/密码:2020001/123456 学生账号/密码:15020002/123456

老师管理控制层:

@Controller

@RequestMapping(value = “/teacher”)

public class TeacherController {

@Resource(name = “teacherServiceImpl”)

private TeacherService teacherService;

@Resource(name = “courseServiceImpl”)

private CourseService courseService;

@Resource(name = “selectedCourseServiceImpl”)

private SelectedCourseService selectedCourseService;

// 显示我的课程

@RequestMapping(value = “/showCourse”)

public String stuCourseShow(Model model) throws Exception {

Subject subject = SecurityUtils.getSubject();

String username = (String) subject.getPrincipal();

List list = courseService.findByTeacherID(Integer.parseInt(username));

model.addAttribute(“courseList”, list);

return “teacher/showCourse”;

// 显示我的课程

@RequestMapping(value = “/selectCourse”)

public String selectCourse(String findByName,Model model) throws Exception {

Subject subject = SecurityUtils.getSubject();

String username = (String) subject.getPrincipal();

if(findByName==null){

findByName=“”;

List list = courseService.findByTeacherIdAndCourseName(Integer.parseInt(username),findByName);

model.addAttribute(“courseList”, list);

model.addAttribute(“name”,findByName);

return “teacher/showCourse”;

// 显示成绩

@RequestMapping(value = “/gradeCourse”)

public String gradeCourse(Integer id, Model model) throws Exception {

if (id == null) {

return “”;

List list = selectedCourseService.findByCourseID(id);

model.addAttribute(“selectedCourseList”, list);

return “teacher/showGrade”;

// 打分

@RequestMapping(value = “/mark”, method = {RequestMethod.GET})

public String markUI(SelectedCourseCustom scc, Model model) throws Exception {

SelectedCourseCustom selectedCourseCustom = selectedCourseService.findOne(scc);

model.addAttribute(“selectedCourse”, selectedCourseCustom);

return “teacher/mark”;

// 打分

@RequestMapping(value = “/mark”, method = {RequestMethod.POST})

public String mark(SelectedCourseCustom scc) throws Exception {

selectedCourseService.updataOne(scc);

return “redirect:/teacher/gradeCourse?id=”+scc.getCourseid();

//修改密码

@RequestMapping(value = “/passwordRest”)

public String passwordRest() throws Exception {

return “teacher/passwordRest”;

学生管理控制层:

@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 {

List list = null;

//页码对象

PagingVO pagingVO = new PagingVO();

//设置总页数

int countCouse = courseService.getCountCouse();

pagingVO.setTotalCount(countCouse);

if (page == null || page == 0) {

pagingVO.setToPageNo(1);

list = courseService.findByPaging(1);

} else {

pagingVO.setToPageNo(page);

list = courseService.findByPaging(page);

model.addAttribute(“countCouse”,countCouse);

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());

List list=new ArrayList<>();

if(studentCustom!=null){

list = studentCustom.getSelectedCourseList();

model.addAttribute(“selectedCourseList”, list);

model.addAttribute(“selectedCourseCount”,list.size());

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 list =new ArrayList<>();

if(studentCustom!=null){

list = studentCustom.getSelectedCourseList();

model.addAttribute(“selectedCourseList”, list);

model.addAttribute(“checkedCourseCount”,list.size());

return “student/overCourse”;

//修改密码

@RequestMapping(value = “/passwordRest”)

public String passwordRest() throws Exception {

return “student/passwordRest”;

//搜索课程

@RequestMapping(value = “selectCourse”, method = {RequestMethod.POST})

private String selectCourse(String findByName, Model model) throws Exception {

List list = courseService.findByName(findByName);

model.addAttribute(“name”,findByName==null?“”:findByName);

model.addAttribute(“courseList”, list);

return “student/showCourse”;

管理员管理控制层:

@Controller

@RequestMapping(“/admin”)

public class AdminController {

@Resource

private StudentService studentService;

@Resource

private TeacherService teacherService;

@Resource

private CourseService courseService;

@Resource

private CollegeService collegeService;

@Resource

private UserloginService userloginService;

/<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<学生操作>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>/

// 学生信息显示

@RequestMapping(“/showStudent”)

public String showStudent(Model model, Integer page) throws Exception {

List list = null;

//页码对象

PagingVO pagingVO = new PagingVO();

//设置总页数

pagingVO.setTotalCount(studentService.getCountStudent());

if (page == null || page == 0) {

pagingVO.setToPageNo(1);

list = studentService.findByPaging(1);

} else {

pagingVO.setToPageNo(page);

list = studentService.findByPaging(page);

model.addAttribute(“studentList”, list);

model.addAttribute(“pagingVO”, pagingVO);

return “admin/student/showStudent”;

// 添加学生信息页面显示

@RequestMapping(value = “/addStudent”, method = {RequestMethod.GET})

public String addStudentUI(Model model) throws Exception {

List list = collegeService.finAll();

model.addAttribute(“collegeList”, list);

return “admin/student/addStudent”;

// 添加学生信息操作

@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”;

//添加成功后,也添加到登录表

if(userloginService.findByName(studentCustom.getUsername())!=null){

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) {

//加入没有带学生id就进来的话就返回学生显示页面

return “redirect:/admin/showStudent”;

StudentCustom studentCustom = studentService.findById(id);

if (studentCustom == null) {

throw new CustomException(“未找到该名学生”);

List list = collegeService.finAll();

model.addAttribute(“collegeList”, list);

model.addAttribute(“student”, studentCustom);

return “admin/student/editStudent”;

// 修改学生信息处理

@RequestMapping(value = “/editStudent”, method = {RequestMethod.POST})

public String editStudent(StudentCustom studentCustom) throws Exception {

studentService.updataById(studentCustom.getUserid(), studentCustom);

//重定向

return “redirect:/admin/showStudent”;

// 删除学生

@RequestMapping(value = “/removeStudent”, method = {RequestMethod.GET} )

private String removeStudent(Integer id) throws Exception {

if (id == null) {

//加入没有带学生id就进来的话就返回学生显示页面

return “admin/student/showStudent”;

studentService.removeById(id);

userloginService.removeByName(id.toString());

return “redirect:/admin/showStudent”;

// 搜索学生

@RequestMapping(value = “selectStudent”, method = {RequestMethod.POST})

private String selectStudent(String findByName, Model model) throws Exception {

List list = studentService.findByName(findByName);

model.addAttribute(“studentList”, list);

return “admin/student/showStudent”;

/<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<教师操作>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>/

// 教师页面显示

@RequestMapping(“/showTeacher”)

public String showTeacher(Model model, Integer page) throws Exception {

List list = new ArrayList();

//页码对象

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/teacher/showTeacher”;

// 添加教师信息

@RequestMapping(value = “/addTeacher”, method = {RequestMethod.GET})

public String addTeacherUI(Model model) throws Exception {

List list = collegeService.finAll();

model.addAttribute(“collegeList”, list);

return “admin/teacher/addTeacher”;

// 添加教师信息处理

@RequestMapping(value = “/addTeacher”, method = {RequestMethod.POST})

public String addTeacher(TeacherCustom teacherCustom, Model model) throws Exception {

Boolean result = teacherService.save(teacherCustom);

if (!result) {

model.addAttribute(“message”, “工号重复”);

return “error”;

//添加成功后,也添加到登录表

//添加成功后,也添加到登录表

if(userloginService.findByName(teacherCustom.getUsername())!=null){

model.addAttribute(“message”, “学号重复”);

return “error”;

Userlogin userlogin = new Userlogin();

userlogin.setUsername(teacherCustom.getUserid().toString());

userlogin.setPassword(“123”);

userlogin.setRole(1);

userloginService.save(userlogin);

//重定向

return “redirect:/admin/showTeacher”;

// 修改教师信息页面显示

@RequestMapping(value = “/editTeacher”, method = {RequestMethod.GET})

public String editTeacherUI(Integer id, Model model) throws Exception {

if (id == null) {

return “redirect:/admin/showTeacher”;

TeacherCustom teacherCustom = teacherService.findById(id);

if (teacherCustom == null) {

throw new CustomException(“未找到该名学生”);

List list = collegeService.finAll();

model.addAttribute(“collegeList”, list);

model.addAttribute(“teacher”, teacherCustom);

return “admin/teacher/editTeacher”;

// 修改教师信息页面处理

@RequestMapping(value = “/editTeacher”, method = {RequestMethod.POST})

public String editTeacher(TeacherCustom teacherCustom) throws Exception {

teacherService.updateById(teacherCustom.getUserid(), teacherCustom);

//重定向

return “redirect:/admin/showTeacher”;

//删除教师

@RequestMapping(“/removeTeacher”)

public String removeTeacher(Integer id) throws Exception {

if (id == null) {

//加入没有带教师id就进来的话就返回教师显示页面

return “admin/showTeacher”;

teacherService.removeById(id);

userloginService.removeByName(id.toString());

return “redirect:/admin/showTeacher”;

//搜索教师

@RequestMapping(value = “selectTeacher”, method = {RequestMethod.POST})

private String selectTeacher(String findByName, Model model) throws Exception {

List list = teacherService.findByName(findByName);

model.addAttribute(“teacherList”, list);

return “admin/teacher/showTeacher”;

/<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<课程操作>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>/

// 课程信息显示

@RequestMapping(“/showCourse”)

public String showCourse(Model model, Integer page) throws Exception {

List 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 “admin/course/showCourse”;

//添加课程

@RequestMapping(value = “/addCourse”, method = {RequestMethod.GET})

public String addCourseUI(Model model) throws Exception {

List list = teacherService.findAll();

List collegeList = collegeService.finAll();

model.addAttribute(“collegeList”, collegeList);

model.addAttribute(“teacherList”, list);

return “admin/course/addCourse”;

// 添加课程信息处理

@RequestMapping(value = “/addCourse”, method = {RequestMethod.POST})

public String addCourse(CourseCustom courseCustom, Model model) throws Exception {

Boolean result = courseService.save(courseCustom);

if (!result) {

model.addAttribute(“message”, “课程号重复”);

return “error”;

//重定向

return “redirect:/admin/showCourse”;

// 修改教师信息页面显示

@RequestMapping(value = “/editCourse”, method = {RequestMethod.GET})

public String editCourseUI(Integer id, Model model) throws Exception {

if (id == null) {

return “redirect:/admin/showCourse”;

CourseCustom courseCustom = courseService.findById(id);

if (courseCustom == null) {

throw new CustomException(“未找到该课程”);

List list = teacherService.findAll();

List collegeList = collegeService.finAll();

model.addAttribute(“teacherList”, list);

model.addAttribute(“collegeList”, collegeList);

model.addAttribute(“course”, courseCustom);

return “admin/course/editCourse”;

// 修改教师信息页面处理

@RequestMapping(value = “/editCourse”, method = {RequestMethod.POST})

public String editCourse(CourseCustom courseCustom) throws Exception {

courseService.upadteById(courseCustom.getCourseid(), courseCustom);

//重定向

return “redirect:/admin/showCourse”;

// 删除课程信息

@RequestMapping(“/removeCourse”)

public String removeCourse(Integer id) throws Exception {

if (id == null) {

//加入没有带教师id就进来的话就返回教师显示页面

return “admin/showCourse”;

courseService.removeById(id);

return “redirect:/admin/showCourse”;

//搜索课程

@RequestMapping(value = “selectCourse”, method = {RequestMethod.POST})

private String selectCourse(String findByName, Model model) throws Exception {

List list = courseService.findByName(findByName);

model.addAttribute(“courseList”, list);

return “admin/course/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”;

//添加学院页面

@RequestMapping(value = “/showCollege”, method = {RequestMethod.GET})

public String showCollege(Model model,Integer page) throws Exception {

List list = null;

//页码对象

PagingVO pagingVO = new PagingVO();

//设置总页数

pagingVO.setTotalCount(collegeService.getCountCouse());

if (page == null || page == 0) {

pagingVO.setToPageNo(1);

list = collegeService.findByPaging(1);

} else {

pagingVO.setToPageNo(page);

list = collegeService.findByPaging(page);

model.addAttribute(“collegeList”, list);

model.addAttribute(“pagingVO”, pagingVO);

return “admin/college/showCollege”;

//添加学院

@RequestMapping(value = “/addCollege”, method = {RequestMethod.GET})

public String addCollege(Model model){

return “admin/college/addCollege”;

/**

  • 学院添加操作

  • @param college

  • @return

*/

@PostMapping(“/addCollege”)

public String addCollege(College college,Model model) throws IOException {

if(StringUtils.isEmpty(college.getCollegename())){

model.addAttribute(“message”, “请填写学院名称”);

return “error”;

College collegeByName = collegeService.findCollegeByName(college.getCollegename());

if(collegeByName!=null){

model.addAttribute(“message”, “学院名称不能重复!”);

return “error”;

if(collegeService.insert(college)<=0){

model.addAttribute(“message”, “添加失败!请联系管理员”);

return “error”;

//重定向

return “redirect:/admin/showCollege”;

// 修改学院信息页面显示

@RequestMapping(value = “/editCollege”, method = {RequestMethod.GET})

public String editCollege(Integer id, Model model) throws Exception {

if (id == null) {

return “redirect:/admin/showCollege”;

College college = collegeService.selectByPrimaryKey(id);

if (college == null) {

throw new CustomException(“未找到该学院”);

model.addAttribute(“college”, college);

return “admin/college/editCollege”;

/**

  • 编辑学院操作

  • @param college

  • @return

*/

@PostMapping(“/editCollege”)

public String editCollege(College college,Model model){

if(StringUtils.isEmpty(college.getCollegename())){

model.addAttribute(“message”, “学院名称不能为空!”);

return “error”;

College college1 = collegeService.findCollegeByName(college.getCollegename());

if(college1!=null){

if(!college1.getCollegeid().equals(college.getCollegeid())){

model.addAttribute(“message”, “学院名称不可重复!”);

return “error”;

if(collegeService.updateByPrimaryKey(college)<=0){

model.addAttribute(“message”, “编辑失败!请联系管理员”);

return “error”;

//重定向

return “redirect:/admin/showCollege”;

// 删除学院信息

@RequestMapping(“/removeCollege”)

public String removeCollege(Integer id,Model model) throws Exception {

if (id == null) {

//加入没有带教师id就进来的话就返回教师显示页面

return “admin/showCollege”;

try{

int remove = collegeService.deleteByPrimaryKey(id);

if(remove<=0){

model.addAttribute(“message”,“删除失败,可能有关联数据!”);

return “error”;

}catch (Exception e){

e.printStackTrace();

model.addAttribute(“message”,“删除失败,可能有关联数据!”);

return “error”;

return “redirect:/admin/showCollege”;

//搜索学院

@RequestMapping(value = “selectCollege”, method = {RequestMethod.POST})

private String selectCollege(String findByName, Model model) throws Exception {

List byName = collegeService.findByName(findByName);

model.addAttribute(“collegeList”, byName);

model.addAttribute(“name”,findByName);

return “admin/college/showCollege”;


  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值