OwnerAttrServiceDaoImplMapper.xml 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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="ownerAttrServiceDaoImpl">
  6. <!-- 保存业主属性信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveBusinessOwnerAttrInfo" parameterType="Map">
  8. insert into business_building_owner_attr(
  9. attr_id,operate,spec_cd,b_id,community_id,value,member_id
  10. ) values (
  11. #{attrId},#{operate},#{specCd},#{bId},#{communityId},#{value},#{memberId}
  12. )
  13. </insert>
  14. <!-- 查询业主属性信息(Business) add by wuxw 2018-07-03 -->
  15. <select id="getBusinessOwnerAttrInfo" parameterType="Map" resultType="Map">
  16. select t.attr_id,t.attr_id attrId,t.operate,t.create_time,t.create_time createTime,t.spec_cd,t.spec_cd
  17. specCd,t.b_id,t.b_id bId,t.community_id,t.community_id communityId,t.value,t.member_id,t.member_id memberId
  18. from business_building_owner_attr t
  19. where 1 =1
  20. <if test="attrId !=null and attrId != ''">
  21. and t.attr_id= #{attrId}
  22. </if>
  23. <if test="operate !=null and operate != ''">
  24. and t.operate= #{operate}
  25. </if>
  26. <if test="createTime !=null ">
  27. and t.create_time= #{createTime}
  28. </if>
  29. <if test="specCd !=null and specCd != ''">
  30. and t.spec_cd= #{specCd}
  31. </if>
  32. <if test="bId !=null and bId != ''">
  33. and t.b_id= #{bId}
  34. </if>
  35. <if test="communityId !=null and communityId != ''">
  36. and t.community_id= #{communityId}
  37. </if>
  38. <if test="value !=null and value != ''">
  39. and t.value= #{value}
  40. </if>
  41. <if test="memberId !=null and memberId != ''">
  42. and t.member_id= #{memberId}
  43. </if>
  44. </select>
  45. <!-- 保存业主属性信息至 instance表中 add by wuxw 2018-07-03 -->
  46. <insert id="saveOwnerAttrInfoInstance" parameterType="Map">
  47. insert into building_owner_attr(
  48. attr_id,create_time,spec_cd,status_cd,b_id,community_id,value,member_id
  49. ) select t.attr_id,t.create_time,t.spec_cd,'0',t.b_id,t.community_id,t.value,t.member_id from
  50. business_building_owner_attr t where 1=1
  51. <if test="attrId !=null and attrId != ''">
  52. and t.attr_id= #{attrId}
  53. </if>
  54. and t.operate= 'ADD'
  55. <if test="createTime !=null and createTime != ''">
  56. and t.create_time= #{createTime}
  57. </if>
  58. <if test="specCd !=null and specCd != ''">
  59. and t.spec_cd= #{specCd}
  60. </if>
  61. <if test="bId !=null and bId != ''">
  62. and t.b_id= #{bId}
  63. </if>
  64. <if test="communityId !=null and communityId != ''">
  65. and t.community_id= #{communityId}
  66. </if>
  67. <if test="value !=null and value != ''">
  68. and t.value= #{value}
  69. </if>
  70. <if test="memberId !=null and memberId != ''">
  71. and t.member_id= #{memberId}
  72. </if>
  73. </insert>
  74. <!-- 查询业主属性信息 add by wuxw 2018-07-03 -->
  75. <select id="getOwnerAttrInfo" parameterType="Map" resultType="Map">
  76. select t.attr_id,t.attr_id attrId,t.create_time,t.create_time createTime,t.spec_cd,t.spec_cd
  77. specCd,t.status_cd,t.status_cd statusCd,t.b_id,t.b_id bId,t.community_id,t.community_id
  78. communityId,t.value,t.member_id,t.member_id memberId,
  79. s.spec_name specName,
  80. v.value_name valueName,
  81. s.list_show listShow
  82. from building_owner_attr t
  83. left join attr_spec s on t.spec_cd = s.spec_cd and s.status_cd = '0' and s.table_name = 'building_owner_attr'
  84. left join attr_value v on t.`value` = v.`value` and t.spec_cd = v.spec_cd and v.status_cd = '0'
  85. where 1 =1
  86. <if test="attrId !=null and attrId != ''">
  87. and t.attr_id= #{attrId}
  88. </if>
  89. <if test="createTime !=null and createTime != ''">
  90. and t.create_time= #{createTime}
  91. </if>
  92. <if test="specCd !=null and specCd != ''">
  93. and t.spec_cd= #{specCd}
  94. </if>
  95. <if test="statusCd !=null and statusCd != ''">
  96. and t.status_cd= #{statusCd}
  97. </if>
  98. <if test="bId !=null and bId != ''">
  99. and t.b_id= #{bId}
  100. </if>
  101. <if test="communityId !=null and communityId != ''">
  102. and t.community_id= #{communityId}
  103. </if>
  104. <if test="value !=null and value != ''">
  105. and t.value= #{value}
  106. </if>
  107. <if test="memberId !=null and memberId != ''">
  108. and t.member_id= #{memberId}
  109. </if>
  110. <if test="memberIds !=null">
  111. and t.member_id in
  112. <foreach collection="memberIds" open="(" close=")"
  113. separator="," item="item">
  114. #{item}
  115. </foreach>
  116. </if>
  117. order by t.create_time desc
  118. <if test="page != -1 and page != null ">
  119. limit #{page}, #{row}
  120. </if>
  121. </select>
  122. <!-- 修改业主属性信息 add by wuxw 2018-07-03 -->
  123. <update id="updateOwnerAttrInfoInstance" parameterType="Map">
  124. update building_owner_attr t set t.status_cd = #{statusCd}
  125. <if test="newBId != null and newBId != ''">
  126. ,t.b_id = #{newBId}
  127. </if>
  128. <if test="specCd !=null and specCd != ''">
  129. , t.spec_cd= #{specCd}
  130. </if>
  131. <if test="communityId !=null and communityId != ''">
  132. , t.community_id= #{communityId}
  133. </if>
  134. <if test="value !=null and value != ''">
  135. , t.value= #{value}
  136. </if>
  137. <if test="memberId !=null and memberId != ''">
  138. , t.member_id= #{memberId}
  139. </if>
  140. where 1=1
  141. <if test="attrId !=null and attrId != ''">
  142. and t.attr_id= #{attrId}
  143. </if>
  144. <if test="bId !=null and bId != ''">
  145. and t.b_id= #{bId}
  146. </if>
  147. </update>
  148. <!-- 查询业主属性数量 add by wuxw 2018-07-03 -->
  149. <select id="queryOwnerAttrsCount" parameterType="Map" resultType="Map">
  150. select count(1) count
  151. from building_owner_attr t
  152. where 1 =1
  153. <if test="attrId !=null and attrId != ''">
  154. and t.attr_id= #{attrId}
  155. </if>
  156. <if test="createTime !=null and createTime != ''">
  157. and t.create_time= #{createTime}
  158. </if>
  159. <if test="specCd !=null and specCd != ''">
  160. and t.spec_cd= #{specCd}
  161. </if>
  162. <if test="statusCd !=null and statusCd != ''">
  163. and t.status_cd= #{statusCd}
  164. </if>
  165. <if test="bId !=null and bId != ''">
  166. and t.b_id= #{bId}
  167. </if>
  168. <if test="communityId !=null and communityId != ''">
  169. and t.community_id= #{communityId}
  170. </if>
  171. <if test="value !=null and value != ''">
  172. and t.value= #{value}
  173. </if>
  174. <if test="memberId !=null and memberId != ''">
  175. and t.member_id= #{memberId}
  176. </if>
  177. </select>
  178. </mapper>