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

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

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

基于javaweb+mysql的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 登录
    @GetMapping("/detail/{id}")
    public String detail(@PathVariable Integer id, ModelMap modelMap) {
        //查询要修改的老师
        Teacher teacher = teacherService.detail(id);
        modelMap.addAttribute("teacher", teacher);
        return UPDATE;
    }

    //查询所有
    @PostMapping("/query")
    @ResponseBody
    public Map<String, Object> query(@RequestBody Teacher teacher) {
        List<Teacher> list = teacherService.query(teacher);
        Integer count = teacherService.count(teacher);
        return MapControl.getInstance().success().put("data", list).put("count", count).getMap();
    }

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

@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'};

//权限拦截器设计
public class PermissionInterceptor implements HandlerInterceptor {

    //预处理
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        //获取session对象
        HttpSession session = request.getSession();
        //判断用户是否登录
        if(session.getAttribute("user") != null) {
            //已经登录,放行
            return true;
        } else {
            //未登录,抛出异常
            throw new PermissionException("没有权限访问");
        }
    }

    @Override
    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {

    }

    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {

    }
}

//项目路径拦截器
public class PathInterceptor implements HandlerInterceptor {

    //预处理
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        //获取请求路径
    @ResponseBody
    public Map<String, Object> delete(String ids) {
        int result = studentService.delete(ids);
        if (result <= 0) {
            return MapControl.getInstance().error().getMap();
        }
        return MapControl.getInstance().success().getMap();
    }

    //修改操作
    @PostMapping("/update")
    @ResponseBody
    public Map<String, Object> update(@RequestBody Student student) {
        int result = studentService.update(student);
        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) {
        //查询出要修改的学生的信息
        Student student = studentService.detail(id);
        //查询所有的专业
        List<Subject> subjects = subjectService.query(null);
        //将查询出来的数据存储到request域,实现表单回显
        modelMap.addAttribute("student", student);
        modelMap.addAttribute("subjects", subjects);
        return UPDATE;
    }

    //查询所有
    @PostMapping("/query")
    @ResponseBody
    public Map<String, Object> query(@RequestBody Student student) {
        //查询所有的学生信息
        List<Student> list = studentService.query(student);
        //查询所有的专业
        List<Subject> subjects = subjectService.query(null);
        //查询所有的班级
        List<Clazz> clazzes = clazzService.query(null);
        //设置关联
        list.forEach(entity -> {
            subjects.forEach(subject -> {
                //判断学生表中的subjectId和专业表的id是否一致
                if (subject.getId() == entity.getSubjectId()) {
                    entity.setSubject(subject);
                }
            });
    }

    //修改
    @PostMapping("/update")
    @ResponseBody
    public Map<String, Object> update(@RequestBody Clazz clazz) {
        int result = clazzService.update(clazz);
        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) {
        //查询所有的专业
        List<Subject> subjects = subjectService.query(null);
        //查询出要修改的班级的信息
        Clazz clazz = clazzService.detail(id);
        //将查询出来的数据存储到request域,实现表单回显
        modelMap.addAttribute("clazz", clazz);
        modelMap.addAttribute("subjects", subjects);
        return UPDATE;
    }

    //查询所有
    @PostMapping("/query")
    @ResponseBody
    public Map<String, Object> query(@RequestBody Clazz clazz) {
        //查询所有的班级
        List<Clazz> list = clazzService.query(clazz);
        //查询所有的专业
        List<Subject> subjects = subjectService.query(null);
        //设置关联
        list.forEach(entity -> {
            subjects.forEach(subject -> {
                //判断班级表中subjectId与专业表的id是否一致
                if (entity.getSubjectId() == subject.getId()) {
                    entity.setSubject(subject);
                }
            });
        });
        //查询班级总数
        Integer count = clazzService.count(clazz);
    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;
    }

}

@Controller
@RequestMapping("/teacher")
    public String info() {
        return "info";
    }

    //跳转修改密码页面
    @GetMapping("/pwd")
    public String pwd() {
        return "pwd";
    }

    //修改密码 根据旧密码来修改密码
    @PostMapping("/pwd")
    @ResponseBody
    public Map<String,Object> pwd(String sourcePwd,String newPwd,String type,Integer id) {
        //先判断类型
        if("1".equals(type)) {
            User user = userService.detail(id);
            //比较原密码是否相同 注意:原密码也要加密后再进行比较,因为数据库中存储的是加密后的密码
            if(user.getUserPwd().equals(MD5Utils.getMD5(sourcePwd))) {
                User entity = new User();
                entity.setId(id);
                entity.setUserPwd(MD5Utils.getMD5(newPwd)); //主要要加密
                int result = userService.update(entity);
                if(result <= 0) {
                    return MapControl.getInstance().error().getMap();
                } else {
                    return MapControl.getInstance().success().getMap();
                }
            } else {
                return MapControl.getInstance().error("原密码错误").getMap();
            }
        }
        if("2".equals(type)) {
            Teacher teacher = teacherService.detail(id);
            //比较原密码
            if(teacher.getTeacherPwd().equals(MD5Utils.getMD5(sourcePwd))) {
                Teacher entity = new Teacher();
                entity.setId(id);
                entity.setTeacherPwd(MD5Utils.getMD5(newPwd));
                int result = teacherService.update(entity);
                if(result <= 0) {
                    return MapControl.getInstance().error().getMap();
                } else {
                    return MapControl.getInstance().success().getMap();
                }
            } else {
                return MapControl.getInstance().error("原密码错误").getMap();
            }
        }
        if("3".equals(type)) {
    }

}

@Controller
@RequestMapping("/teacher")
public class TeacherController {

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

    @Autowired
    private TeacherService teacherService;

    //跳转添加页面
    @GetMapping("/add")
    public String add() {
        return ADD;
    }

    //添加操作
    @PostMapping("/create")
    @ResponseBody
    public Map<String, Object> create(Teacher teacher) {
        int result = teacherService.create(teacher);
        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) {
        //查询所有的班级
        List<Course> courses = courseService.query(null);
        //设置关联
        list.forEach(entity -> {
            teachers.forEach(teacher -> {
                //判断开课表的teacherId和老师表的id是否一致
                if (teacher.getId() == entity.getTeacherId()) {
                    entity.setTeacher(teacher);
                }
            });
            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);
        });
        ObjectMapper objectMapper = new ObjectMapper();
        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) {
        //查询所有的专业
        List<Subject> subjects = subjectService.query(null);
        //查询出要修改的班级的信息
        Clazz clazz = clazzService.detail(id);
        //将查询出来的数据存储到request域,实现表单回显
        modelMap.addAttribute("clazz", clazz);
        modelMap.addAttribute("subjects", subjects);
        return UPDATE;
    }

    //查询所有
    @PostMapping("/query")
    @ResponseBody
    public Map<String, Object> query(@RequestBody Clazz clazz) {
        //查询所有的班级
        List<Clazz> list = clazzService.query(clazz);
        //查询所有的专业
        List<Subject> subjects = subjectService.query(null);
        //设置关联
        list.forEach(entity -> {
            subjects.forEach(subject -> {
                //判断班级表中subjectId与专业表的id是否一致
                if (entity.getSubjectId() == subject.getId()) {
                    entity.setSubject(subject);
                }
            });
        });
        //查询班级总数
        Integer count = clazzService.count(clazz);
        return MapControl.getInstance().success().page(list, count).getMap();
    }

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

}
    @Autowired
    UserService userService;
    @Autowired
    TeacherService teacherService;
    @Autowired
    StudentService studentService;
    @Autowired
    ClazzService clazzService;
    @Autowired
    SubjectService subjectService;
    @Autowired
    CourseService courseService;
    @Autowired
    SectionService sectionService;
    @Autowired
    ScoreService scoreService;

    //跳转系统主页
    @GetMapping("/index")
    public String login() {
        return "index";
    }

    //跳转用户基本信息页面
    @GetMapping("/info")
    public String info() {
        return "info";
    }

    //跳转修改密码页面
    @GetMapping("/pwd")
    public String pwd() {
        return "pwd";
    }

    //修改密码 根据旧密码来修改密码
    @PostMapping("/pwd")
    @ResponseBody
    public Map<String,Object> pwd(String sourcePwd,String newPwd,String type,Integer id) {
        //先判断类型
        if("1".equals(type)) {
            User user = userService.detail(id);
            //比较原密码是否相同 注意:原密码也要加密后再进行比较,因为数据库中存储的是加密后的密码
            if(user.getUserPwd().equals(MD5Utils.getMD5(sourcePwd))) {
                User entity = new User();
                entity.setId(id);
        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);
        });
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            String jsonString = objectMapper.writeValueAsString(list);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }
        return list;
    }

    //跳转开课信息列表页面
    @GetMapping("/student_section")
    public String student_section() {
        return "section/student_section";
    }

    @PostMapping("/query_student_section")
    @ResponseBody
    public Map<String, Object> student_section(HttpSession session) {
        Student student = (Student) session.getAttribute("user");
        List<Section> sections = sectionService.queryByStudent(student.getId());
    //查询所有
    @PostMapping("/query")
    @ResponseBody
    public Map<String, Object> query(@RequestBody Student student) {
        //查询所有的学生信息
        List<Student> list = studentService.query(student);
        //查询所有的专业
        List<Subject> subjects = subjectService.query(null);
        //查询所有的班级
        List<Clazz> clazzes = clazzService.query(null);
        //设置关联
        list.forEach(entity -> {
            subjects.forEach(subject -> {
                //判断学生表中的subjectId和专业表的id是否一致
                if (subject.getId() == entity.getSubjectId()) {
                    entity.setSubject(subject);
                }
            });
            clazzes.forEach(clazz -> {
                //判断学生表中的clazzId和班级表的id是否一致
                if (clazz.getId() == entity.getClazzId()) {
                    entity.setClazz(clazz);
                }
            });
        });
        //查询总记录条数
        Integer count = studentService.count(student);
        return MapControl.getInstance().success().page(list, count).getMap();
    }

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

    //跳转查询学生页面
    @GetMapping("/teacher_student")
    public String teacher_student(ModelMap modelMap, HttpSession session) {
        //查询所有的专业
        List<Subject> subjects = subjectService.query(null);
        //查询所有的班级
        List<Clazz> clazzes = clazzService.query(null);
        Teacher teacher = (Teacher) session.getAttribute("user");
        modelMap.addAttribute("subjects", subjects);
        modelMap.addAttribute("clazzes", clazzes);
        modelMap.addAttribute("teacher", teacher);
        return "student/teacher_student";
    }

    //老师查询学生
    @PostMapping("/teacher_student")
    @ResponseBody
    public Map<String, Object> teacher_student(Integer clazzId, Integer subjectId, ModelMap modelMap, HttpSession session) {
        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());
        response.getOutputStream().flush();
    }

    public Color getColor(int fc, int bc) {
        Random random = new Random();
        if (fc > 255)
            fc = 255;
        if (bc > 255)
            bc = 255;
    //老师查询学生
    @PostMapping("/teacher_student")
    @ResponseBody
    public Map<String, Object> teacher_student(Integer clazzId, Integer subjectId, ModelMap modelMap, HttpSession session) {
        Teacher teacher = (Teacher) session.getAttribute("user");
        List<Student> students = studentService.queryStudentByTeacher(teacher.getId(), clazzId, subjectId);
        List<Subject> subjects = subjectService.query(null);
        List<Clazz> clazzes = clazzService.query(null);
        //设置关联
        students.forEach(entity -> {
            subjects.forEach(subject -> {
                //判断学生表的subjectId和专业表的id是否一致
                if (subject.getId() == entity.getSubjectId()) {
                    entity.setSubject(subject);
                }
            });
            clazzes.forEach(clazz -> {
                //判断学生表的clazzId和班级表的id是否一致
                if (clazz.getId() == entity.getClazzId()) {
                    entity.setClazz(clazz);
                }
            });
        });
        return MapControl.getInstance().success().add("data", students).getMap();
    }
}

@Controller
                Student entity = new Student();
                entity.setId(id);
                entity.setStuPwd(MD5Utils.getMD5(newPwd));
                int result = studentService.update(entity);
                if(result <= 0) {
                    return MapControl.getInstance().error().getMap();
                } else {
                    return MapControl.getInstance().success().getMap();
                }
            } else {
                return MapControl.getInstance().error("原密码错误").getMap();
            }
        }

        return MapControl.getInstance().error().getMap();
    }

    //跳转系统主页(数据概览)
    @GetMapping("/main")
    public String main(ModelMap modelMap) {
        //1.系统数据概览
        List<Clazz> clazzes = clazzService.query(null);
        List<Subject> subjects = subjectService.query(null);
        List<Teacher> teachers = teacherService.query(null);
        List<Course> courses = courseService.query(null);
        List<Section> sections = sectionService.query(null);
        List<Student> students = studentService.query(null);
        modelMap.addAttribute("clazzCnt",clazzes.size());
        modelMap.addAttribute("subjectCnt",subjects.size());
        modelMap.addAttribute("teacherCnt",teachers.size());
        modelMap.addAttribute("courseCnt",courses.size());
        modelMap.addAttribute("studentCnt",students.size());
        modelMap.addAttribute("sectionCnt",sections.size());

        //2.班级学生数量
        List<Map<String,Object>> mapList = new ArrayList<>();
        for(Clazz clazz : clazzes) {
            Map<String,Object> map = new HashMap<>();
            map.put("name",clazz.getClazzName()); //设置班级名称
            int cnt = 0;
            //统计学生数量
            for(Student student : students) {
                if(student.getClazzId() == clazz.getId()) {
                    cnt++;
                }
            }
            map.put("cnt",cnt); //设置学生数量
            mapList.add(map);
        }
        modelMap.addAttribute("mapList",mapList);

        //3.查询各科平均成绩(根据专业查询各科平均成绩)
    //批量删除
    @PostMapping("/delete")
    @ResponseBody
    public Map<String, Object> delete(String ids) {
        int result = clazzService.delete(ids);
        if (result <= 0) {
            return MapControl.getInstance().error().getMap();
        }
        return MapControl.getInstance().success().getMap();
    }

    //修改
    @PostMapping("/update")
    @ResponseBody
    public Map<String, Object> update(@RequestBody Clazz clazz) {
        int result = clazzService.update(clazz);
        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) {
        //查询所有的专业
        List<Subject> subjects = subjectService.query(null);
        //查询出要修改的班级的信息
        Clazz clazz = clazzService.detail(id);
        //将查询出来的数据存储到request域,实现表单回显
        modelMap.addAttribute("clazz", clazz);
        modelMap.addAttribute("subjects", subjects);
        return UPDATE;
    }

    //查询所有
    @PostMapping("/query")
    @ResponseBody
    public Map<String, Object> query(@RequestBody Clazz clazz) {
        //查询所有的班级
                entity.setId(id);
                entity.setUserPwd(MD5Utils.getMD5(newPwd)); //主要要加密
                int result = userService.update(entity);
                if(result <= 0) {
                    return MapControl.getInstance().error().getMap();
                } else {
                    return MapControl.getInstance().success().getMap();
                }
            } else {
                return MapControl.getInstance().error("原密码错误").getMap();
            }
        }
        if("2".equals(type)) {
            Teacher teacher = teacherService.detail(id);
            //比较原密码
            if(teacher.getTeacherPwd().equals(MD5Utils.getMD5(sourcePwd))) {
                Teacher entity = new Teacher();
                entity.setId(id);
                entity.setTeacherPwd(MD5Utils.getMD5(newPwd));
                int result = teacherService.update(entity);
                if(result <= 0) {
                    return MapControl.getInstance().error().getMap();
                } else {
                    return MapControl.getInstance().success().getMap();
                }
            } else {
                return MapControl.getInstance().error("原密码错误").getMap();
            }
        }
        if("3".equals(type)) {
            Student student = studentService.detail(id);
            //比较原密码
            if(student.getStuPwd().equals(MD5Utils.getMD5(sourcePwd))) {
                Student entity = new Student();
                entity.setId(id);
                entity.setStuPwd(MD5Utils.getMD5(newPwd));
                int result = studentService.update(entity);
                if(result <= 0) {
                    return MapControl.getInstance().error().getMap();
                } else {
                    return MapControl.getInstance().success().getMap();
                }
            } else {
                return MapControl.getInstance().error("原密码错误").getMap();
            }
        }

        return MapControl.getInstance().error().getMap();

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值