RoomBedMapper.xml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  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.RoomBedMapper">
  6. <select id="getPage" parameterType="com.xjrsoft.module.room.dto.RoomBedPageDto" resultType="com.xjrsoft.module.room.vo.RoomBedPageVo">
  7. 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,
  8. t4.mobile,t9.name as gender_cn,t7.name AS grade_name,t8.name AS class_name FROM room_bed t1
  9. LEFT JOIN room t2 ON t1.room_id = t2.id
  10. LEFT JOIN base_office_build t3 ON t2.office_build_id = t3.id
  11. LEFT JOIN xjr_user t4 ON t1.student_user_id = t4.id
  12. LEFT JOIN base_student t5 ON t1.student_user_id = t5.user_id
  13. LEFT JOIN base_student_school_roll t6 ON t1.student_user_id = t6.user_id
  14. LEFT JOIN base_grade t7 ON t6.grade_id = t7.id
  15. LEFT JOIN base_class t8 ON t6.class_id = t8.id
  16. LEFT JOIN xjr_dictionary_detail t9 ON t2.gender = t9.code AND t9.item_id = 2023000000000000004
  17. where t1.delete_mark = 0 and t2.delete_mark = 0
  18. <if test="dto.officeBuildId != null">
  19. and t2.office_build_id = #{dto.officeBuildId}
  20. </if>
  21. <if test="dto.floorNumber != null">
  22. and t2.floor_number = #{dto.floorNumber}
  23. </if>
  24. <if test="dto.roomId != null">
  25. and t2.room_id = #{dto.roomId}
  26. </if>
  27. <if test="dto.gender != null and dto.gender != ''">
  28. and t2.gender = #{dto.gender}
  29. </if>
  30. <if test="dto.gradeId != null">
  31. and t7.id = #{dto.gradeId}
  32. </if>
  33. <if test="dto.classId != null">
  34. and t8.id = #{dto.classId}
  35. </if>
  36. <if test="dto.studentName != null">
  37. and t4.name like concat('%',#{dto.studentName},'%')
  38. </if>
  39. <if test="dto.studentId != null">
  40. and t5.student_id like concat('%',#{dto.studentId},'%')
  41. </if>
  42. <if test="dto.identity != null and dto.identity != ''">
  43. and t2.check_in_status like concat('%',#{dto.identity},'%')
  44. </if>
  45. ORDER BY t1.sort_code
  46. </select>
  47. <select id="getList" parameterType="com.xjrsoft.module.room.dto.RoomBedPageDto" resultType="com.xjrsoft.module.room.vo.RoomBedExcelVo">
  48. SELECT 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,
  49. t4.mobile,t9.name as gender_cn,t7.name AS grade_name,t8.name AS class_name FROM room_bed t1
  50. LEFT JOIN room t2 ON t1.room_id = t2.id
  51. LEFT JOIN base_office_build t3 ON t2.office_build_id = t3.id
  52. LEFT JOIN xjr_user t4 ON t1.student_user_id = t4.id
  53. LEFT JOIN base_student t5 ON t1.student_user_id = t5.user_id
  54. LEFT JOIN base_student_school_roll t6 ON t1.student_user_id = t6.user_id
  55. LEFT JOIN base_grade t7 ON t6.grade_id = t7.id
  56. LEFT JOIN base_class t8 ON t6.class_id = t8.id
  57. LEFT JOIN xjr_dictionary_detail t9 ON t2.gender = t9.code AND t9.item_id = 2023000000000000004
  58. where t1.delete_mark = 0 and t2.delete_mark = 0
  59. <if test="dto.officeBuildId != null">
  60. and t2.office_build_id = #{dto.officeBuildId}
  61. </if>
  62. <if test="dto.floorNumber != null">
  63. and t2.floor_number = #{dto.floorNumber}
  64. </if>
  65. <if test="dto.roomId != null">
  66. and t2.room_id = #{dto.roomId}
  67. </if>
  68. <if test="dto.gender != null and dto.gender != ''">
  69. and t2.gender = #{dto.gender}
  70. </if>
  71. <if test="dto.gradeId != null">
  72. and t7.id = #{dto.gradeId}
  73. </if>
  74. <if test="dto.classId != null">
  75. and t8.id = #{dto.classId}
  76. </if>
  77. <if test="dto.studentName != null">
  78. and t4.name like concat('%',#{dto.studentName},'%')
  79. </if>
  80. <if test="dto.studentId != null">
  81. and t5.student_id like concat('%',#{dto.studentId},'%')
  82. </if>
  83. <if test="dto.identity != null and dto.identity != ''">
  84. and t2.check_in_status like concat('%',#{dto.identity},'%')
  85. </if>
  86. ORDER BY t1.sort_code
  87. </select>
  88. <select id="getMaxSortCode" resultType="java.lang.Integer">
  89. SELECT IFNULL(MAX(sort_code),0) FROM room_bed WHERE delete_mark = 0
  90. </select>
  91. <select id="getDistributeClassInfo" parameterType="com.xjrsoft.module.room.dto.DistributeClassPageDto" resultType="com.xjrsoft.module.room.vo.DistributeClassPageVo">
  92. SELECT t1.id,t2.name AS grade_name,t3.name AS org_name,t1.name AS class_name,
  93. (SELECT COUNT(*) FROM base_student c1
  94. LEFT JOIN base_student_school_roll c2 ON c1.user_id = c2.user_id
  95. LEFT JOIN xjr_dictionary_detail c3 ON c2.stduy_status = c3.code AND c3.item_id = 2023000000000000030
  96. left join xjr_user c4 on c1.user_id = c4.id
  97. WHERE c1.delete_mark = 0 AND c2.delete_mark = 0
  98. AND c3.code = 'FB3002' AND c2.class_id = t1.id
  99. AND c2.archives_status = 'FB2901'
  100. <if test="dto.gender != null">
  101. and c4.gender = #{dto.gender}
  102. </if>
  103. ) AS need_count,
  104. (
  105. SELECT COUNT(*) FROM room_bed a1
  106. LEFT JOIN base_student_school_roll a2 ON a1.student_user_id = a2.user_id
  107. left join xjr_user c4 on a2.user_id = c4.id
  108. WHERE a1.delete_mark = 0 AND a2.delete_mark = 0
  109. AND a2.class_id = t1.id
  110. <if test="dto.gender != null">
  111. and c4.gender = #{dto.gender}
  112. </if>
  113. ) AS distribute_count FROM base_class t1
  114. LEFT JOIN base_grade t2 ON t1.grade_id = t2.id
  115. LEFT JOIN xjr_department t3 ON t1.org_id = t3.id
  116. WHERE t1.delete_mark = 0
  117. and (
  118. SELECT COUNT(*) FROM base_student c1
  119. LEFT JOIN base_student_school_roll c2 ON c1.user_id = c2.user_id
  120. LEFT JOIN xjr_dictionary_detail c3 ON c2.stduy_status = c3.code AND c3.item_id = 2023000000000000030
  121. left join xjr_user c4 on c4.id = c1.user_id
  122. WHERE c1.delete_mark = 0 AND c2.delete_mark = 0
  123. AND c3.code = 'FB3002' AND c2.class_id = t1.id
  124. AND c2.archives_status = 'FB2901'
  125. <if test="dto.gender != null">
  126. and c4.gender = #{dto.gender}
  127. </if>
  128. ) >
  129. (
  130. SELECT COUNT(*) FROM room_bed a1
  131. LEFT JOIN base_student_school_roll a2 ON a1.student_user_id = a2.user_id
  132. left join room a3 on a3.id = a1.room_id
  133. WHERE a1.delete_mark = 0 AND a2.delete_mark = 0
  134. AND a2.class_id = t1.id
  135. <if test="dto.gender != null">
  136. and a3.gender = #{dto.gender}
  137. </if>
  138. )
  139. <if test="dto.gradeId != null">
  140. and t1.grade_id = #{dto.gradeId}
  141. </if>
  142. <if test="dto.classId != null">
  143. and t1.id = #{dto.classId}
  144. </if>
  145. </select>
  146. <!--查询分配床位班级列表的各个人数 - 开始 -->
  147. <!-- 查询班上需要住宿的人数 -->
  148. <select id="getAllStayCount" resultType="com.xjrsoft.module.room.vo.ClassStudentCountVo">
  149. SELECT t1.id as class_id,COUNT(*) as student_count FROM base_class t1
  150. LEFT JOIN base_student_school_roll t2 ON t1.id = t2.class_id
  151. LEFT JOIN xjr_user t3 ON t2.user_id = t3.id
  152. WHERE t1.delete_mark = 0
  153. AND t2.delete_mark = 0 AND t3.delete_mark = 0
  154. AND t2.archives_status = 'FB2901'
  155. AND t2.stduy_status = 'FB3002' GROUP BY t1.id
  156. </select>
  157. <!-- 需要安排的男生总人数 -->
  158. <select id="getAllStayMaleCount" resultType="com.xjrsoft.module.room.vo.ClassStudentCountVo">
  159. SELECT t1.id as class_id,COUNT(*) as student_count FROM base_class t1
  160. LEFT JOIN base_student_school_roll t2 ON t1.id = t2.class_id
  161. LEFT JOIN xjr_user t3 ON t2.user_id = t3.id
  162. WHERE t1.delete_mark = 0
  163. AND t2.delete_mark = 0 AND t3.delete_mark = 0
  164. AND t3.gender = 'SB10001'
  165. AND t2.archives_status = 'FB2901'
  166. AND t2.stduy_status = 'FB3002' GROUP BY t1.id
  167. </select>
  168. <!-- 需要安排的女生总人数 -->
  169. <select id="getAllStayFemaleCount" resultType="com.xjrsoft.module.room.vo.ClassStudentCountVo">
  170. SELECT t1.id as class_id,COUNT(*) as student_count FROM base_class t1
  171. LEFT JOIN base_student_school_roll t2 ON t1.id = t2.class_id
  172. LEFT JOIN xjr_user t3 ON t2.user_id = t3.id
  173. WHERE t1.delete_mark = 0
  174. AND t2.delete_mark = 0 AND t3.delete_mark = 0
  175. AND t3.gender = 'SB10002'
  176. AND t2.archives_status = 'FB2901'
  177. AND t2.stduy_status = 'FB3002' GROUP BY t1.id
  178. </select>
  179. <!-- 已分配的总人数 -->
  180. <select id="getAllArrangedCount" resultType="com.xjrsoft.module.room.vo.ClassStudentCountVo">
  181. SELECT a1.id as class_id,COUNT(*) as student_count FROM base_class a1
  182. LEFT JOIN base_student_school_roll a2 ON a1.id = a2.class_id
  183. LEFT JOIN room_bed a3 ON a2.user_id = a3.student_user_id
  184. LEFT JOIN xjr_user a4 ON a3.student_user_id = a4.id
  185. WHERE a1.delete_mark = 0 AND a2.delete_mark = 0
  186. AND a4.delete_mark = 0
  187. GROUP BY a1.id
  188. </select>
  189. <!-- 已分配的男生人数 -->
  190. <select id="getAllArrangedMaleCount" resultType="com.xjrsoft.module.room.vo.ClassStudentCountVo">
  191. SELECT a1.id as class_id,COUNT(*) as student_count FROM base_class a1
  192. LEFT JOIN base_student_school_roll a2 ON a1.id = a2.class_id
  193. LEFT JOIN room_bed a3 ON a2.user_id = a3.student_user_id
  194. LEFT JOIN xjr_user a4 ON a3.student_user_id = a4.id AND a4.gender = 'SB10001'
  195. WHERE a1.delete_mark = 0 AND a2.delete_mark = 0
  196. AND a4.delete_mark = 0
  197. GROUP BY a1.id
  198. </select>
  199. <!-- 已分配的女生人数 -->
  200. <select id="getAllArrangedFemaleCount" resultType="com.xjrsoft.module.room.vo.ClassStudentCountVo">
  201. SELECT a1.id as class_id,COUNT(*) as student_count FROM base_class a1
  202. LEFT JOIN base_student_school_roll a2 ON a1.id = a2.class_id
  203. LEFT JOIN room_bed a3 ON a2.user_id = a3.student_user_id
  204. LEFT JOIN xjr_user a4 ON a3.student_user_id = a4.id AND a4.gender = 'SB10002'
  205. WHERE a1.delete_mark = 0 AND a2.delete_mark = 0
  206. AND a4.delete_mark = 0
  207. GROUP BY a1.id
  208. </select>
  209. <!--查询分配床位班级列表的各个人数 - 结束 -->
  210. <select id="getDistributeRoomBedInfo" parameterType="com.xjrsoft.module.room.dto.DistributeRoomBedPageDto" resultType="com.xjrsoft.module.room.vo.DistributeRoomBedPageVo">
  211. SELECT t1.id,t1.sort_code,t2.name AS build_name,t1.floor_number,t1.room_name,t4.name AS gender_cn, t3.name AS check_in_status_cn,
  212. t1.bed_count,(
  213. SELECT COUNT(*) FROM room_bed
  214. WHERE delete_mark = 0 AND room_id = t1.id
  215. AND student_user_id IS NOT NULL
  216. ) AS into_count,(
  217. SELECT GROUP_CONCAT(DISTINCT(c3.name)) FROM room_bed c1
  218. LEFT JOIN base_student_school_roll c2 ON c1.student_user_id = c2.user_id
  219. LEFT JOIN base_class c3 ON c2.class_id = c3.id
  220. WHERE c1.delete_mark = 0 AND c1.room_id = t1.id
  221. AND c1.student_user_id IS NOT NULL
  222. ) AS into_class FROM room t1
  223. LEFT JOIN base_office_build t2 ON t1.office_build_id = t2.id
  224. LEFT JOIN xjr_dictionary_detail t3 ON t1.check_in_status = t3.code AND t3.item_id = 1739843696019435521
  225. LEFT JOIN xjr_dictionary_detail t4 ON t1.gender = t4.code AND t4.item_id = 2023000000000000004
  226. WHERE t1.delete_mark = 0
  227. and
  228. (
  229. SELECT COUNT(*) FROM room_bed
  230. WHERE delete_mark = 0 AND room_id = t1.id
  231. AND student_user_id IS NOT NULL
  232. ) != t1.bed_count
  233. <if test="dto.gender != null and dto.gender != ''">
  234. and t1.gender = #{dto.gender}
  235. </if>
  236. <if test="dto.officeBuildId != null">
  237. and t2.id = #{dto.officeBuildId}
  238. </if>
  239. <if test="dto.floorNumber != null">
  240. and t1.floor_number = #{dto.floorNumber}
  241. </if>
  242. <if test="dto.checkInStatus != null and dto.checkInStatus !=''">
  243. and t1.check_in_status = #{dto.checkInStatus}
  244. </if>
  245. <if test="dto.roomName != null and dto.roomName !=''">
  246. and t1.room_name like concat('%',#{dto.roomName},'%')
  247. </if>
  248. ORDER BY t1.sort_code
  249. </select>
  250. <select id="getBedInfo" resultType="com.xjrsoft.module.room.vo.RoomBedVo">
  251. SELECT t1.* FROM room_bed t1
  252. LEFT JOIN room t2 ON t1.room_id = t2.id
  253. WHERE t1.delete_mark = 0 AND t1.room_id IN
  254. <foreach item="roomId" index="index" collection="ids" open="(" close=")" separator=",">
  255. #{roomId}
  256. </foreach>
  257. ORDER BY t2.sort_code,t1.sort_code
  258. </select>
  259. <select id="getDistributeResult" parameterType="com.xjrsoft.module.room.dto.DistributeRoomBedDto" resultType="com.xjrsoft.module.room.vo.DistributeResultListVo">
  260. SELECT t5.class_id,t4.name,t6.name AS gender_cn,t3.name AS build_name,t2.room_name,t1.bed_number FROM room_bed t1
  261. LEFT JOIN room t2 ON t1.room_id = t2.id
  262. LEFT JOIN base_office_build t3 ON t2.office_build_id = t3.id
  263. LEFT JOIN xjr_user t4 ON t1.student_user_id = t4.id
  264. LEFT JOIN base_student_school_roll t5 ON t5.user_id = t4.id
  265. LEFT JOIN xjr_dictionary_detail t6 ON t2.gender = t6.code AND t6.item_id = 2023000000000000004
  266. WHERE t1.student_user_id IS NOT NULL AND t1.delete_mark = 0
  267. AND t1.room_id IN
  268. <foreach item="roomId" index="index" collection="dto.roomIds" open="(" close=")" separator=",">
  269. #{roomId}
  270. </foreach>
  271. AND t5.class_id IN
  272. <foreach item="classId" index="index" collection="dto.classIds" open="(" close=")" separator=",">
  273. #{classId}
  274. </foreach>
  275. ORDER BY t2.sort_code,t1.sort_code
  276. </select>
  277. <select id="getClassStudetBed" parameterType="com.xjrsoft.module.room.dto.AdjustClassPageDto" resultType="com.xjrsoft.module.room.vo.AdjustBedClassStudentPageVo">
  278. SELECT t1.user_id,t4.id AS class_id, t4.name AS class_name,t2.name AS student_name,
  279. REPLACE(REPLACE(t2.gender,'SB10001','男'),'SB10002','女') AS gender_cn,t7.name AS build_name,t6.room_name,t5.bed_number,
  280. (t8.factrecarmny >= t8.factar) AS pay_status FROM base_student t1
  281. LEFT JOIN xjr_user t2 ON t1.user_id = t2.id
  282. LEFT JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
  283. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  284. LEFT JOIN room_bed t5 ON t5.student_user_id = t1.user_id
  285. LEFT JOIN room t6 ON t5.room_id = t6.id
  286. LEFT JOIN base_office_build t7 ON t6.office_build_id = t7.id
  287. INNER JOIN pb_v_xsxxsfytb t8 ON t2.credential_number = t8.Studentcode
  288. WHERE t1.delete_mark = 0 AND t2.delete_mark = 0
  289. AND t3.stduy_status = 'FB3002'
  290. AND t3.archives_status = 'FB2901'
  291. <if test="dto.gradeId != null">
  292. and t4.grade_id = #{dto.gradeId}
  293. </if>
  294. <if test="dto.classId != null">
  295. and t4.id = #{dto.classId}
  296. </if>
  297. <if test="dto.gender != null and dto.gender != ''">
  298. and t2.gender = #{dto.gender}
  299. </if>
  300. <if test="dto.isDistribute != null">
  301. <if test="dto.isDistribute == 1">
  302. and t5.student_user_id is not null
  303. </if>
  304. <if test="dto.isDistribute == 0">
  305. and t5.student_user_id is null
  306. </if>
  307. </if>
  308. <if test="dto.studentName != null and dto.studentName != ''">
  309. and t2.name like concat('%', #{dto.studentName}, '%')
  310. </if>
  311. <if test="dto.payStatus != null">
  312. and (t8.factrecarmny >= t8.factar) = #{dto.payStatus}
  313. </if>
  314. </select>
  315. <select id="getBedStudentInfo" parameterType="com.xjrsoft.module.room.dto.AdjustBedPageDto" resultType="com.xjrsoft.module.room.vo.AdjustBedStudentPageVo">
  316. SELECT t1.id,t3.name AS build_name,t2.room_name,t5.name AS gender_cn,t1.bed_number,t4.name AS student_name,
  317. t4.id as student_user_id,t2.is_max,t2.id as room_id,t8.name as class_name,t9.name as grade_name,t10.id as teacher_id,t10.name as teacher_name FROM room_bed t1
  318. LEFT JOIN room t2 ON t1.room_id = t2.id
  319. LEFT JOIN base_office_build t3 ON t2.office_build_id = t3.id
  320. LEFT JOIN xjr_user t4 ON t1.student_user_id = t4.id
  321. LEFT JOIN xjr_dictionary_detail t5 ON t2.gender = t5.code AND t5.item_id = 2023000000000000004
  322. LEFT JOIN base_student_school_roll t7 ON t4.id = t7.user_id
  323. left join base_class t8 on t7.class_id = t8.id
  324. LEFT JOIN base_grade t9 ON t7.grade_id = t9.id
  325. left join xjr_user t10 on t8.teacher_id = t10.id
  326. WHERE t1.delete_mark = 0 AND t2.delete_mark = 0
  327. <if test="dto.isEmptyRoom != null">
  328. <if test="dto.isEmptyRoom == 1">
  329. and t2.bed_count = (SELECT COUNT(*) FROM room_bed WHERE delete_mark = 0 AND student_user_id IS NULL AND is_check_in = 0 AND room_id = t2.id)
  330. </if>
  331. <if test="dto.isEmptyRoom == 0">
  332. and t2.bed_count != (SELECT COUNT(*) FROM room_bed WHERE delete_mark = 0 AND student_user_id IS NULL AND is_check_in = 0 AND room_id = t2.id)
  333. </if>
  334. </if>
  335. <if test="dto.roomName != null">
  336. and t2.room_name like concat('%', #{dto.roomName}, '%')
  337. </if>
  338. <if test="dto.gender != null and dto.gender != ''">
  339. and t2.gender = #{dto.gender}
  340. </if>
  341. <if test="dto.isMax != null">
  342. and t2.is_max = #{dto.isMax}
  343. </if>
  344. <if test="dto.floorNumber != null">
  345. and t2.floor_number = #{dto.floorNumber}
  346. </if>
  347. <if test="dto.floorNumber != null">
  348. and t2.floor_number = #{dto.floorNumber}
  349. </if>
  350. <if test="dto.classId != null">
  351. AND t2.id IN (
  352. SELECT DISTINCT c1.room_id FROM room_bed c1
  353. INNER JOIN base_student_school_roll c2 ON c1.student_user_id = c2.user_id
  354. WHERE c2.class_id = #{dto.classId}
  355. )
  356. </if>
  357. <if test="dto.buildId != null">
  358. and t3.id = #{dto.buildId}
  359. </if>
  360. <if test="dto.roomId != null">
  361. and t2.id = #{dto.roomId}
  362. </if>
  363. ORDER BY t2.sort_code,t1.sort_code
  364. </select>
  365. <select id="getNoBedStudent" parameterType="com.xjrsoft.module.room.dto.AdjustBedPageDto" resultType="com.xjrsoft.module.room.vo.NoBedStudentPageVo">
  366. SELECT t1.user_id, t2.name AS student_name,REPLACE(REPLACE(t2.gender,'SB10001','男'),'SB10002','女') as gender_cn,t4.name AS class_name FROM base_student t1
  367. INNER JOIN xjr_user t2 ON t1.user_id = t2.id
  368. LEFT JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
  369. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  370. WHERE t1.delete_mark = 0 AND t2.delete_mark = 0
  371. AND t3.stduy_status = 'FB3001'
  372. AND t2.archives_status = 'FB2901'
  373. AND t1.user_id NOT IN (
  374. SELECT student_user_id FROM room_bed WHERE delete_mark = 0 AND student_user_id IS NOT NULL
  375. )
  376. </select>
  377. <select id="getBedInfoByUserId" resultType="com.xjrsoft.module.room.vo.RoomBedInfoVo">
  378. SELECT t3.name as build_name,t2.room_name,t1.bed_number,t1.id FROM room_bed t1
  379. LEFT JOIN room t2 ON t1.room_id = t2.id
  380. LEFT JOIN base_office_build t3 ON t2.office_build_id = t3.id
  381. WHERE t3.build_type = 'FB3604'
  382. AND t1.student_user_id = #{id}
  383. </select>
  384. <select id="getStudentPayStatus" parameterType="com.xjrsoft.module.room.dto.DistributeRoomBedDto" resultType="com.xjrsoft.module.room.vo.StudentPayStatusVo">
  385. SELECT DISTINCT t1.id,(t3.factrecarmny >= t3.factar) AS pay_status FROM xjr_user t1
  386. INNER JOIN base_student t2 ON t1.id = t2.user_id
  387. INNER JOIN pb_v_xsxxsfytb t3 ON t1.credential_number = t3.Studentcode
  388. INNER JOIN base_student_school_roll t4 ON t1.id = t4.user_id
  389. WHERE t1.delete_mark = 0 and t4.stduy_status = 'FB3002' AND t3.feeitemcode = 103042766003001
  390. <if test="dto.classIds != null">
  391. and t4.class_id in
  392. <foreach item="classId" index="index" collection="dto.classIds" open="(" close=")" separator=",">
  393. #{classId}
  394. </foreach>
  395. </if>
  396. </select>
  397. <select id="getClassTeacherInfo" parameterType="com.xjrsoft.module.room.dto.AdjustClassPageDto" resultType="com.xjrsoft.module.room.vo.AdjustBedClassPageVo">
  398. SELECT t1.id,t1.name,t2.id AS teacher_id, t2.name AS teacher_name FROM base_class t1
  399. LEFT JOIN xjr_user t2 ON t1.teacher_id = t2.id
  400. WHERE t1.delete_mark = 0
  401. <if test="dto.gradeId != null">
  402. and t1.grade_id = #{dto.gradeId}
  403. </if>
  404. <if test="dto.classId != null">
  405. and t1.id = #{dto.classId}
  406. </if>
  407. </select>
  408. <select id="getRoomNameByStudentUserId" resultType="java.lang.String">
  409. SELECT t1.room_name FROM room t1
  410. INNER JOIN room_bed t2 ON t1.id = t2.room_id
  411. WHERE t1.delete_mark = 0 AND t1.delete_mark = 0
  412. AND t2.student_user_id = #{id}
  413. </select>
  414. </mapper>