OwnerV1ServiceDaoImplMapper.xml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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="ownerV1ServiceDaoImpl">
  5. <!-- 保存业主信息信息 add by wuxw 2018-07-03 -->
  6. <insert id="saveOwnerInfo" parameterType="Map">
  7. insert into building_owner(id_card, sex, link, owner_type_cd, remark, owner_id, user_id, name, state,
  8. community_id, age, member_id, address)
  9. values (#{idCard}, #{sex}, #{link}, #{ownerTypeCd}, #{remark}, #{ownerId}, #{userId}, #{name}, #{state},
  10. #{communityId}, #{age}, #{memberId}, #{address})
  11. </insert>
  12. <!-- 查询业主信息信息 add by wuxw 2018-07-03 -->
  13. <select id="getOwnerInfo" parameterType="Map" resultType="Map">
  14. select t.id_card,t.id_card idCard,t.sex,t.link,t.owner_type_cd,t.owner_type_cd
  15. ownerTypeCd,t.remark,t.status_cd,t.status_cd statusCd,t.owner_id,t.owner_id ownerId,t.user_id,t.user_id
  16. userId,t.name,t.state,t.community_id,t.community_id communityId,t.age,t.member_id,t.member_id memberId,
  17. t.address from building_owner t
  18. where 1 =1
  19. <if test="idCard !=null and idCard != ''">
  20. and t.id_card= #{idCard}
  21. </if>
  22. <if test="sex !=null and sex != ''">
  23. and t.sex= #{sex}
  24. </if>
  25. <if test="link !=null and link != ''">
  26. and t.link= #{link}
  27. </if>
  28. <if test="address !=null and address != ''">
  29. and t.address= #{address}
  30. </if>
  31. <if test="ownerTypeCd !=null and ownerTypeCd != ''">
  32. and t.owner_type_cd= #{ownerTypeCd}
  33. </if>
  34. <if test="remark !=null and remark != ''">
  35. and t.remark= #{remark}
  36. </if>
  37. <if test="statusCd !=null and statusCd != ''">
  38. and t.status_cd= #{statusCd}
  39. </if>
  40. <if test="ownerId !=null and ownerId != ''">
  41. and t.owner_id= #{ownerId}
  42. </if>
  43. <if test="userId !=null and userId != ''">
  44. and t.user_id= #{userId}
  45. </if>
  46. <if test="name !=null and name != ''">
  47. and t.name= #{name}
  48. </if>
  49. <if test="state !=null and state != ''">
  50. and t.state= #{state}
  51. </if>
  52. <if test="communityId !=null and communityId != ''">
  53. and t.community_id= #{communityId}
  54. </if>
  55. <if test="age !=null and age != ''">
  56. and t.age= #{age}
  57. </if>
  58. <if test="memberId !=null and memberId != ''">
  59. and t.member_id= #{memberId}
  60. </if>
  61. order by t.create_time desc
  62. <if test="page != -1 and page != null ">
  63. limit #{page}, #{row}
  64. </if>
  65. </select>
  66. <!-- 修改业主信息信息 add by wuxw 2018-07-03 -->
  67. <update id="updateOwnerInfo" parameterType="Map">
  68. update building_owner t set t.status_cd = #{statusCd}
  69. <if test="newBId != null and newBId != ''">
  70. ,t.b_id = #{newBId}
  71. </if>
  72. , t.id_card= #{idCard}
  73. <if test="sex !=null and sex != ''">
  74. , t.sex= #{sex}
  75. </if>
  76. <if test="link !=null and link != ''">
  77. , t.link= #{link}
  78. </if>
  79. <if test="address !=null and address != ''">
  80. , t.address= #{address}
  81. </if>
  82. <if test="ownerTypeCd !=null and ownerTypeCd != ''">
  83. , t.owner_type_cd= #{ownerTypeCd}
  84. </if>
  85. <if test="remark !=null and remark != ''">
  86. , t.remark= #{remark}
  87. </if>
  88. <if test="ownerId !=null and ownerId != ''">
  89. , t.owner_id= #{ownerId}
  90. </if>
  91. <if test="userId !=null and userId != ''">
  92. , t.user_id= #{userId}
  93. </if>
  94. <if test="name !=null and name != ''">
  95. , t.name= #{name}
  96. </if>
  97. <if test="state !=null and state != ''">
  98. , t.state= #{state}
  99. </if>
  100. <if test="communityId !=null and communityId != ''">
  101. , t.community_id= #{communityId}
  102. </if>
  103. <if test="age != ''">
  104. , t.age= #{age}
  105. </if>
  106. where 1=1
  107. <if test="memberId !=null and memberId != ''">
  108. and t.member_id= #{memberId}
  109. </if>
  110. </update>
  111. <!-- 查询业主信息数量 add by wuxw 2018-07-03 -->
  112. <select id="queryOwnersCount" parameterType="Map" resultType="Map">
  113. select count(1) count
  114. from building_owner t
  115. where 1 =1
  116. <if test="idCard !=null and idCard != ''">
  117. and t.id_card= #{idCard}
  118. </if>
  119. <if test="sex !=null and sex != ''">
  120. and t.sex= #{sex}
  121. </if>
  122. <if test="link !=null and link != ''">
  123. and t.link= #{link}
  124. </if>
  125. <if test="address !=null and address != ''">
  126. and t.address= #{address}
  127. </if>
  128. <if test="ownerTypeCd !=null and ownerTypeCd != ''">
  129. and t.owner_type_cd= #{ownerTypeCd}
  130. </if>
  131. <if test="remark !=null and remark != ''">
  132. and t.remark= #{remark}
  133. </if>
  134. <if test="statusCd !=null and statusCd != ''">
  135. and t.status_cd= #{statusCd}
  136. </if>
  137. <if test="ownerId !=null and ownerId != ''">
  138. and t.owner_id= #{ownerId}
  139. </if>
  140. <if test="userId !=null and userId != ''">
  141. and t.user_id= #{userId}
  142. </if>
  143. <if test="name !=null and name != ''">
  144. and t.name= #{name}
  145. </if>
  146. <if test="state !=null and state != ''">
  147. and t.state= #{state}
  148. </if>
  149. <if test="communityId !=null and communityId != ''">
  150. and t.community_id= #{communityId}
  151. </if>
  152. <if test="age !=null and age != ''">
  153. and t.age= #{age}
  154. </if>
  155. <if test="memberId !=null and memberId != ''">
  156. and t.member_id= #{memberId}
  157. </if>
  158. </select>
  159. <select id="queryOwnersBindCount" parameterType="Map" resultType="Map">
  160. select count(DISTINCT t.member_id) count from building_owner t
  161. left join owner_app_user oau on t.community_id = oau.community_id and t.member_id = oau.member_id and
  162. oau.status_cd = '0'
  163. where t.status_cd = '0'
  164. <if test='isBind == "N"'>
  165. and oau.member_id is null
  166. </if>
  167. <if test='isBind == "Y"'>
  168. and oau.member_id is not null
  169. </if>
  170. <if test="communityId !=null and communityId != ''">
  171. and t.community_id= #{communityId}
  172. </if>
  173. </select>
  174. </mapper>