|
|
@@ -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}
|