From 729b1f0f3636f93ccb9fe517475bbb30e9573db7 Mon Sep 17 00:00:00 2001 From: xuan <255124139@qq.com> Date: Tue, 26 Oct 2021 18:02:08 +0800 Subject: [PATCH] =?UTF-8?q?chenXuanSheng2021.10.26,18:00=201,=E5=AE=8C?= =?UTF-8?q?=E5=96=84=E7=8F=AD=E4=B8=BB=E4=BB=BB=E6=9F=A5=E8=AF=A2=E6=95=99?= =?UTF-8?q?=E5=B8=88=E7=94=B3=E8=AF=B7=E5=8A=A0=E5=85=A5=E7=8F=AD=E7=BA=A7?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/TeacherClassApplyController.java | 13 +++++++++---- .../service/TeacherClassApplyService.java | 4 ++-- .../service/impl/TeacherClassApplyServiceImpl.java | 6 +++--- .../resources/mapper/TeacherClassApplyMapper.xml | 5 ++--- 4 files changed, 16 insertions(+), 12 deletions(-) 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 54ea6c2..cfc0c42 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 945689e..822a682 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 8f4c194..21748cf 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 f6a1ab9..142a601 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} -- Gitee