diff --git a/src/main/java/com/mobile_education_platform/controller/TeacherClassApplyController.java b/src/main/java/com/mobile_education_platform/controller/TeacherClassApplyController.java index 54ea6c2378ac56d786f1249684f930fe41526032..cfc0c42db5452c23bfb7e2f3774ce58eaf3d942d 100644 --- a/src/main/java/com/mobile_education_platform/controller/TeacherClassApplyController.java +++ b/src/main/java/com/mobile_education_platform/controller/TeacherClassApplyController.java @@ -71,14 +71,15 @@ public class TeacherClassApplyController { } - @GetMapping("/{tNumber}/{current}/{size}") + @GetMapping("/{tNumber}/{cId}/{current}/{size}") @ApiOperation("查询接口:“为班主任查询所有result字段为-1的字段”") @ApiImplicitParams({ @ApiImplicitParam(name = "tNumber",value = "当前使用教师的教师编号"), + @ApiImplicitParam(name = "cId",value = "该教师当前年所担任班主任的班级的班级id"), @ApiImplicitParam(name = "current", value = "跳转页", required = true), @ApiImplicitParam(name = "size", value = "每页数据量", required = true) }) - public R selectApply(@PathVariable String tNumber, @PathVariable Integer current, + public R selectApply(@PathVariable String tNumber,@PathVariable String cId, @PathVariable Integer current, @PathVariable Integer size){ Map map = new HashMap<>(); @@ -95,9 +96,13 @@ public class TeacherClassApplyController { } String tId = teacherService.byNumberSelectTeacher(tNumber).getId(); - Page page = teacherClassApplyService.selectApply(tId, current, size); + if (classService.whetherTheHeadTeacher(tId, cId) != 1){ + return R.error(500, "该编号所有者不是该班级的班主任"); + } + + Page page = teacherClassApplyService.selectApply(cId, current, size); if (page.getTotal() <= 0){ - return R.error(500, "查无数据,可能原因:1,该教师不属于班主任。2,该教师担任班主任的班级并没有新的教师申请加入"); + return R.error(500, "查无数据,可能原因:1,该教师担任班主任的班级并没有新的教师申请加入"); } map.put("result", page); diff --git a/src/main/java/com/mobile_education_platform/service/TeacherClassApplyService.java b/src/main/java/com/mobile_education_platform/service/TeacherClassApplyService.java index 945689e225e403e4a5d89b4a008c30ceb90c75c5..822a682ad5d50976d8bd3281b17ea8293135bd88 100644 --- a/src/main/java/com/mobile_education_platform/service/TeacherClassApplyService.java +++ b/src/main/java/com/mobile_education_platform/service/TeacherClassApplyService.java @@ -30,14 +30,14 @@ public interface TeacherClassApplyService extends IService { /** * @Description: 查询接口:“为班主任查询所有result字段为-1的字段” - * @param tId: 班级基本信息id + * @param cId: 登录教师当前年所担任班主任的班级的班级id * @param current: 跳转页 * @param size: 每页数据量 * @return: com.baomidou.mybatisplus.extension.plugins.pagination.Page * @Author: chenXuanSheng * @Date: 2021/10/26 7:50 */ - Page selectApply(String tId, Integer current, Integer size); + Page selectApply(String cId, Integer current, Integer size); /** diff --git a/src/main/java/com/mobile_education_platform/service/impl/TeacherClassApplyServiceImpl.java b/src/main/java/com/mobile_education_platform/service/impl/TeacherClassApplyServiceImpl.java index 8f4c19449d97842770ddbe3f592f74bb4ab74f99..21748cf8b3f3b7fcd94652f5a89c2d21ecdcc084 100644 --- a/src/main/java/com/mobile_education_platform/service/impl/TeacherClassApplyServiceImpl.java +++ b/src/main/java/com/mobile_education_platform/service/impl/TeacherClassApplyServiceImpl.java @@ -57,18 +57,18 @@ public class TeacherClassApplyServiceImpl extends ServiceImpl teacherClassApplyPage = new Page<>(current, size); QueryWrapper teacherClassApplyQueryWrapper = new QueryWrapper<>(); - teacherClassApplyQueryWrapper.eq("teacher.id", tId); + teacherClassApplyQueryWrapper.eq("teacher_class_apply.class_id", cId); teacherClassApplyQueryWrapper.eq("teacher_class_apply.result", -1); return baseMapper.selectApply(teacherClassApplyPage, teacherClassApplyQueryWrapper); diff --git a/src/main/resources/mapper/TeacherClassApplyMapper.xml b/src/main/resources/mapper/TeacherClassApplyMapper.xml index f6a1ab942bef78f15c725cea641e3f8738e167b9..142a601ea435289473fc59d1b656fbd194c2aaeb 100644 --- a/src/main/resources/mapper/TeacherClassApplyMapper.xml +++ b/src/main/resources/mapper/TeacherClassApplyMapper.xml @@ -8,9 +8,8 @@ teacher.name_PT as teacherNamePt,class.id as classId,class.name as className, teacher_class_apply.result - from (teacher inner join class on teacher.id = class.head_teacher_id) - - inner join teacher_class_apply on class.id = teacher_class_apply.class_id + from (teacher_class_apply inner join class on class.id = teacher_class_apply.class_id) + inner join teacher on teacher.id = teacher_class_apply.teacher_id ${ew.customSqlSegment}