基于javaweb的SSM学生成绩管理系统(java+ssm+jsp+mysql+layui)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

072023240609

092023240609

102023240609

112023240609

122023240609

132023240609

基于javaweb的SSM学生成绩管理系统(java+ssm+jsp+mysql+layui)

管理员:
admin 123456

老师:
teacher1 123456
teacher2 123456

学生:
student1 123456
student2 123456
student3 123456

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
    	jsonobj3.put("id",student.getId());
jsonobj3.put("username",student.getUsername());
jsonobj3.put("password",student.getPassword());
jsonobj3.put("stuclass",student.getStuclass());
jsonobj3.put("stuname",student.getStuname());
jsonobj3.put("stuno",student.getStuno());
jsonobj2.add(jsonobj3);
}
jsonobj.put("data", jsonobj2);
return jsonobj.toString();
}
@RequestMapping("/addstudent")
public ModelAndView addstu(Student student,Model model) {
adminService.addStudent(student);
ModelAndView mav = new ModelAndView("admin/stumanage");
return mav;
}
@RequestMapping("/delstu")
public ModelAndView delstu(String id,Model model) {
adminService.delstudnet(id);
ModelAndView mav = new ModelAndView("admin/stumanage");
return mav;
}
@RequestMapping("/updatestu")
public ModelAndView updatestu(String id,Student student,Model model) {
student.setId(Integer.parseInt(id));
adminService.updatestu(student);
ModelAndView mav = new ModelAndView("admin/stumanage");
return mav;
}
@RequestMapping(value = "/mohuname",method = {RequestMethod.POST, RequestMethod.GET},produces ="application/json;charset=UTF-8")
@ResponseBody
public String mohuname(HttpSession session) {
@SuppressWarnings("unchecked")
List<Student> list=(List<Student>) session.getAttribute("list");
JSONObject jsonobj=new JSONObject();
jsonobj.put("code", 0);
jsonobj.put("msg", "成功");
jsonobj.put("count",list.size());
JSONArray jsonobj2=new JSONArray();
JSONObject jsonobj3=new JSONObject();
for(Student student:list) {
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
    	jsonobj3.put("username",student.getUsername());
jsonobj3.put("password",student.getPassword());
jsonobj3.put("stuclass",student.getStuclass());
jsonobj3.put("stuname",student.getStuname());
jsonobj3.put("stuno",student.getStuno());
jsonobj2.add(jsonobj3);
}
jsonobj.put("data", jsonobj2);
return jsonobj.toString();
}
@RequestMapping("/addstudent")
public ModelAndView addstu(Student student,Model model) {
adminService.addStudent(student);
ModelAndView mav = new ModelAndView("admin/stumanage");
return mav;
}
@RequestMapping("/delstu")
public ModelAndView delstu(String id,Model model) {
adminService.delstudnet(id);
ModelAndView mav = new ModelAndView("admin/stumanage");
return mav;
}
@RequestMapping("/updatestu")
public ModelAndView updatestu(String id,Student student,Model model) {
student.setId(Integer.parseInt(id));
adminService.updatestu(student);
ModelAndView mav = new ModelAndView("admin/stumanage");
return mav;
}
@RequestMapping(value = "/mohuname",method = {RequestMethod.POST, RequestMethod.GET},produces ="application/json;charset=UTF-8")
@ResponseBody
public String mohuname(HttpSession session) {
@SuppressWarnings("unchecked")
List<Student> list=(List<Student>) session.getAttribute("list");
JSONObject jsonobj=new JSONObject();
jsonobj.put("code", 0);
jsonobj.put("msg", "成功");
jsonobj.put("count",list.size());
JSONArray jsonobj2=new JSONArray();
JSONObject jsonobj3=new JSONObject();
for(Student student:list) {
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
		    	jsonobj3.put("password",teacher.getPassword());
jsonobj3.put("teaname",teacher.getTeaname());
jsonobj2.add(jsonobj3);
}
jsonobj.put("data", jsonobj2);
return jsonobj.toString();
}
}



@Controller
public class TeachController {
@Autowired
private AdminService adminService;
@Autowired
private GeneraService generaService;
@RequestMapping("/hrefaddscore")
public ModelAndView hrefaddscore(Model model) {
ModelAndView mav = new ModelAndView("teacher/addscore");
return mav;
}
@RequestMapping("/hrefupdatepw")
public ModelAndView hrefupdatepw(Model model) {
ModelAndView mav = new ModelAndView("teacher/updatepw");
return mav;
}
@RequestMapping(value = "/stuscore",method = {RequestMethod.POST, RequestMethod.GET},produces ="application/json;charset=UTF-8")
@ResponseBody
public String stuscoree(Page page,Model model) {
List<Student> list=adminService.stumanage();
page.caculatestart();
List<Student> list2=adminService.liststudent(page);
JSONObject jsonobj=new JSONObject();
jsonobj.put("code", 0);
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

@Controller
public class LoginController {
@Autowired
private LoginService loginService;
@RequestMapping("/login")
public ModelAndView findCustomerById(String username,String password,String people,Model model,HttpSession session) {
if("student".equals(people)) {
Student student=new Student();
student.setUsername(username);
student.setPassword(password);
Student student2=loginService.findStuTeachByUsername(student);
if(student2!=null) {
session.setAttribute("student", student2);
ModelAndView mav = new ModelAndView("/student/indexs");
return mav;
}else {
ModelAndView mav = new ModelAndView("error");
return mav;
}
}else if("teacher".equals(people)){
Teacher teacher=new Teacher();
teacher.setUsername(username);
teacher.setPassword(password);
Teacher teacher2=loginService.findTeachByUsername(teacher);
if(teacher2!=null) {
session.setAttribute("teacher", teacher2);
ModelAndView mav = new ModelAndView("/teacher/indext");
return mav;
}else {
ModelAndView mav = new ModelAndView("error");
return mav;
}
}else if("manage".equals(people)){
Admin admin =new Admin();
admin.setUsername(username);
admin.setPassword(password);
if(loginService.findAdminById(admin)!=null) {
ModelAndView mav = new ModelAndView("/admin/index");
return mav;
}else {
ModelAndView mav = new ModelAndView("error");
return mav;
}
}
ModelAndView mav = new ModelAndView("error");
return mav;
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



@Controller
public class TeachController {
@Autowired
private AdminService adminService;
@Autowired
private GeneraService generaService;
@RequestMapping("/hrefaddscore")
public ModelAndView hrefaddscore(Model model) {
ModelAndView mav = new ModelAndView("teacher/addscore");
return mav;
}
@RequestMapping("/hrefupdatepw")
public ModelAndView hrefupdatepw(Model model) {
ModelAndView mav = new ModelAndView("teacher/updatepw");
return mav;
}
@RequestMapping(value = "/stuscore",method = {RequestMethod.POST, RequestMethod.GET},produces ="application/json;charset=UTF-8")
@ResponseBody
public String stuscoree(Page page,Model model) {
List<Student> list=adminService.stumanage();
page.caculatestart();
List<Student> list2=adminService.liststudent(page);
JSONObject jsonobj=new JSONObject();
jsonobj.put("code", 0);
jsonobj.put("msg", "成功");
jsonobj.put("count",list.size());
JSONArray jsonobj2=new JSONArray();
JSONObject jsonobj3=new JSONObject();
for(Student student:list2) {
jsonobj3.put("id",student.getId());
jsonobj3.put("stuno", student.getStuno());
jsonobj3.put("stuname",student.getStuname());
jsonobj3.put("stuclass",student.getStuclass());
jsonobj3.put("score",student.getScore());
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
	    	jsonobj2.add(jsonobj3);
}
jsonobj.put("data", jsonobj2);
return jsonobj.toString();
}
@RequestMapping("/updatepw")
public ModelAndView updatepw(Teacher teacher,Model model) {
this.generaService.updatepw(teacher);
ModelAndView mav = new ModelAndView("success");
return mav;
}
@RequestMapping("/updatescore")
public ModelAndView updatescore(String id,String score,Model model) {
Student student=new Student();
student.setId(Integer.parseInt(id));
student.setScore(score);
this.generaService.updatescore(student);
ModelAndView mav = new ModelAndView("teacher/addscore");
return mav;
}
}

@Controller
public class HrefController {
@Autowired
private AdminService adminService;
@RequestMapping("/index")
public ModelAndView index(Model model) {
ModelAndView mav = new ModelAndView("index");
return mav;
}
//学生
@RequestMapping("/hrefaddstu")
public ModelAndView addstu(Model model) {
ModelAndView mav = new ModelAndView("admin/addstu");
return mav;
}


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