RoomTeacherAppointMapper.xml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.xjrsoft.module.room.mapper.RoomTeacherAppointMapper">
  6. <select id="getPage" parameterType="com.xjrsoft.module.room.dto.RoomTeacherAppointPageDto" resultType="com.xjrsoft.module.room.vo.RoomTeacherAppointPageVo">
  7. SELECT t1.id,t1.sort_code,t2.name AS build_name,t1.floor_number,t1.room_name,t3.name AS gender_cn,
  8. (
  9. SELECT GROUP_CONCAT(c2.name) FROM room_teacher_appoint c1
  10. LEFT JOIN xjr_user c2 ON c1.user_id = c2.id
  11. WHERE c1.delete_mark = 0 AND c1.room_id = t1.id
  12. ) AS appoint_users FROM room t1
  13. LEFT JOIN base_office_build t2 ON t1.office_build_id = t2.id
  14. LEFT JOIN xjr_dictionary_detail t3 ON t1.gender = t3.code AND t3.item_id = 2023000000000000004
  15. WHERE t1.delete_mark = 0
  16. <if test="dto.officeBuildId != null">
  17. and t1.office_build_id = #{dto.officeBuildId}
  18. </if>
  19. <if test="dto.floorNumber != null">
  20. and t1.floor_number = #{dto.floorNumber}
  21. </if>
  22. <if test="dto.roomName != null and dto.roomName != ''">
  23. and t1.room_name like concat('%', #{dto.checkInStatus},'%')
  24. </if>
  25. <if test="dto.gender != null and dto.gender != ''">
  26. and t1.gender = #{dto.gender}
  27. </if>
  28. <if test="dto.userId != null">
  29. and t1.id in (
  30. SELECT DISTINCT c1.room_id FROM room_teacher_appoint c1
  31. LEFT JOIN xjr_user c2 ON c1.user_id = c2.id
  32. WHERE c1.delete_mark = 0 AND c2.id = #{dto.userId}
  33. )
  34. </if>
  35. <if test="dto.identity != null and dto.identity != ''">
  36. and t1.check_in_status like concat('%',#{dto.identity},'%')
  37. </if>
  38. ORDER BY t1.sort_code
  39. </select>
  40. </mapper>