基于javaweb的SSM+Maven学生学籍管理系统(java+ssm+layui+maven+mysql+jsp)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

320023022402

340023022402

350023022402

360023022402

370023022402

380023022402

基于javaweb的SSM+Maven学生学籍管理系统(java+ssm+layui+maven+mysql+jsp)

项目介绍

SSM项目-学生学籍管理系统。该项目分管理员、老师、学生三种用户角色。每种角色分别对应不同的菜单;

以下分别介绍各个角色对应的功能模块:

管理员角色:

  • 用户登录和退出 - 权限控制 - 系统管理 - 专业管理 - 班级管理 - 学生管理 - 老师管理 - 课程管理 - 开课管理 - 用户管理

老师角色:

  • 老师管理 - 成绩管理 - 学生查询

学生角色:

  • 学生管理 - 选课管理 - 成绩查询

技术路线

  • 开发工具:IDEA 2020.1 - 技术框架:Spring、SpringMVC、MyBatis - Web容器:Tomcat 8.5.7 - 数据库:MySQL 5.7 - 前端UI框架:LayUI - 项目管理:Maven 3.6.3

使用说明

  1. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,下载所需jar包; 2. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 3. 将项目中application.yml配置文件中的数据库配置改为自己的配置 4. 配置tomcat,然后运行项目,输入localhost:8080 登录

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
47
48
@Controller
@RequestMapping("/clazz")
public class ClazzController {

private static final String LIST = "clazz/list";
private static final String ADD = "clazz/add";
private static final String UPDATE = "clazz/update";

@Autowired
private ClazzService clazzService;
@Autowired
private SubjectService subjectService;

//跳转添加页面
@GetMapping("/add")
public String create(ModelMap modelMap) {
//查询所有的专业,存储到request域
List<Subject> subjects = subjectService.query(null);
modelMap.addAttribute("subjects", subjects);
return ADD;
}

//添加操作
@PostMapping("/create")
@ResponseBody
public Map<String, Object> create(@RequestBody Clazz clazz) {
int result = clazzService.create(clazz);
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 = clazzService.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) {
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
        return LIST;
}
}
package com.yanzhen.controller;



@Controller
@RequestMapping("/captcha")
public class CaptchaController {

private char[] codeSequence = {'A', '1', 'B', 'C', '2', 'D', '3', 'E', '4', 'F', '5', 'G', '6', 'H', '7', 'I', '8', 'J',
'K', '9', 'L', '1', 'M', '2', 'N', 'P', '3', 'Q', '4', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z'};

@RequestMapping("/code")
public void getCode(HttpServletResponse response, HttpSession session) throws IOException {
int width = 80;
int height = 37;
Random random = new Random();
//设置response头信息
//禁止缓存
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);

//生成缓冲区image类
BufferedImage image = new BufferedImage(width, height, 1);
//产生image类的Graphics用于绘制操作
Graphics g = image.getGraphics();
//Graphics类的样式
g.setColor(this.getColor(200, 250));
g.setFont(new Font("Times New Roman", 0, 28));
g.fillRect(0, 0, width, height);
//绘制干扰线
for (int i = 0; i < 40; i++) {
g.setColor(this.getColor(130, 200));
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
    @PostMapping("/update")
@ResponseBody
public Map<String, Object> update(@RequestBody Course course) {
int result = courseService.update(course);
if (result <= 0) {
return MapControl.getInstance().error().getMap();
}
return MapControl.getInstance().success().getMap();
}

//根据id删除,跳转修改页面
@GetMapping("/detail/{id}")
public String detail(@PathVariable("id") Integer id, ModelMap modelMap) {
//查询出要修改的课程信息,存储到request域
Course course = courseService.detail(id);
modelMap.addAttribute("course", course);
return UPDATE;
}

//查询所有
@PostMapping("/query")
@ResponseBody
public Map<String, Object> query(@RequestBody Course course) {
List<Course> list = courseService.query(course);
//查询总记录条数
Integer count = courseService.count(course);
return MapControl.getInstance().success().page(list, count).getMap();
}

//跳转列表页面
@GetMapping("/list")
public String list() {
return LIST;
}

}
package com.yanzhen.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
package com.yanzhen.controller;



@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(type)) {
return MapControl.getInstance().error("用户名或密码不能为空").getMap();
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
            }
});
courses.forEach(course -> {
//判断开课表中的courseId和课程表的id是否一致
if (course.getId() == entity.getCourseId()) {
entity.setCourse(course);
}
});
});
//查询宗记录条数
Integer count = sectionService.count(section);
return MapControl.getInstance().success().page(list, count).getMap();
}

//跳转列表页面
@GetMapping("/list")
public String list() {
return LIST;
}

//生成zTree树形
@PostMapping("/tree")
@ResponseBody
public List<Map> tree() {
List<Subject> subjects = subjectService.query(null);
List<Clazz> clazzes = clazzService.query(null);
List<Map> list = new ArrayList<>();
subjects.forEach(subject -> {
Map<String, Object> map = new HashMap<>();
map.put("id", subject.getId());
map.put("name", subject.getSubjectName());
map.put("parentId", 0);
List<Map<String, Object>> childrenList = new ArrayList<>();
clazzes.forEach(clazz -> {
if (subject.getId() == clazz.getSubjectId()) {
Map<String, Object> children = new HashMap<>();
children.put("id", clazz.getId());
children.put("name", clazz.getClazzName());
children.put("parentId", subject.getId());
childrenList.add(children);
}
});
map.put("children", childrenList);
list.add(map);
});
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
47
48
49
50
51

@Controller
@RequestMapping("/captcha")
public class CaptchaController {

private char[] codeSequence = {'A', '1', 'B', 'C', '2', 'D', '3', 'E', '4', 'F', '5', 'G', '6', 'H', '7', 'I', '8', 'J',
'K', '9', 'L', '1', 'M', '2', 'N', 'P', '3', 'Q', '4', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z'};

@RequestMapping("/code")
public void getCode(HttpServletResponse response, HttpSession session) throws IOException {
int width = 80;
int height = 37;
Random random = new Random();
//设置response头信息
//禁止缓存
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);

//生成缓冲区image类
BufferedImage image = new BufferedImage(width, height, 1);
//产生image类的Graphics用于绘制操作
Graphics g = image.getGraphics();
//Graphics类的样式
g.setColor(this.getColor(200, 250));
g.setFont(new Font("Times New Roman", 0, 28));
g.fillRect(0, 0, width, height);
//绘制干扰线
for (int i = 0; i < 40; i++) {
g.setColor(this.getColor(130, 200));
int x = random.nextInt(width);
int y = random.nextInt(height);
int x1 = random.nextInt(12);
int y1 = random.nextInt(12);
g.drawLine(x, y, x + x1, y + y1);
}

//绘制字符
String strCode = "";
for (int i = 0; i < 4; i++) {
String rand = String.valueOf(codeSequence[random.nextInt(codeSequence.length)]);
strCode = strCode + rand;
g.setColor(new Color(20 + random.nextInt(110), 20 + random.nextInt(110), 20 + random.nextInt(110)));
g.drawString(rand, 13 * i + 6, 28);
}
//将字符保存到session中用于前端的验证
session.setAttribute("captcha", strCode.toLowerCase());
g.dispose();

ImageIO.write(image, "JPEG", response.getOutputStream());


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