فهرست منبع

班主任可查询空床位寝室

dzx 9 ماه پیش
والد
کامیت
284496b244

+ 1 - 1
src/main/java/com/xjrsoft/module/room/controller/RoomBedAdjustController.java

@@ -94,7 +94,7 @@ public class RoomBedAdjustController {
             if(classList != null && !classList.isEmpty()){
                 dto.setClassId(classList.get(0).getId());
             }
-            //dto.setIsTeacher(1);
+            dto.setIsTeacher(1);
         }
         List<AdjustBedStudentPageVo> result = roomBedService.getBedStudetInfo(dto);
         if (result == null) {

+ 2 - 0
src/main/java/com/xjrsoft/module/room/dto/AdjustBedPageDto.java

@@ -1,5 +1,6 @@
 package com.xjrsoft.module.room.dto;
 
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.xjrsoft.common.page.PageInput;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -40,6 +41,7 @@ public class AdjustBedPageDto extends PageInput {
     @ApiModelProperty("寝室id")
     public Long roomId;
 
+    @JsonIgnore
     @ApiModelProperty("是否是班主任(1:是,0:否)")
     public Integer isTeacher;
 

+ 12 - 3
src/main/resources/mapper/room/RoomBedMapper.xml

@@ -335,7 +335,7 @@
         LEFT JOIN base_grade t9 ON t7.grade_id = t9.id
         left join xjr_user t10 on t8.teacher_id = t10.id
         WHERE t1.delete_mark = 0 AND t2.delete_mark = 0
-        <if test="dto.isEmptyRoom != null">
+        <if test="dto.isTeacher == null and dto.isEmptyRoom != null">
             <if test="dto.isEmptyRoom == 1">
                 and t2.bed_count = (SELECT COUNT(*) FROM room_bed WHERE delete_mark = 0 AND student_user_id IS NULL AND room_id = t2.id)
             </if>
@@ -358,12 +358,21 @@
         <if test="dto.floorNumber != null">
             and t2.floor_number = #{dto.floorNumber}
         </if>
-        <if test="dto.classId != null">
-            AND t2.id IN (
+        <if test="dto.classId != null and dto.isTeacher != null and dto.isTeacher == 1">
+            AND (t2.id IN (
             SELECT DISTINCT c1.room_id FROM room_bed c1
             INNER JOIN base_student_school_roll c2 ON c1.student_user_id = c2.user_id
             WHERE c2.class_id = #{dto.classId}
             )
+            <if test="dto.isEmptyRoom != null">
+                <if test="dto.isEmptyRoom == 1">
+                    or t2.bed_count = (SELECT COUNT(*) FROM room_bed WHERE delete_mark = 0 AND student_user_id IS NULL AND room_id = t2.id)
+                </if>
+                <if test="dto.isEmptyRoom == 0">
+                    or t2.bed_count != (SELECT COUNT(*) FROM room_bed WHERE delete_mark = 0 AND student_user_id IS NULL AND room_id = t2.id)
+                </if>
+            </if>
+            )
         </if>
         <if test="dto.buildId != null">
             and t3.id = #{dto.buildId}