OwnerRoomRelServiceDaoImplMapper.xml 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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="ownerRoomRelServiceDaoImpl">
  6. <!-- 保存业主房屋信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveBusinessOwnerRoomRelInfo" parameterType="Map">
  8. insert into business_building_owner_room_rel(
  9. rel_id,operate,remark,state,owner_id,b_id,user_id,room_id
  10. ) values (
  11. #{relId},#{operate},#{remark},#{state},#{ownerId},#{bId},#{userId},#{roomId}
  12. )
  13. </insert>
  14. <!-- 查询业主房屋信息(Business) add by wuxw 2018-07-03 -->
  15. <select id="getBusinessOwnerRoomRelInfo" parameterType="Map" resultType="Map">
  16. select t.rel_id,t.rel_id relId,t.operate,t.remark,t.state,t.owner_id,t.owner_id ownerId,t.b_id,t.b_id
  17. bId,t.user_id,t.user_id userId,t.room_id,t.room_id roomId
  18. from business_building_owner_room_rel t
  19. where 1 =1
  20. <if test="relId !=null and relId != ''">
  21. and t.rel_id= #{relId}
  22. </if>
  23. <if test="operate !=null and operate != ''">
  24. and t.operate= #{operate}
  25. </if>
  26. <if test="remark !=null and remark != ''">
  27. and t.remark= #{remark}
  28. </if>
  29. <if test="state !=null and state != ''">
  30. and t.state= #{state}
  31. </if>
  32. <if test="ownerId !=null and ownerId != ''">
  33. and t.owner_id= #{ownerId}
  34. </if>
  35. <if test="bId !=null and bId != ''">
  36. and t.b_id= #{bId}
  37. </if>
  38. <if test="userId !=null and userId != ''">
  39. and t.user_id= #{userId}
  40. </if>
  41. <if test="roomId !=null and roomId != ''">
  42. and t.room_id= #{roomId}
  43. </if>
  44. </select>
  45. <!-- 保存业主房屋信息至 instance表中 add by wuxw 2018-07-03 -->
  46. <insert id="saveOwnerRoomRelInfoInstance" parameterType="Map">
  47. insert into building_owner_room_rel(
  48. rel_id,status_cd,remark,state,owner_id,b_id,user_id,room_id
  49. ) select t.rel_id,'0',t.remark,t.state,t.owner_id,t.b_id,t.user_id,t.room_id from
  50. business_building_owner_room_rel t where 1=1
  51. <if test="relId !=null and relId != ''">
  52. and t.rel_id= #{relId}
  53. </if>
  54. and t.operate= 'ADD'
  55. <if test="remark !=null and remark != ''">
  56. and t.remark= #{remark}
  57. </if>
  58. <if test="state !=null and state != ''">
  59. and t.state= #{state}
  60. </if>
  61. <if test="ownerId !=null and ownerId != ''">
  62. and t.owner_id= #{ownerId}
  63. </if>
  64. <if test="bId !=null and bId != ''">
  65. and t.b_id= #{bId}
  66. </if>
  67. <if test="userId !=null and userId != ''">
  68. and t.user_id= #{userId}
  69. </if>
  70. <if test="roomId !=null and roomId != ''">
  71. and t.room_id= #{roomId}
  72. </if>
  73. </insert>
  74. <!-- 查询业主房屋信息 add by wuxw 2018-07-03 -->
  75. <select id="getOwnerRoomRelInfo" parameterType="Map" resultType="Map">
  76. select t.rel_id,t.rel_id relId,t.status_cd,t.status_cd statusCd,t.remark,t.state,t.owner_id,t.owner_id
  77. ownerId,t.b_id,t.b_id bId,t.user_id,t.user_id userId,t.room_id,t.room_id roomId
  78. <if test="byOwnerInfo == true">
  79. ,bow.name ownerName,bow.id_card idCard,bow.link
  80. </if>
  81. from building_owner_room_rel t
  82. <if test="byOwnerInfo == true">
  83. ,building_owner bow
  84. </if>
  85. where 1 =1
  86. <if test="byOwnerInfo == true">
  87. and t.owner_id = bow.owner_id
  88. and bow.status_cd = '0'
  89. </if>
  90. <if test="byOwnerInfo == true and ownerName !=null and ownerName != ''">
  91. and bow.name like concat('%',#{ownerName},'%')
  92. </if>
  93. <if test="byOwnerInfo == true and idCard !=null and idCard != ''">
  94. and bow.id_card = #{idCard}
  95. </if>
  96. <if test="relId !=null and relId != ''">
  97. and t.rel_id= #{relId}
  98. </if>
  99. <if test="relId !=null and relId != ''">
  100. and t.rel_id= #{relId}
  101. </if>
  102. <if test="statusCd !=null and statusCd != ''">
  103. and t.status_cd= #{statusCd}
  104. </if>
  105. <if test="remark !=null and remark != ''">
  106. and t.remark= #{remark}
  107. </if>
  108. <if test="state !=null and state != ''">
  109. and t.state= #{state}
  110. </if>
  111. <if test="ownerId !=null and ownerId != ''">
  112. and t.owner_id= #{ownerId}
  113. </if>
  114. <if test="bId !=null and bId != ''">
  115. and t.b_id= #{bId}
  116. </if>
  117. <if test="userId !=null and userId != ''">
  118. and t.user_id= #{userId}
  119. </if>
  120. <if test="roomId !=null and roomId != ''">
  121. and t.room_id= #{roomId}
  122. </if>
  123. <if test="page != -1 and page != null ">
  124. limit #{page}, #{row}
  125. </if>
  126. </select>
  127. <!-- 修改业主房屋信息 add by wuxw 2018-07-03 -->
  128. <update id="updateOwnerRoomRelInfoInstance" parameterType="Map">
  129. update building_owner_room_rel t set t.status_cd = #{statusCd}
  130. <if test="newBId != null and newBId != ''">
  131. ,t.b_id = #{newBId}
  132. </if>
  133. <if test="remark !=null and remark != ''">
  134. , t.remark= #{remark}
  135. </if>
  136. <if test="state !=null and state != ''">
  137. , t.state= #{state}
  138. </if>
  139. <if test="ownerId !=null and ownerId != ''">
  140. , t.owner_id= #{ownerId}
  141. </if>
  142. <if test="userId !=null and userId != ''">
  143. , t.user_id= #{userId}
  144. </if>
  145. <if test="roomId !=null and roomId != ''">
  146. , t.room_id= #{roomId}
  147. </if>
  148. where 1=1
  149. <if test="relId !=null and relId != ''">
  150. and t.rel_id= #{relId}
  151. </if>
  152. <if test="bId !=null and bId != ''">
  153. and t.b_id= #{bId}
  154. </if>
  155. </update>
  156. <!-- 查询业主房屋数量 add by wuxw 2018-07-03 -->
  157. <select id="queryOwnerRoomRelsCount" parameterType="Map" resultType="Map">
  158. select count(1) count
  159. from building_owner_room_rel t
  160. <if test="byOwnerInfo == true">
  161. ,building_owner bow
  162. </if>
  163. where 1 =1
  164. <if test="byOwnerInfo == true">
  165. and t.owner_id = bow.owner_id
  166. and bow.status_cd = '0'
  167. </if>
  168. <if test="byOwnerInfo == true and ownerName !=null and ownerName != ''">
  169. and bow.name like concat('%',#{ownerName},'%')
  170. </if>
  171. <if test="byOwnerInfo == true and idCard !=null and idCard != ''">
  172. and bow.id_card = #{idCard}
  173. </if>
  174. <if test="relId !=null and relId != ''">
  175. and t.rel_id= #{relId}
  176. </if>
  177. <if test="statusCd !=null and statusCd != ''">
  178. and t.status_cd= #{statusCd}
  179. </if>
  180. <if test="remark !=null and remark != ''">
  181. and t.remark= #{remark}
  182. </if>
  183. <if test="state !=null and state != ''">
  184. and t.state= #{state}
  185. </if>
  186. <if test="ownerId !=null and ownerId != ''">
  187. and t.owner_id= #{ownerId}
  188. </if>
  189. <if test="bId !=null and bId != ''">
  190. and t.b_id= #{bId}
  191. </if>
  192. <if test="userId !=null and userId != ''">
  193. and t.user_id= #{userId}
  194. </if>
  195. <if test="roomId !=null and roomId != ''">
  196. and t.room_id= #{roomId}
  197. </if>
  198. </select>
  199. </mapper>