项目介绍
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项目:是;
技术栈
-
后端:SpringBoot+Thymeleaf
-
前端:HTML+CSS+jQuery+LayUI
使用说明
-
使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
-
使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
- 将项目中application.yml配置文件中的数据库配置改为自己的配置;注:要修改最下方profiles:dev相关的配置;
- 运行项目,输入localhost:8080/home 登录
管理员账号/密码:admin/123456
教师账号/密码:2020001/123456
学生账号/密码:15020002/123456
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
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<CourseCustom> list = courseService.findByName(findByName);
model.addAttribute("courseList", list);
}
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<TeacherCustom> list = teacherService.findAll();
List<College> 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 = "/addCourse", method = {RequestMethod.GET})
public String addCourseUI(Model model) throws Exception {
List<TeacherCustom> list = teacherService.findAll();
List<College> 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", "课程号重复");
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<CollegeCustom> list = null;
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";
}
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());
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";
}
return "redirect:/admin/showCollege";
}
//搜索学院
@RequestMapping(value = "selectCollege", method = {RequestMethod.POST})
private String selectCollege(String findByName, Model model) throws Exception {
List<College> byName = collegeService.findByName(findByName);
model.addAttribute("collegeList", byName);
model.addAttribute("name",findByName);
return "admin/college/showCollege";
}
}
老师管理控制层:
@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 {
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")
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("未找到该名学生");
}
}
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<College> 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());