Browse Source

解决 分配床位寝室床位列表 报错

dzx 1 year ago
parent
commit
b487da9923
1 changed files with 37 additions and 0 deletions
  1. 37 0
      src/main/resources/mapper/room/RoomTeacherAppointMapper.xml

+ 37 - 0
src/main/resources/mapper/room/RoomTeacherAppointMapper.xml

@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.xjrsoft.module.room.mapper.RoomTeacherAppointMapper">
+    <select id="getPage" parameterType="com.xjrsoft.module.room.dto.RoomTeacherAppointPageDto" resultType="com.xjrsoft.module.room.vo.RoomTeacherAppointPageVo">
+        SELECT t1.id,t1.sort_code,t2.name AS build_name,t1.floor_number,t1.room_name,t3.name AS gender_cn,
+        (
+        SELECT GROUP_CONCAT(c2.name) FROM room_teacher_appoint c1
+        LEFT JOIN xjr_user c2 ON c1.user_id = c2.id
+        WHERE c1.delete_mark = 0 AND c1.room_id = t1.id
+        ) AS appoint_users FROM room t1
+        LEFT JOIN base_office_build t2 ON t1.office_build_id = t2.id
+        LEFT JOIN xjr_dictionary_detail t3 ON t1.gender = t3.code AND t3.item_id = 2023000000000000004
+        WHERE t1.delete_mark = 0
+        <if test="dto.officeBuildId != null">
+            and t1.office_build_id = #{dto.officeBuildId}
+        </if>
+        <if test="dto.floorNumber != null">
+            and t1.floor_number = #{dto.floorNumber}
+        </if>
+        <if test="dto.roomName != null and dto.roomName != ''">
+            and t1.room_name like concat('%', #{dto.checkInStatus},'%')
+        </if>
+        <if test="dto.gender != null and dto.gender != ''">
+            and t1.gender = #{dto.gender}
+        </if>
+        <if test="dto.userId != null">
+            and t1.id in (
+            SELECT DISTINCT c1.room_id FROM room_teacher_appoint c1
+            LEFT JOIN xjr_user c2 ON c1.user_id = c2.id
+            WHERE c1.delete_mark = 0 AND c2.id = #{dto.userId}
+            )
+        </if>
+        ORDER BY t1.sort_code
+    </select>
+</mapper>