百木园-与人分享,
就是让自己快乐。

Spring Boot 蓝天幼儿园管理系统,拿来练手真不错。。

项目介绍

蓝天幼儿园管理系统,共分为三种角色:

  • 管理员
  • 家长
  • 教师

管理员角色具有功能:

  • 系统管理:用户管理、页面管理、角色管理
  • 校园管理:老师管理、工资管理、物资管理、菜谱管理、班级管理
  • 班级管理:学生管理、公告管理、课程管理
  • 考勤管理:老师考勤、学生考勤、老师考勤统计、学生考勤统计、签到签退

技术栈

1、Springboot

Spring Boot 基础就不介绍了,推荐下这个实战教程:https://github.com/javastacks/spring-boot-best-practice

2、html+thymeleaf

环境需要

  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 8.0版本;

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
  2. 将项目中yml配置文件中的数据库配置改为自己的配置
  3. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,
  4. 运行项目,输入localhost:8081 登录
  5. 管理员账户admin 密码123456
  6. 教师账号wangjianlin 密码123456

代码

用户管理控制层:

@Controller
@RequestMapping(\"admin/system/user\")
public class UserController {

    @Autowired
    UserService userService;

    @Autowired
    RoleService roleService;

    @Autowired
    UploadService uploadService;

    @RequestMapping(\"list\")
    @SysLog(\"跳转系统用户列表页面\")
    public String list(){
        return \"admin/user/list\";
    }

    @RequiresPermissions(\"sys:user:list\")
    @PostMapping(\"list\")
    @ResponseBody
    public PageData<User> list(@RequestParam(value = \"page\",defaultValue = \"1\")Integer page,
                               @RequestParam(value = \"limit\",defaultValue = \"10\")Integer limit,
                               ServletRequest request){
        Map map = WebUtils.getParametersStartingWith(request, \"s_\");
        PageData<User> userPageData = new PageData<>();
        QueryWrapper<User> userWrapper = new QueryWrapper<>();
        if(!map.isEmpty()){
            String type = (String) map.get(\"type\");
            if(StringUtils.isNotBlank(type)) {
                userWrapper.eq(\"is_admin\", \"admin\".equals(type) ? true : false);
            }
            String keys = (String) map.get(\"key\");
            if(StringUtils.isNotBlank(keys)) {
                userWrapper.and(wrapper -> wrapper.like(\"login_name\", keys).or().like(\"tel\", keys).or().like(\"email\", keys));
            }
        }
        IPage<User> userPage = userService.page(new Page<>(page,limit),userWrapper);
        userPageData.setCount(userPage.getTotal());
        userPageData.setData(userPage.getRecords());
        return userPageData;
    }

    @RequestMapping(\"add\")
    public String add(ModelMap modelMap){
        List<Role> roleList = roleService.selectAll();
        modelMap.put(\"roleList\",roleList);
        return \"admin/user/add\";
    }

    @RequiresPermissions(\"sys:user:add\")
    @PostMapping(\"add\")
    @ResponseBody
    @SysLog(\"保存新增系统用户数据\")
    public ResponseEntity add(@RequestBody  User user){
        if(StringUtils.isBlank(user.getLoginName())){
            return ResponseEntity.failure(\"登录名不能为空\");
        }
        if(user.getRoleLists() == null || user.getRoleLists().size() == 0){
            return  ResponseEntity.failure(\"用户角色至少选择一个\");
        }
        if(userService.userCount(user.getLoginName())>0){
            return ResponseEntity.failure(\"登录名称已经存在\");
        }
//        if(StringUtils.isNotBlank(user.getEmail())){
//            if(userService.userCount(user.getEmail())>0){
//                return ResponseEntity.failure(\"该邮箱已被使用\");
//            }
//        }
//        if(StringUtils.isNoneBlank(user.getTel())){
//            if(userService.userCount(user.getTel())>0){
//                return ResponseEntity.failure(\"该手机号已被绑定\");
//            }
//        }
        //设置默认密码
        if(StringUtils.isBlank(user.getPassword())){
            user.setPassword(Constants.DEFAULT_PASSWORD);
        }
        userService.saveUser(user);
        if(StringUtils.isBlank(user.getId())){
            return ResponseEntity.failure(\"保存用户信息出错\");
        }
        //保存用户角色关系
        userService.saveUserRoles(user.getId(),user.getRoleLists());
        return ResponseEntity.success(\"操作成功\");
    }

    @RequestMapping(\"edit\")
    public String edit(String id,ModelMap modelMap){
        User user = userService.findUserById(id);
        String roleIds = \"\";
        if(user != null) {
            roleIds = user.getRoleLists().stream().map(role -> role.getId()).collect(Collectors.joining(\",\"));
        }
        List<Role> roleList = roleService.selectAll();
        modelMap.put(\"localuser\",user);
        modelMap.put(\"roleIds\",roleIds);
        modelMap.put(\"roleList\",roleList);
        return \"admin/user/edit\";
    }

    @RequiresPermissions(\"sys:user:edit\")
    @PostMapping(\"edit\")
    @ResponseBody
    @SysLog(\"保存系统用户编辑数据\")
    public ResponseEntity edit(@RequestBody  User user){
        if(StringUtils.isBlank(user.getId())){
            return ResponseEntity.failure(\"用户ID不能为空\");
        }
        if(StringUtils.isBlank(user.getLoginName())){
            return ResponseEntity.failure(\"登录名不能为空\");
        }
        if(user.getRoleLists() == null || user.getRoleLists().size() == 0){
            return  ResponseEntity.failure(\"用户角色至少选择一个\");
        }
        User oldUser = userService.findUserById(user.getId());
        if(StringUtils.isNotBlank(user.getEmail())){
            if(!user.getEmail().equals(oldUser.getEmail())){
                if(userService.userCount(user.getEmail())>0){
                    return ResponseEntity.failure(\"该邮箱已被使用\");
                }
            }
        }
        if(StringUtils.isNotBlank(user.getLoginName())){
            if(!user.getLoginName().equals(oldUser.getLoginName())) {
                if (userService.userCount(user.getLoginName()) > 0) {
                    return ResponseEntity.failure(\"该登录名已存在\");
                }
            }
        }
        if(StringUtils.isNotBlank(user.getTel())){
            if(!user.getTel().equals(oldUser.getTel())) {
                if (userService.userCount(user.getTel()) > 0) {
                    return ResponseEntity.failure(\"该手机号已经被绑定\");
                }
            }
        }
        user.setIcon(oldUser.getIcon());
        userService.updateUser(user);

        if(StringUtils.isBlank(user.getId())){
            return ResponseEntity.failure(\"保存用户信息出错\");
        }
        userService.saveUserRoles(user.getId(),user.getRoleLists());
        return ResponseEntity.success(\"操作成功\");
    }

    @RequiresPermissions(\"sys:user:lock\")
    @PostMapping(\"lock\")
    @ResponseBody
    @SysLog(\"锁定或开启系统用户\")
    public ResponseEntity lock(@RequestParam(value = \"id\",required = false)String id){
        if(StringUtils.isBlank(id)){
            return ResponseEntity.failure(\"参数错误\");
        }
        User user = userService.getById(id);
        if(user == null){
            return ResponseEntity.failure(\"用户不存在\");
        }
        userService.lockUser(user);
        return ResponseEntity.success(\"操作成功\");
    }

    @RequiresPermissions(\"sys:user:delete\")
    @PostMapping(\"delete\")
    @ResponseBody
    @SysLog(\"删除系统用户数据(单个)\")
    public ResponseEntity delete(@RequestParam(value = \"id\",required = false)String id){
        if(StringUtils.isBlank(id)){
            return ResponseEntity.failure(\"参数错误\");
        }
        User user = userService.getById(id);
        if(user == null){
            return ResponseEntity.failure(\"用户不存在\");
        }else if(user.getAdminUser()) {
            return ResponseEntity.failure(\"不能删除后台用户\");
        }
        userService.deleteUser(user);
        return ResponseEntity.success(\"操作成功\");
    }

    @RequiresPermissions(\"sys:user:delete\")
    @PostMapping(\"deleteSome\")
    @ResponseBody
    @SysLog(\"删除系统用户数据(多个)\")
    public ResponseEntity deleteSome(@RequestBody List<User> users){
        if(users == null || users.size()==0){
            return ResponseEntity.failure(\"请选择需要删除的用户\");
        }
        for (User u : users){
            if(u.getAdminUser()){
                return ResponseEntity.failure(\"不能删除超级管理员\");
            }else{
                userService.deleteUser(u);
            }
        }
        return ResponseEntity.success(\"操作成功\");
    }

    @RequestMapping(\"userinfo\")
    public String toEditMyInfo(ModelMap modelMap){
        String userId = MySysUser.id();
        User user = userService.findUserById(userId);
        modelMap.put(\"userinfo\",user);
        modelMap.put(\"userRole\",user.getRoleLists());
        return \"admin/user/userInfo\";
    }

    @SysLog(\"系统用户个人信息修改\")
    @PostMapping(\"saveUserinfo\")
    @ResponseBody
    public ResponseEntity saveUserInfo(User user){
        if(StringUtils.isBlank(user.getId())){
            return ResponseEntity.failure(\"用户ID不能为空\");
        }
        if(StringUtils.isBlank(user.getLoginName())){
            return ResponseEntity.failure(\"登录名不能为空\");
        }
        User oldUser = userService.findUserById(user.getId());
        if(StringUtils.isNotBlank(user.getEmail())){
            if(!user.getEmail().equals(oldUser.getEmail())){
                if(userService.userCount(user.getEmail())>0){
                    return ResponseEntity.failure(\"该邮箱已被使用\");
                }
            }
        }
        if(StringUtils.isNotBlank(user.getTel())){
            if(!user.getTel().equals(oldUser.getTel())) {
                if (userService.userCount(user.getTel()) > 0) {
                    return ResponseEntity.failure(\"该手机号已经被绑定\");
                }
            }
        }
        userService.updateById(user);
        return ResponseEntity.success(\"操作成功\");
    }

    @RequestMapping(\"changePassword\")
    public String changePassword(ModelMap modelMap){
        modelMap.put(\"currentUser\",userService.getById(MySysUser.id()));
        return \"admin/user/changePassword\";
    }
    @CrossOrigin
    @SysLog(\"用户修改密码\")
    @PostMapping(\"changePassword\")
    @ResponseBody
    public ResponseEntity changePassword(@RequestParam(value = \"userName\",required = false)String userName,
                                         @RequestParam(value = \"oldPwd\",required = false)String oldPwd,
                                       @RequestParam(value = \"newPwd\",required = false)String newPwd,
                                       @RequestParam(value = \"confirmPwd\",required = false)String confirmPwd){
        if(StringUtils.isBlank(oldPwd)){
            return ResponseEntity.failure(\"旧密码不能为空\");
        }
        if(StringUtils.isBlank(newPwd)){
            return ResponseEntity.failure(\"新密码不能为空\");
        }
        if(StringUtils.isBlank(confirmPwd)){
            return ResponseEntity.failure(\"确认密码不能为空\");
        }
        if(!confirmPwd.equals(newPwd)){
            return ResponseEntity.failure(\"确认密码与新密码不一致\");
        }
        //小程序修改密码
        if(StringUtils.isBlank(userName)){
            //PC修改密码
            User user = userService.findUserById(MySysUser.id());

            byte[] hashPassword = Encodes.sha1(oldPwd.getBytes(), Encodes.SHA1, Encodes.decodeHex(user.getSalt()), Constants.HASH_INTERATIONS);
            String password = Encodes.encodeHex(hashPassword);

            if(!user.getPassword().equals(password)){
                return ResponseEntity.failure(\"旧密码错误\");
            }
            user.setPassword(newPwd);
            Encodes.entryptPassword(user);
            userService.updateById(user);
            return ResponseEntity.success(\"操作成功\");
        }else {
            //小程序修改密码
            User user = userService.findUserByLoginName(userName);

            byte[] hashPassword = Encodes.sha1(oldPwd.getBytes(), Encodes.SHA1, Encodes.decodeHex(user.getSalt()), Constants.HASH_INTERATIONS);
            String password = Encodes.encodeHex(hashPassword);

            if(!user.getPassword().equals(password)){
                return ResponseEntity.failure(\"旧密码错误\");
            }
            user.setPassword(newPwd);
            Encodes.entryptPassword(user);
            userService.updateById(user);
            return ResponseEntity.success(\"操作成功\");
        }

    }

    @SysLog(\"上传头像\")
    @PostMapping(\"uploadFace\")
    @ResponseBody
    public ResponseEntity uploadFile(@RequestParam(\"icon\") MultipartFile file, HttpServletRequest httpServletRequest) {
        if(file == null){
            return ResponseEntity.failure(\"上传文件为空 \");
        }
        String url = null;
        Map map = new HashMap();
        try {
            url = uploadService.upload(file);
            map.put(\"url\", url);
            map.put(\"name\", file.getOriginalFilename());
        } catch (Exception e) {
            e.printStackTrace();
            return ResponseEntity.failure(e.getMessage());
        }
        return ResponseEntity.success(\"操作成功\").setAny(\"data\",map);
    }

}

老师管理控制层:

@Controller
public class TeacherController {
    @Autowired
    private TeacherService lxxTeacherService;
    @Autowired
    private StudentService lxxStudentService;
    @Autowired
    private DeleteService deleteService;

    // 跳转教师查询页面
    @RequestMapping(\"/selectTeacher\")
    public String selectTeacher(){
        return \"view/teacher/selTeacher\";
    }

    //  查询教师信息
    @RequestMapping(\"selTeacher\")
    @ResponseBody
    public LayuiResult<Map> selTeacher(TeacherDB teacherDB, pageCount pageCount){
        LayuiResult<Map> result = new LayuiResult<>();
        //  查询所有教师信息/模糊查询教师信息
        List<Map> list = lxxTeacherService.selTeacher(teacherDB,pageCount);
        //  查询符合条件的教师数量
        int count = lxxTeacherService.selTeacherCount(teacherDB);
        result.setData(list);
        result.setCount(count);
        return result;
    }

    //  根据教师编号查询教师信息
    @RequestMapping(\"/selTeacherId\")
    public String selTeacherId(Integer id, Model model){
        List<TeacherDB> tea = lxxTeacherService.selTeacherId(id);
        //  查询政治面貌
        List<PoliticsTypeDB> selpol = lxxStudentService.selPolitics();
        model.addAttribute(\"tea\",tea);
        model.addAttribute(\"selpol\",selpol);
        return \"view/teacher/updTeacher\";
    }

    //  根据教师编号查询教师详细信息
    @RequestMapping(\"/selectTeaMessage\")
    public String selectTeaMessage(Integer id, Model model){
        List<TeacherDB> tea = lxxTeacherService.selTeacherId(id);
        //  查询政治面貌
        List<PoliticsTypeDB> selpol = lxxStudentService.selPolitics();
        model.addAttribute(\"tea\",tea);
        model.addAttribute(\"selpol\",selpol);
        return \"view/teacher/selTchMessage\";
    }

    //  修改教师信息
    @RequestMapping(\"/updateTeacher\")
    @ResponseBody
    public LayuiResult<TeacherDB> updTeacher(TeacherDB teacherDB, String birthday) throws Exception{
        LayuiResult result= new LayuiResult();
        SimpleDateFormat format = new SimpleDateFormat(\"yyyy-MM-dd\");
        Date date=format.parse(birthday);
        teacherDB.setTbirthday(date);
        Integer state = teacherDB.getTchstate();
        Integer tid = teacherDB.getTid();
        if(state == 1){
            //  修改教师为离职状态并逻辑删除
            Integer deleteTeacher = deleteService.deleteTeacher(teacherDB);
            //  删除教师授课信息
            Integer deleteTchCourse = deleteService.deleteTchCourse(tid);
            //  删除教师班级信息
            Integer deleteTchClass = deleteService.deleteTchClass(tid);
            //  删除教师成绩信息
            Integer deleteTchExam = deleteService.deleteTchExam(tid);
            //  删除教评记录信息
            Integer deleteTeaRecord = deleteService.deleteTeaRecord(tid);
            //  改用户登录状态改为(1)锁定状态
            Integer deleteUser = deleteService.deleteUser(teacherDB.getTchid());
            //删除提示
            result.setMsg(\"修改成功!\");
            return result;
        }else{
            int a =lxxTeacherService.updTeacher(teacherDB);
            //删除提示
            result.setMsg(\"修改成功!\");
            return result;
        }
    }

}

学生管理控制层:

@Controller
public class StudentController extends BaseController {
    @Autowired
    private StudentService studentService;

    // 跳转学生查询页面
    @RequestMapping(\"/selectStudent\")
    public String selectStudent(){
        return \"view/student/selStudent\";
    }

    //  查询所有学生
    @RequestMapping(\"selStudent\")
    @ResponseBody
    public LayuiResult<Map> selectStu(pageCount pageCount, StudentVO studentVO){
        LayuiResult<Map> result = new LayuiResult<>();
        List<Map> list = studentService.selStudent(studentVO,pageCount);
        int count = studentService.selCount(studentVO);
        result.setData(list);
        result.setCount(count);
        return result;
    }

    //  查询所有专业
    @RequestMapping(\"selDepartment\")
    @ResponseBody
    public LayuiResult<Map> selDepartment(){
        List<DepartmentDB> selDepartment = studentService.selDepartment();
        LayuiResult result = new LayuiResult();
        result.setData(selDepartment);
        return result;
    }

    //  根据系部查询专业
    @RequestMapping(\"selectdid\")
    @ResponseBody
    public LayuiResult<Map> selMajorDB(Integer did){
        List<MajorDB> major  =studentService.selMajorDB(did);
        LayuiResult result = new LayuiResult();
        result.setData(major);
        return result;
    }
    //  根据专业查询年级
    @RequestMapping(\"selectmid\")
    @ResponseBody
    public LayuiResult<Map> selGradeDB(Integer mid){
        List<GradeDB> grade = studentService.selGradeDB(mid);
        LayuiResult result = new LayuiResult();
        result.setData(grade);
        return result;
    }

    //  根据年级查询班级
    @RequestMapping(\"selectgid\")
    @ResponseBody
    public LayuiResult<Map> selClassinfoDB(Integer gid){
        List<ClassinfoDB> classinfo = studentService.selClassinfoDB(gid);
        LayuiResult result = new LayuiResult();
        result.setData(classinfo);
        return result;
    }

    //  根据id查询一条学生信息以此进行修改
    @RequestMapping(\"/selStudentId\")
    public String selStudentId(Integer id, Model model){
        //  查询学生信息
        List<StudentDB> stu = studentService.selStudentId(id);
        //  查询班级
        List<ClassinfoDB> cls = studentService.selClass();
        //  查询政治面貌表
        List<PoliticsTypeDB> stupol = studentService.selPolitics();
        model.addAttribute(\"stu\",stu);
        model.addAttribute(\"cls\",cls);
        model.addAttribute(\"stupol\",stupol);
        return \"view/student/updStudent\";
    }

    //  根据id查询显示学生详细信息
    @RequestMapping(\"/selectMessage\")
    public String selectMessage(Integer id, Model model){
        //  查询学生信息
        List<StudentDB> stu = studentService.selStudentId(id);
        //  查询班级
        List<ClassinfoDB> cls = studentService.selClass();
        //  查询政治面貌表
        List<PoliticsTypeDB> stupol = studentService.selPolitics();
        model.addAttribute(\"stu\",stu);
        model.addAttribute(\"cls\",cls);
        model.addAttribute(\"stupol\",stupol);
        return \"view/student/selStuExam\";
    }

    //  修改用户信息
    @RequestMapping(\"/updateStudent\")
    @ResponseBody
    public LayuiResult<StudentDB> updateStudent(StudentDB studentDB, String birthday) throws Exception{
        SimpleDateFormat format = new SimpleDateFormat(\"yyyy-MM-dd\");
        Date date=format.parse(birthday);
        studentDB.setSbirthday(date);
        studentService.updateStudent(studentDB);
        LayuiResult result= new LayuiResult();
        //删除提示
        result.setMsg(\"修改成功!\");
        return result;
    }
}

校园管理控制层:

@Controller
@RequestMapping(\"schoolmanage\")
public class SchoolManageController extends BaseController {
    @Autowired
    private SchoolManageService schoolManageService;

    /**
     * 进入班级管理页面
     */
    @RequestMapping(\"classmanage\")
    public String classmanage() {
        return \"view/schoolmanage/classmanage\";
    }

    /**
     * 进入年级管理页面
     */
    @RequestMapping(\"grademanage\")
    public String grademanage() {
        return \"view/schoolmanage/grademanage\";
    }

    /**
     * 进入专业管理页面
     */
    @RequestMapping(\"majormanage\")
    public String majormanage() {
        return \"view/schoolmanage/majormanage\";
    }

    /**
     * 进入系部管理页面
     */
    @RequestMapping(\"dpmmanage\")
    public String dpmmanage() {
        return \"view/schoolmanage/dpmmanage\";
    }

    /*******************************************************************系部管理*********************************************************************/

    /**
     * 添加系部
     */
    @RequestMapping(\"addonedpm\")
    @ResponseBody
    public Object addOneDpm(DepartmentDB departmentDB) {
        int check = schoolManageService.checkOneDpm(departmentDB);
        if (check > 0) {
            return false;
        } else {
            int r = schoolManageService.addOneDpm(departmentDB);
            if (r == 1) {
                return true;
            } else {
                return false;
            }
        }

    }

    /**
     * 获取系部列表
     */
    @RequestMapping(\"findalldpm\")
    @ResponseBody
    public Object findAllDpm(SchoolManageVO schoolManageVO, Integer page, Integer limit) {
        PageHelper.startPage(page, limit);
        List<SchoolManageVO> listAll = schoolManageService.findAllDpm(schoolManageVO);
        PageInfo pageInfo = new PageInfo(listAll);
        Map<String, Object> dpmData = new HashMap<String, Object>();
        dpmData.put(\"code\", 0);
        dpmData.put(\"msg\", \"\");
        dpmData.put(\"count\", pageInfo.getTotal());
        dpmData.put(\"data\", pageInfo.getList());
        return dpmData;
    }

    /**
     * 编辑系部
     */
    @RequestMapping(\"editonedpm\")
    @ResponseBody
    public Object editOneDpm(DepartmentDB departmentDB) {
        int check = schoolManageService.checkOneDpm(departmentDB);
        if (check > 0) {
            return false;
        } else {
            int r = schoolManageService.editOneDpm(departmentDB);
            if (r == 1) {
                return true;
            } else {
                return false;
            }
        }
    }

    /*******************************************************************专业管理*********************************************************************/

    /**
     * 添加专业
     */
    @RequestMapping(\"addonemajor\")
    @ResponseBody
    public Object addOneMajor(MajorDB majorDB) {
        int check = schoolManageService.checkOneMajor(majorDB);
        if (check > 0) {
            return false;
        } else {
            int r = schoolManageService.addOneMajor(majorDB);
            if (r == 1) {
                return true;
            } else {
                return false;
            }
        }
    }

    /**
     * 获取专业列表
     */
    @RequestMapping(\"findallmajor\")
    @ResponseBody
    public Object findAllMajor(SchoolManageVO schoolManageVO, Integer page, Integer limit) {
        PageHelper.startPage(page, limit);
        List<SchoolManageVO> listAll = schoolManageService.findAllMajor(schoolManageVO);
        PageInfo pageInfo = new PageInfo(listAll);
        Map<String, Object> majorData = new HashMap<String, Object>();
        majorData.put(\"code\", 0);
        majorData.put(\"msg\", \"\");
        majorData.put(\"count\", pageInfo.getTotal());
        majorData.put(\"data\", pageInfo.getList());
        return majorData;
    }

    /**
     * 编辑专业
     */
    @RequestMapping(\"editonemajor\")
    @ResponseBody
    public Object editOneMajor(MajorDB majorDB) {
        int check = schoolManageService.checkOneMajor(majorDB);
        if (check > 0) {
            return false;
        } else {
            int r = schoolManageService.editOneMajor(majorDB);
            if (r == 1) {
                return true;
            } else {
                return false;
            }
        }
    }

    /*******************************************************************年级管理*********************************************************************/

    /**
     * 添加年级
     */
    @RequestMapping(\"addonegrade\")
    @ResponseBody
    public Object addOneGrade(GradeDB gradeDB) {
        int check = schoolManageService.checkOneGrade(gradeDB);
        if (check > 0) {
            return false;
        } else {
            int r = schoolManageService.addOneGrade(gradeDB);
            if (r == 1) {
                return true;
            } else {
                return false;
            }
        }
    }

    /**
     * 获取年级列表
     */
    @RequestMapping(\"findallgrade\")
    @ResponseBody
    public Object findAllGrade(SchoolManageVO schoolManageVO, Integer page, Integer limit) {
        PageHelper.startPage(page, limit);
        List<SchoolManageVO> listAll = schoolManageService.findAllGrade(schoolManageVO);
        PageInfo pageInfo = new PageInfo(listAll);
        Map<String, Object> gradeData = new HashMap<String, Object>();
        gradeData.put(\"code\", 0);
        gradeData.put(\"msg\", \"\");
        gradeData.put(\"count\", pageInfo.getTotal());
        gradeData.put(\"data\", pageInfo.getList());
        return gradeData;
    }

    /**
     * 级联获取专业列表
     */
    @RequestMapping(\"jlselmajor\")
    @ResponseBody
    public Object jlSelMajor(SchoolManageVO schoolManageVO, Integer page, Integer limit) {
        PageHelper.startPage(page, limit);
        List<SchoolManageVO> listAll = schoolManageService.jlSelMajor(schoolManageVO);
        PageInfo pageInfo = new PageInfo(listAll);
        Map<String, Object> jlmajorData = new HashMap<String, Object>();
        jlmajorData.put(\"code\", 0);
        jlmajorData.put(\"msg\", \"\");
        jlmajorData.put(\"count\", pageInfo.getTotal());
        jlmajorData.put(\"data\", pageInfo.getList());
        return jlmajorData;
    }

    /**
     * 编辑年级
     */
    @RequestMapping(\"editonegrade\")
    @ResponseBody
    public Object editOneGrade(GradeDB gradeDB) {
        int check = schoolManageService.checkOneGrade(gradeDB);
        if (check > 0) {
            return false;
        } else {
            int r = schoolManageService.editOneGrade(gradeDB);
            if (r == 1) {
                return true;
            } else {
                return false;
            }
        }
    }

/*******************************************************************年级管理*********************************************************************/

    /**
     * 添加班级
     */
    @RequestMapping(\"addoneclass\")
    @ResponseBody
    public Object addOneClass(ClassinfoDB classinfoDB) {
        int check = schoolManageService.checkOneClass(classinfoDB);
        if (check > 0) {
            return false;
        } else {
            int r = schoolManageService.addOneClass(classinfoDB);
            if (r == 1) {
                return true;
            } else {
                return false;
            }
        }
    }

    /**
     * 获取班级列表
     */
    @RequestMapping(\"findallclass\")
    @ResponseBody
    public Object findAllClass(SchoolManageVO schoolManageVO, Integer page, Integer limit) {
        PageHelper.startPage(page, limit);
        List<SchoolManageVO> listAll = schoolManageService.findAllClass(schoolManageVO);
        PageInfo pageInfo = new PageInfo(listAll);
        Map<String, Object> classData = new HashMap<String, Object>();
        classData.put(\"code\", 0);
        classData.put(\"msg\", \"\");
        classData.put(\"count\", pageInfo.getTotal());
        classData.put(\"data\", pageInfo.getList());
        return classData;
    }

    /**
     * 级联获取年级列表
     */
    @RequestMapping(\"jlselgrade\")
    @ResponseBody
    public Object jlSelGrade(SchoolManageVO schoolManageVO, Integer page, Integer limit) {
        PageHelper.startPage(page, limit);
        List<SchoolManageVO> listAll = schoolManageService.jlSelGrade(schoolManageVO);
        PageInfo pageInfo = new PageInfo(listAll);
        Map<String, Object> jlgradeData = new HashMap<String, Object>();
        jlgradeData.put(\"code\", 0);
        jlgradeData.put(\"msg\", \"\");
        jlgradeData.put(\"count\", pageInfo.getTotal());
        jlgradeData.put(\"data\", pageInfo.getList());
        return jlgradeData;
    }

    /**
     * 编辑班级
     */
    @RequestMapping(\"editoneclass\")
    @ResponseBody
    public Object editOneClass(ClassinfoDB classinfoDB) {
        int check = schoolManageService.checkOneClass(classinfoDB);
        if (check > 0) {
            return false;
        } else {
            int r = schoolManageService.editOneClass(classinfoDB);
            if (r == 1) {
                return true;
            } else {
                return false;
            }
        }
    }

/*******************************************************************条件查询*********************************************************************/

    /**
     * 条件查询班级
     */
    @RequestMapping(\"tjselclass\")
    @ResponseBody
    public Object tjSelClass(SchoolManageVO schoolManageVO, Integer page, Integer limit) {
        PageHelper.startPage(page, limit);
        List<SchoolManageVO> listAll = schoolManageService.tjSelClass(schoolManageVO);
        PageInfo pageInfo = new PageInfo(listAll);
        Map<String, Object> classData = new HashMap<String, Object>();
        classData.put(\"code\", 0);
        classData.put(\"msg\", \"\");
        classData.put(\"count\", pageInfo.getTotal());
        classData.put(\"data\", pageInfo.getList());
        return classData;
    }

    /**
     * 条件查询系部
     */
    @RequestMapping(\"tjseldpm\")
    @ResponseBody
    public Object tjSelDpm(SchoolManageVO schoolManageVO, Integer page, Integer limit) {
        PageHelper.startPage(page, limit);
        List<SchoolManageVO> listAll = schoolManageService.tjSelDpm(schoolManageVO);
        PageInfo pageInfo = new PageInfo(listAll);
        Map<String, Object> dpmData = new HashMap<String, Object>();
        dpmData.put(\"code\", 0);
        dpmData.put(\"msg\", \"\");
        dpmData.put(\"count\", pageInfo.getTotal());
        dpmData.put(\"data\", pageInfo.getList());
        return dpmData;
    }

    /**
     * 条件查询专业
     */
    @RequestMapping(\"tjselmajor\")
    @ResponseBody
    public Object tjSelMajor(SchoolManageVO schoolManageVO, Integer page, Integer limit) {
        PageHelper.startPage(page, limit);
        List<SchoolManageVO> listAll = schoolManageService.tjSelMajor(schoolManageVO);
        PageInfo pageInfo = new PageInfo(listAll);
        Map<String, Object> majorData = new HashMap<String, Object>();
        majorData.put(\"code\", 0);
        majorData.put(\"msg\", \"\");
        majorData.put(\"count\", pageInfo.getTotal());
        majorData.put(\"data\", pageInfo.getList());
        return majorData;
    }

    /**
     * 条件查询年级
     */
    @RequestMapping(\"tjselgrade\")
    @ResponseBody
    public Object tjSelGrade(SchoolManageVO schoolManageVO, Integer page, Integer limit) {
        PageHelper.startPage(page, limit);
        List<SchoolManageVO> listAll = schoolManageService.tjSelGrade(schoolManageVO);
        PageInfo pageInfo = new PageInfo(listAll);
        Map<String, Object> gradeData = new HashMap<String, Object>();
        gradeData.put(\"code\", 0);
        gradeData.put(\"msg\", \"\");
        gradeData.put(\"count\", pageInfo.getTotal());
        gradeData.put(\"data\", pageInfo.getList());
        return gradeData;
    }

}

来源:https://blog.csdn.net/biyesheji250/article/details/120609186

近期热文推荐:

1.1,000+ 道 Java面试题及答案整理(2022最新版)

2.劲爆!Java 协程要来了。。。

3.Spring Boot 2.x 教程,太全了!

4.别再写满屏的爆爆爆炸类了,试试装饰器模式,这才是优雅的方式!!

5.《Java开发手册(嵩山版)》最新发布,速速下载!

觉得不错,别忘了随手点赞+转发哦!


来源:https://www.cnblogs.com/javastack/p/16266082.html
本站部分图文来源于网络,如有侵权请联系删除。

未经允许不得转载:百木园 » Spring Boot 蓝天幼儿园管理系统,拿来练手真不错。。

相关推荐

  • 暂无文章