基于javaweb的SSM+Maven教务信息查询系统(java+ssm+bootstrap+c3p0+maven+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

430023242402

450023242402

460023242402

470023242402

480023242402

490023242402

基于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

使用说明

  1. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,下载所需jar包;

  2. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 3. 将项目中mysql.properties配置文件中的数据库配置改为自己的配置 4. 配置tomcat,然后运行项目,输入localhost:8080/xxx 登录 5. 管理员账户:admin 密码:123 教师账号:1001 密码:123

学生账号:10001 密码:123

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) {
//加入没有带学生id就进来的话就返回学生显示页面
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) {
//加入没有带教师id就进来的话就返回教师显示页面
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 {


项目链接:
https://javayms.github.io?id=501422312105200jb
https://javayms.pages.dev?id=501422312105200jb