OwnerRoomRelV1ServiceDaoImplMapper.xml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="ownerRoomRelV1ServiceDaoImpl">
  5. <!-- 保存业主房屋关系表信息 add by wuxw 2018-07-03 -->
  6. <insert id="saveOwnerRoomRelInfo" parameterType="Map">
  7. insert into building_owner_room_rel(rel_id, remark, start_time, state, end_time, owner_id, user_id, room_id)
  8. values (#{relId}, #{remark}, #{startTime}, #{state}, #{endTime}, #{ownerId}, #{userId}, #{roomId})
  9. </insert>
  10. <!-- 查询业主房屋关系表信息 add by wuxw 2018-07-03 -->
  11. <select id="getOwnerRoomRelInfo" parameterType="Map" resultType="Map">
  12. select t.rel_id,t.rel_id relId,t.remark,t.status_cd,t.status_cd statusCd,t.start_time,t.start_time
  13. startTime,t.state,t.end_time,t.end_time endTime,t.owner_id,t.owner_id ownerId,t.user_id,t.user_id
  14. userId,t.room_id,t.room_id roomId,bo.name ownerName,bo.link
  15. from building_owner_room_rel t
  16. inner join building_owner bo on t.owner_id = bo.member_id and bo.status_cd = '0'
  17. inner join building_room br on t.room_id = br.room_id and br.status_cd = '0'
  18. inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  19. inner join f_floor fl on bu.floor_id = fl.floor_id and fl.status_cd = '0'
  20. <if test="ownerNameLike !=null and ownerNameLike != ''">
  21. and bo.`name` like concat('%',#{ownerNameLike},'%')
  22. </if>
  23. <if test="relId !=null and relId != ''">
  24. and t.rel_id= #{relId}
  25. </if>
  26. <if test="remark !=null and remark != ''">
  27. and t.remark= #{remark}
  28. </if>
  29. <if test="statusCd !=null and statusCd != ''">
  30. and t.status_cd= #{statusCd}
  31. </if>
  32. <if test="startTime !=null and startTime != ''">
  33. and t.start_time= #{startTime}
  34. </if>
  35. <if test="state !=null and state != ''">
  36. and t.state= #{state}
  37. </if>
  38. <if test="endTime !=null and endTime != ''">
  39. and t.end_time= #{endTime}
  40. </if>
  41. <if test="ownerId !=null and ownerId != ''">
  42. and t.owner_id= #{ownerId}
  43. </if>
  44. <!--<if test="userId !=null and userId != ''">
  45. and t.user_id= #{userId}
  46. </if>-->
  47. <if test="roomId !=null and roomId != ''">
  48. and t.room_id= #{roomId}
  49. </if>
  50. <if test="roomIds != null">
  51. and t.room_id in
  52. <foreach collection="roomIds" item="item" open="(" close=")" separator=",">
  53. #{item}
  54. </foreach>
  55. </if>
  56. order by t.create_time desc
  57. <if test="page != -1 and page != null ">
  58. limit #{page}, #{row}
  59. </if>
  60. </select>
  61. <!-- 修改业主房屋关系表信息 add by wuxw 2018-07-03 -->
  62. <update id="updateOwnerRoomRelInfo" parameterType="Map">
  63. update building_owner_room_rel t set t.status_cd = #{statusCd}
  64. <if test="newBId != null and newBId != ''">
  65. ,t.b_id = #{newBId}
  66. </if>
  67. <if test="remark !=null and remark != ''">
  68. , t.remark= #{remark}
  69. </if>
  70. <if test="startTime !=null and startTime != ''">
  71. , t.start_time= #{startTime}
  72. </if>
  73. <if test="state !=null and state != ''">
  74. , t.state= #{state}
  75. </if>
  76. <if test="endTime !=null and endTime != ''">
  77. , t.end_time= #{endTime}
  78. </if>
  79. <if test="ownerId !=null and ownerId != ''">
  80. , t.owner_id= #{ownerId}
  81. </if>
  82. <if test="userId !=null and userId != ''">
  83. , t.user_id= #{userId}
  84. </if>
  85. <if test="roomId !=null and roomId != ''">
  86. , t.room_id= #{roomId}
  87. </if>
  88. where 1=1
  89. <if test="relId !=null and relId != ''">
  90. and t.rel_id= #{relId}
  91. </if>
  92. </update>
  93. <!-- 查询业主房屋关系表数量 add by wuxw 2018-07-03 -->
  94. <select id="queryOwnerRoomRelsCount" parameterType="Map" resultType="Map">
  95. select count(1) count
  96. from building_owner_room_rel t
  97. inner join building_owner bo on t.owner_id = bo.member_id and bo.status_cd = '0'
  98. inner join building_room br on t.room_id = br.room_id and br.status_cd = '0'
  99. inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  100. inner join f_floor fl on bu.floor_id = fl.floor_id and fl.status_cd = '0'
  101. where 1 =1
  102. <if test="relId !=null and relId != ''">
  103. and t.rel_id= #{relId}
  104. </if>
  105. <if test="remark !=null and remark != ''">
  106. and t.remark= #{remark}
  107. </if>
  108. <if test="statusCd !=null and statusCd != ''">
  109. and t.status_cd= #{statusCd}
  110. </if>
  111. <if test="startTime !=null and startTime != ''">
  112. and t.start_time= #{startTime}
  113. </if>
  114. <if test="state !=null and state != ''">
  115. and t.state= #{state}
  116. </if>
  117. <if test="endTime !=null and endTime != ''">
  118. and t.end_time= #{endTime}
  119. </if>
  120. <if test="ownerId !=null and ownerId != ''">
  121. and t.owner_id= #{ownerId}
  122. </if>
  123. <!--<if test="userId !=null and userId != ''">
  124. and t.user_id= #{userId}
  125. </if>-->
  126. <if test="roomId !=null and roomId != ''">
  127. and t.room_id= #{roomId}
  128. </if>
  129. <if test="roomIds != null">
  130. and t.room_id in
  131. <foreach collection="roomIds" item="item" open="(" close=")" separator=",">
  132. #{item}
  133. </foreach>
  134. </if>
  135. </select>
  136. <select id="queryRoomCountByOwnerIds" parameterType="Map" resultType="Map">
  137. select t.owner_id ownerId,count(1) roomCount
  138. from building_owner_room_rel t
  139. left join building_room br on br.room_id = t.room_id
  140. where t.status_cd = '0'
  141. and br.status_cd = '0'
  142. and t.owner_id in
  143. <foreach collection="ownerIds" item="item" open="(" close=")" separator=",">
  144. #{item}
  145. </foreach>
  146. and br.state != '2008'
  147. group by t.owner_id
  148. </select>
  149. </mapper>