OwnerRoomRelServiceDaoImplMapper.xml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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 bId,t.user_id,t.user_id userId,t.room_id,t.room_id roomId
  17. from business_building_owner_room_rel t
  18. where 1 =1
  19. <if test="relId !=null and relId != ''">
  20. and t.rel_id= #{relId}
  21. </if>
  22. <if test="operate !=null and operate != ''">
  23. and t.operate= #{operate}
  24. </if>
  25. <if test="remark !=null and remark != ''">
  26. and t.remark= #{remark}
  27. </if>
  28. <if test="state !=null and state != ''">
  29. and t.state= #{state}
  30. </if>
  31. <if test="ownerId !=null and ownerId != ''">
  32. and t.owner_id= #{ownerId}
  33. </if>
  34. <if test="bId !=null and bId != ''">
  35. and t.b_id= #{bId}
  36. </if>
  37. <if test="userId !=null and userId != ''">
  38. and t.user_id= #{userId}
  39. </if>
  40. <if test="roomId !=null and roomId != ''">
  41. and t.room_id= #{roomId}
  42. </if>
  43. </select>
  44. <!-- 保存业主房屋信息至 instance表中 add by wuxw 2018-07-03 -->
  45. <insert id="saveOwnerRoomRelInfoInstance" parameterType="Map">
  46. insert into building_owner_room_rel(
  47. rel_id,status_cd,remark,state,owner_id,b_id,user_id,room_id
  48. ) select t.rel_id,'0',t.remark,t.state,t.owner_id,t.b_id,t.user_id,t.room_id from business_building_owner_room_rel t where 1=1
  49. <if test="relId !=null and relId != ''">
  50. and t.rel_id= #{relId}
  51. </if>
  52. and t.operate= 'ADD'
  53. <if test="remark !=null and remark != ''">
  54. and t.remark= #{remark}
  55. </if>
  56. <if test="state !=null and state != ''">
  57. and t.state= #{state}
  58. </if>
  59. <if test="ownerId !=null and ownerId != ''">
  60. and t.owner_id= #{ownerId}
  61. </if>
  62. <if test="bId !=null and bId != ''">
  63. and t.b_id= #{bId}
  64. </if>
  65. <if test="userId !=null and userId != ''">
  66. and t.user_id= #{userId}
  67. </if>
  68. <if test="roomId !=null and roomId != ''">
  69. and t.room_id= #{roomId}
  70. </if>
  71. </insert>
  72. <!-- 查询业主房屋信息 add by wuxw 2018-07-03 -->
  73. <select id="getOwnerRoomRelInfo" parameterType="Map" resultType="Map">
  74. 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 ownerId,t.b_id,t.b_id bId,t.user_id,t.user_id userId,t.room_id,t.room_id roomId
  75. from building_owner_room_rel t
  76. where 1 =1
  77. <if test="relId !=null and relId != ''">
  78. and t.rel_id= #{relId}
  79. </if>
  80. <if test="statusCd !=null and statusCd != ''">
  81. and t.status_cd= #{statusCd}
  82. </if>
  83. <if test="remark !=null and remark != ''">
  84. and t.remark= #{remark}
  85. </if>
  86. <if test="state !=null and state != ''">
  87. and t.state= #{state}
  88. </if>
  89. <if test="ownerId !=null and ownerId != ''">
  90. and t.owner_id= #{ownerId}
  91. </if>
  92. <if test="bId !=null and bId != ''">
  93. and t.b_id= #{bId}
  94. </if>
  95. <if test="userId !=null and userId != ''">
  96. and t.user_id= #{userId}
  97. </if>
  98. <if test="roomId !=null and roomId != ''">
  99. and t.room_id= #{roomId}
  100. </if>
  101. <if test="page != -1 and page != null ">
  102. limit #{page}, #{row}
  103. </if>
  104. </select>
  105. <!-- 修改业主房屋信息 add by wuxw 2018-07-03 -->
  106. <update id="updateOwnerRoomRelInfoInstance" parameterType="Map">
  107. update building_owner_room_rel t set t.status_cd = #{statusCd}
  108. <if test="newBId != null and newBId != ''">
  109. ,t.b_id = #{newBId}
  110. </if>
  111. <if test="remark !=null and remark != ''">
  112. , t.remark= #{remark}
  113. </if>
  114. <if test="state !=null and state != ''">
  115. , t.state= #{state}
  116. </if>
  117. <if test="ownerId !=null and ownerId != ''">
  118. , t.owner_id= #{ownerId}
  119. </if>
  120. <if test="userId !=null and userId != ''">
  121. , t.user_id= #{userId}
  122. </if>
  123. <if test="roomId !=null and roomId != ''">
  124. , t.room_id= #{roomId}
  125. </if>
  126. where 1=1 <if test="relId !=null and relId != ''">
  127. and t.rel_id= #{relId}
  128. </if>
  129. <if test="bId !=null and bId != ''">
  130. and t.b_id= #{bId}
  131. </if>
  132. </update>
  133. <!-- 查询业主房屋数量 add by wuxw 2018-07-03 -->
  134. <select id="queryOwnerRoomRelsCount" parameterType="Map" resultType="Map">
  135. select count(1) count
  136. from building_owner_room_rel t
  137. where 1 =1
  138. <if test="relId !=null and relId != ''">
  139. and t.rel_id= #{relId}
  140. </if>
  141. <if test="statusCd !=null and statusCd != ''">
  142. and t.status_cd= #{statusCd}
  143. </if>
  144. <if test="remark !=null and remark != ''">
  145. and t.remark= #{remark}
  146. </if>
  147. <if test="state !=null and state != ''">
  148. and t.state= #{state}
  149. </if>
  150. <if test="ownerId !=null and ownerId != ''">
  151. and t.owner_id= #{ownerId}
  152. </if>
  153. <if test="bId !=null and bId != ''">
  154. and t.b_id= #{bId}
  155. </if>
  156. <if test="userId !=null and userId != ''">
  157. and t.user_id= #{userId}
  158. </if>
  159. <if test="roomId !=null and roomId != ''">
  160. and t.room_id= #{roomId}
  161. </if>
  162. </select>
  163. </mapper>