/** * 班级数据 * * @param gradeVo * @return */ @RequestMapping("/maintainer/grade/gradeData") @ResponseBody public AjaxData<GradeVo> gradeData(GradeVo gradeVo) { AjaxData<GradeVo> ajaxData = new AjaxData<>(); // 通过用户类型获取系表ID Record record = usersService.findAll(usersService.getUserName()); int tieId = 0; if (!ObjectUtils.isEmpty(record)) { tieId = record.getValue(Tables.TIE.ID); } List<GradeVo> gradeVos = new ArrayList<>(); if (tieId > 0) { Result<Record7<Integer, String, Integer, String, String, String, String>> record7s = gradeService.findAllByPage(gradeVo, tieId); if (record7s.isNotEmpty()) { gradeVos = record7s.into(GradeVo.class); PaginationData paginationData = new PaginationData(); paginationData.setPageNum(gradeVo.getPageNum()); paginationData.setPageSize(gradeVo.getPageSize()); paginationData.setTotalDatas(gradeService.findAllByPageCount(gradeVo, tieId)); ajaxData.success().listData(gradeVos).paginationData(paginationData); } else { ajaxData.fail().listData(gradeVos); } } else { ajaxData.fail().listData(gradeVos); } return ajaxData; }
/** * 班级主任自动完成数据 * * @param search * @return */ @RequestMapping("/maintainer/grade/gradeHead") @ResponseBody public List<AutoCompleteData> gradeHead(String search) { List<AutoCompleteData> autoCompleteDatas = new ArrayList<>(); // 通过用户类型获取系表ID Record record = usersService.findAll(usersService.getUserName()); int tieId = 0; if (!ObjectUtils.isEmpty(record)) { tieId = record.getValue(Tables.TIE.ID); } Result<Record4<Integer, Integer, String, String>> teachers = teacherService.findByTieIdAndTeacherName(search, tieId); if (teachers.isNotEmpty()) { teachers.forEach( teacherRecord -> { AutoCompleteData data = new AutoCompleteData(); data.setValue(teacherRecord.getValue(Tables.TEACHER.TEACHER_JOB_NUMBER)); data.setTitle(teacherRecord.getValue(Tables.USERS.REAL_NAME)); data.setUrl("#"); data.setText("账号:" + teacherRecord.getValue(Tables.TEACHER.TEACHER_JOB_NUMBER)); autoCompleteDatas.add(data); }); } return autoCompleteDatas; }
/** * 班级管理界面 * * @param modelMap * @return */ @RequestMapping("/maintainer/grade/gradeManager") public String gradeManager(ModelMap modelMap, GradeVo gradeVo) { // 通过用户类型获取系表ID Record record = usersService.findAll(usersService.getUserName()); int tieId = 0; if (!ObjectUtils.isEmpty(record)) { tieId = record.getValue(Tables.TIE.ID); } List<Major> majors = majorService.findByTieId(tieId); modelMap.addAttribute("majorNames", majors); modelMap.addAttribute("gradeVo", gradeVo); return "/maintainer/grade/gradelist"; }