学生学籍管理系统使用了B/S架构,编程语言为Java语言,项目的框架为SSM框架,Layui前端框架完成前后端的交互;数据库为MySQL5.0。
部分代码展示
@Controller
@RequestMapping("/student")
public class StudentController {private static final String LIST = "student/list";
private static final String ADD = "student/add";
private static final String UPDATE = "student/update";
@Autowired
private StudentService studentService;
@Autowired
private SubjectService subjectService;
@Autowired
private ClazzService clazzService;
@GetMapping("/add")
public String create(ModelMap modelMap){
List subjects = subjectService.query(null);
modelMap.addAttribute("subjects",subjects);
return ADD;
}@PostMapping("/create")
@ResponseBody
public Map create(@RequestBody Student student, HttpServletRequest request){//student.setStatus(Student.StatusType.type_1);
//int result = studentService.create(student);
//if(result<=0 ){
//return MapControll.getInstance().error().getMap();
//}
//return MapControll.getInstance().success().getMap();
String s = student.getStuNo();
String p= student.getStuPwd();
System.out.println("====================================="+s);
Integer s1 = studentService.querystuNo(s);
String regex="\\d{10}";
Pattern pattern = Pattern.compile(regex);
boolean matches = pattern.matcher(s).matches();
if(matches==false){
return MapControll.getInstance().error("学号格式不对").getMap();
}
if(p.length()>=12){
return MapControll.getInstance().error("密码长度过长").getMap();
}
if(p.length()<6){
return MapControll.getInstance().error("密码长度过短").getMap();
}
if (s1==null) {
student.setStatus(Student.StatusType.type_1);
int result = studentService.create(student);
if (result <= 0) {
return MapControll.getInstance().error().getMap();
}
return MapControll.getInstance().success().getMap();
}else {
System.out.println("==============================学号重复");
//2022.3.3:学号重复BUG已解决。lbs
return MapControll.getInstance().error("学号重复,请重新注册").getMap();
}}@PostMapping("/delete/{id}")
@ResponseBody
public Map delete(@PathVariable("id") Integer id){
int result = studentService.delete(id);
if(result<=0){
return MapControll.getInstance().error().getMap();
}
return MapControll.getInstance().success().getMap();
}@PostMapping("/delete")
@ResponseBody
public Map delete(String ids){
int result = studentService.delete(ids);
if(result<=0){
return MapControll.getInstance().error().getMap();
}
return MapControll.getInstance().success().getMap();
}@PostMapping("/update")
@ResponseBody
public Map update(@RequestBody Student student){
int result = studentService.update(student);
if(result<=0){
return MapControll.getInstance().error().getMap();
}
return MapControll.getInstance().success().getMap();
}@GetMapping("/detail/{id}")
public String detail(@PathVariable("id") Integer id, ModelMap modelMap){
Student student = studentService.detail(id);
List subjects = subjectService.query(null);
modelMap.addAttribute("student",student);
modelMap.addAttribute("subjects",subjects);
return UPDATE;
}@PostMapping("/query")
@ResponseBody
public Map query(@RequestBody Student student ){
List list = studentService.query(student);
List subjects = subjectService.query(null);
List clazzes = clazzService.query(null);
//设置关联关系
list.forEach(entity->{
subjects.forEach(subject -> {
if(subject.getId() == entity.getSubjectId()){
entity.setSubject(subject);
}
});
clazzes.forEach(clazz -> {
if(clazz.getId() == entity.getClazzId()){
entity.setClazz(clazz);
}
});
});
Integer count = studentService.count(student);
return MapControll.getInstance().success().page(list,count).getMap();
}@GetMapping("/list")
public String list(){
return LIST;
}@GetMapping("/info")
public String info(HttpSession session,ModelMap modelMap){
//获取Student
Student param = (Student) session.getAttribute("user");
Student student = studentService.detail(param.getId());
modelMap.put("student",student);
return "student/info";
}@GetMapping("/teacher_student")
public String teacher_student(HttpSession session,ModelMap modelMap){
Teacher teacher = (Teacher) session.getAttribute("user");
List clazzes = clazzService.query(null);
List subjects = subjectService.query(null);
modelMap.addAttribute("clazzes",clazzes);
modelMap.addAttribute("subjects",subjects);
modelMap.addAttribute("teacherId",teacher.getId());
return "student/teacher_student";
}
@PostMapping("/teacher_student")
@ResponseBody
public Map teacher_student(Integer teacherId,Integer clazzId,Integer subjectId){
List students = studentService.queryStudentByTeacher(teacherId, clazzId, subjectId);
List subjects = subjectService.query(null);
List clazzes = clazzService.query(null);
//设置关联关系
students.forEach(entity->{
subjects.forEach(subject -> {
if(subject.getId() == entity.getSubjectId()){
entity.setSubject(subject);
}
});
clazzes.forEach(clazz -> {
if(clazz.getId() == entity.getClazzId()){
entity.setClazz(clazz);
}
});
});
return MapControll.getInstance().success().add("data",students).getMap();
}```java
package com.yanzhen.controller;
@Controller
@RequestMapping("/teacher")
public class TeacherController {private static final String LIST = "teacher/list";
private static final String ADD = "teacher/add";
private static final String UPDATE = "teacher/update";
@Autowired
private TeacherService teacherService;
@Autowired
private SubjectService subjectService;
@Autowired
private ClazzService clazzService;
@GetMapping("/add")
public String create(ModelMap modelMap){
return ADD;
}@PostMapping("/create")
@ResponseBody
public Map create(@RequestBody Teacher teacher){
int result = teacherService.create(teacher);
if(result<=0){
return MapControll.getInstance().error().getMap();
}
return MapControll.getInstance().success().getMap();
}@PostMapping("/delete/{id}")
@ResponseBody
public Map delete(@PathVariable("id") Integer id){
int result = teacherService.delete(id);
if(result<=0){
return MapControll.getInstance().error().getMap();
}
return MapControll.getInstance().success().getMap();
}@PostMapping("/delete")
@ResponseBody
public Map delete(String ids){
int result = teacherService.delete(ids);
if(result<=0){
return MapControll.getInstance().error().getMap();
}
return MapControll.getInstance().success().getMap();
}@PostMapping("/update")
@ResponseBody
public Map update(@RequestBody Teacher teacher){
int result = teacherService.update(teacher);
if(result<=0){
return MapControll.getInstance().error().getMap();
}
return MapControll.getInstance().success().getMap();
}@GetMapping("/detail/{id}")
public String detail(@PathVariable("id") Integer id, ModelMap modelMap){
Teacher teacher = teacherService.detail(id);
modelMap.addAttribute("teacher",teacher);
return UPDATE;
}@PostMapping("/query")
@ResponseBody
public Map query(@RequestBody Teacher teacher){
List list = teacherService.query(teacher);
Integer count = teacherService.count(teacher);
return MapControll.getInstance().success().page(list,count).getMap();
}@GetMapping("/list")
public String list(){
return LIST;
}}
【java|学生学籍管理系统(JAVA+Spring+SpringMVC+Mybatis)毕设,课设】}
效果图:
文章图片
文章图片
文章图片
文章图片
文章图片
文章图片
文章图片
文章图片
---------------------------------源码教程放到下方了,自取-------------------------------
添加链接描述
https://download.csdn.net/download/u013574207/85414640
推荐阅读
- 某课体系课-Java工程师2022版
- 图灵JAVA互联网架构师五期内置文档资料
- 微体系-多端全栈项目实战(商业级代驾全流程落地完结无密)
- vue|Vue+Electron开发跨平台桌面应用(实战)
- 面试官(int(1) 和 int(10) 有什么区别())
- docker|Docker容器之harbor私有仓库部署与管理
- Nginx 限流的天坑!!
- java|银行科技岗是程序员比较好的就业选择么()
- 大数据|首席数据官(从哪里来(到哪里去?))