|
@@ -44,6 +44,49 @@
|
|
|
</if>
|
|
|
ORDER BY t1.sort_code
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="getList" parameterType="com.xjrsoft.module.room.dto.RoomBedPageDto" resultType="com.xjrsoft.module.room.vo.RoomBedPageVo">
|
|
|
+ SELECT t1.id,t1.sort_code,t3.name AS build_name,t2.floor_number,t2.room_name,t1.bed_number,t4.name AS student_name,t5.student_id,
|
|
|
+ t4.mobile,t9.name as gender_cn,t7.name AS grade_name,t8.name AS class_name FROM room_bed t1
|
|
|
+ LEFT JOIN room t2 ON t1.room_id = t2.id
|
|
|
+ LEFT JOIN base_office_build t3 ON t2.office_build_id = t3.id
|
|
|
+ LEFT JOIN xjr_user t4 ON t1.student_user_id = t4.id
|
|
|
+ LEFT JOIN base_student t5 ON t1.student_user_id = t5.user_id
|
|
|
+ LEFT JOIN base_student_school_roll t6 ON t1.student_user_id = t6.user_id
|
|
|
+ LEFT JOIN base_grade t7 ON t6.grade_id = t7.id
|
|
|
+ LEFT JOIN base_class t8 ON t6.class_id = t8.id
|
|
|
+ LEFT JOIN xjr_dictionary_detail t9 ON t2.gender = t9.code AND t9.item_id = 2023000000000000004
|
|
|
+ where t1.delete_mark = 0 and t2.delete_mark = 0
|
|
|
+ <if test="dto.officeBuildId != null">
|
|
|
+ and t2.office_build_id = #{dto.officeBuildId}
|
|
|
+ </if>
|
|
|
+ <if test="dto.floorNumber != null">
|
|
|
+ and t2.floor_number = #{dto.floorNumber}
|
|
|
+ </if>
|
|
|
+ <if test="dto.roomId != null">
|
|
|
+ and t2.room_id = #{dto.roomId}
|
|
|
+ </if>
|
|
|
+ <if test="dto.gender != null and dto.gender != ''">
|
|
|
+ and t2.gender = #{dto.gender}
|
|
|
+ </if>
|
|
|
+ <if test="dto.gradeId != null">
|
|
|
+ and t7.id = #{dto.gradeId}
|
|
|
+ </if>
|
|
|
+ <if test="dto.classId != null">
|
|
|
+ and t8.id = #{dto.classId}
|
|
|
+ </if>
|
|
|
+ <if test="dto.studentName != null">
|
|
|
+ and t4.name like concat('%',#{dto.studentName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="dto.studentId != null">
|
|
|
+ and t5.student_id like concat('%',#{dto.studentId},'%')
|
|
|
+ </if>
|
|
|
+ <if test="dto.identity != null and dto.identity != ''">
|
|
|
+ and t2.check_in_status like concat('%',#{dto.identity},'%')
|
|
|
+ </if>
|
|
|
+ ORDER BY t1.sort_code
|
|
|
+ </select>
|
|
|
+
|
|
|
<select id="getMaxSortCode" resultType="java.lang.Integer">
|
|
|
SELECT IFNULL(MAX(sort_code),0) FROM room_bed WHERE delete_mark = 0
|
|
|
</select>
|
|
@@ -65,24 +108,6 @@
|
|
|
</if>
|
|
|
</if>
|
|
|
) AS need_count,
|
|
|
- (
|
|
|
- SELECT COUNT(*) FROM base_student c1
|
|
|
- LEFT JOIN base_student_school_roll c2 ON c1.user_id = c2.user_id
|
|
|
- LEFT JOIN xjr_dictionary_detail c3 ON c2.stduy_status = c3.code AND c3.item_id = 2023000000000000030
|
|
|
- left join xjr_user c4 on c1.user_id = c4.id
|
|
|
- WHERE c1.delete_mark = 0 AND c2.delete_mark = 0
|
|
|
- AND c3.code = 'FB3002' AND c2.class_id = t1.id
|
|
|
- and c4.gender = 1
|
|
|
- ) as male_count,
|
|
|
- (
|
|
|
- SELECT COUNT(*) FROM base_student c1
|
|
|
- LEFT JOIN base_student_school_roll c2 ON c1.user_id = c2.user_id
|
|
|
- LEFT JOIN xjr_dictionary_detail c3 ON c2.stduy_status = c3.code AND c3.item_id = 2023000000000000030
|
|
|
- left join xjr_user c4 on c1.user_id = c4.id
|
|
|
- WHERE c1.delete_mark = 0 AND c2.delete_mark = 0
|
|
|
- AND c3.code = 'FB3002' AND c2.class_id = t1.id
|
|
|
- and c4.gender = 2
|
|
|
- ) as female_count,
|
|
|
(
|
|
|
SELECT COUNT(*) FROM room_bed a1
|
|
|
LEFT JOIN base_student_school_roll a2 ON a1.student_user_id = a2.user_id
|
|
@@ -105,14 +130,27 @@
|
|
|
SELECT COUNT(*) FROM base_student c1
|
|
|
LEFT JOIN base_student_school_roll c2 ON c1.user_id = c2.user_id
|
|
|
LEFT JOIN xjr_dictionary_detail c3 ON c2.stduy_status = c3.code AND c3.item_id = 2023000000000000030
|
|
|
+ left join xjr_user c4 on c4.id = c1.user_id
|
|
|
WHERE c1.delete_mark = 0 AND c2.delete_mark = 0
|
|
|
AND c3.code = 'FB3002' AND c2.class_id = t1.id
|
|
|
+ <if test="dto.gender != null">
|
|
|
+ <if test="dto.gender == 'SB10001'">
|
|
|
+ and c4.gender = 1
|
|
|
+ </if>
|
|
|
+ <if test="dto.gender == 'SB10002'">
|
|
|
+ and c4.gender = 2
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
) >
|
|
|
(
|
|
|
SELECT COUNT(*) FROM room_bed a1
|
|
|
LEFT JOIN base_student_school_roll a2 ON a1.student_user_id = a2.user_id
|
|
|
+ left join room a3 on a3.id = a1.room_id
|
|
|
WHERE a1.delete_mark = 0 AND a2.delete_mark = 0
|
|
|
AND a2.class_id = t1.id
|
|
|
+ <if test="dto.gender != null">
|
|
|
+ and a3.gender = #{dto.gender}
|
|
|
+ </if>
|
|
|
)
|
|
|
<if test="dto.gradeId != null">
|
|
|
and t1.grade_id = #{dto.gradeId}
|