Explorar el Código

学生考勤,班主任只能查看本班的

dzx hace 5 meses
padre
commit
c98d467b01

+ 11 - 0
src/main/java/com/xjrsoft/module/attendance/controller/StudentStatisticsController.java

@@ -185,6 +185,17 @@ public class StudentStatisticsController {
     @ApiOperation(value="学生考勤")
     @SaCheckPermission("statistics:detail")
     public RT<PageOutput<StudentStatisticsPageVo>> studentDetails(@Valid StudentDetailsDto dto){
+        List<String> roleList = StpUtil.getRoleList();
+        long teacherId = StpUtil.getLoginIdAsLong();
+        List<BaseClass> classList = baseClassService.list(
+                new QueryWrapper<BaseClass>().lambda().eq(BaseClass::getTeacherId, teacherId)
+        );
+        if(roleList.size() == 2 && roleList.contains("CLASSTE") && roleList.contains("TEACHER")){
+            if(classList != null && !classList.isEmpty()){
+                dto.setClassId(classList.get(0).getId());
+            }
+        }
+
         MPJLambdaWrapper<User> queryUser = new MPJLambdaWrapper<>();
         queryUser.disableSubLogicDel().distinct()
                 .like(StrUtil.isNotEmpty(dto.getName()), User::getName, dto.getName())