CommunityServiceDaoImplMapper.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  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="communityServiceDaoImpl">
  6. <!-- 保存小区信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveBusinessCommunityInfo" parameterType="Map">
  8. insert into business_community(community_id,b_id,name,address,city_code,nearby_landmarks,map_x,map_y,month,operate)
  9. values(#{communityId},#{bId},#{name},#{address},#{cityCode},#{nearbyLandmarks},#{mapX},#{mapY},#{month},#{operate})
  10. </insert>
  11. <!-- 保存小区属性信息 add by wuxw 2018-07-03 -->
  12. <insert id="saveBusinessCommunityAttr" parameterType="Map">
  13. insert into business_community_attr(b_id,attr_id,community_id,spec_cd,value,month,operate)
  14. values(#{bId},#{attrId},#{communityId},#{specCd},#{value},#{month},#{operate})
  15. </insert>
  16. <!-- 保存小区照片信息 add by wuxw 2018-07-03 -->
  17. <insert id="saveBusinessCommunityPhoto" parameterType="Map">
  18. insert into business_community_photo(community_photo_id,b_id,community_id,community_photo_type_cd,photo,month,operate)
  19. values(#{communityPhotoId},#{bId},#{communityId},#{communityPhotoTypeCd},#{photo},#{month},#{operate})
  20. </insert>
  21. <!-- 查询小区信息(Business) add by wuxw 2018-07-03 -->
  22. <select id="getBusinessCommunityInfo" parameterType="Map" resultType="Map">
  23. select s.community_id,s.b_id,s.name,s.address,s.city_code,s.nearby_landmarks,s.map_x,s.map_y,s.operate
  24. from business_community s where 1 = 1
  25. <if test="operate != null and operate != ''">
  26. and s.operate = #{operate}
  27. </if>
  28. <if test="bId != null and bId !=''">
  29. and s.b_id = #{bId}
  30. </if>
  31. <if test="communityId != null and communityId != ''">
  32. and s.community_id = #{communityId}
  33. </if>
  34. </select>
  35. <!-- 查询小区属性信息(Business) add by wuxw 2018-07-03 -->
  36. <select id="getBusinessCommunityAttrs" parameterType="Map" resultType="Map">
  37. select sa.b_id,sa.attr_id,sa.community_id,sa.spec_cd,sa.value,sa.operate
  38. from business_community_attr sa where 1=1
  39. <if test="operate != null and operate != ''">
  40. and sa.operate = #{operate}
  41. </if>
  42. <if test="bId != null and bId !=''">
  43. and sa.b_id = #{bId}
  44. </if>
  45. <if test="communityId != null and communityId != ''">
  46. and sa.community_id = #{communityId}
  47. </if>
  48. <if test="attrId != null and attrId != ''">
  49. and sa.attr_id = #{attrId}
  50. </if>
  51. </select>
  52. <!-- 查询小区照片信息 add by wuxw 2018-07-03 -->
  53. <select id="getBusinessCommunityPhoto" parameterType="Map" resultType="Map">
  54. select sp.community_photo_id,sp.b_id,sp.community_id,sp.community_photo_type_cd,sp.photo,sp.operate
  55. from business_community_photo sp where 1=1
  56. <if test="bId != null and bId !=''">
  57. and sp.b_id = #{bId}
  58. </if>
  59. <if test="operate != null and operate != ''">
  60. and sp.operate = #{operate}
  61. </if>
  62. <if test="communityId != null and communityId != ''">
  63. and sp.community_id = #{communityId}
  64. </if>
  65. </select>
  66. <!-- 保存小区信息至 instance表中 add by wuxw 2018-07-03 -->
  67. <insert id="saveCommunityInfoInstance" parameterType="Map">
  68. insert into s_community(community_id,b_id,name,address,city_code,nearby_landmarks,map_x,map_y,status_cd)
  69. select s.community_id,s.b_id,s.name,s.address,s.city_code,s.nearby_landmarks,s.map_x,s.map_y,'0'
  70. from business_community s where
  71. s.operate = 'ADD' and s.b_id=#{bId}
  72. </insert>
  73. <!-- 保存小区属性信息到 instance add by wuxw 2018-07-03 -->
  74. <insert id="saveCommunityAttrsInstance" parameterType="Map">
  75. insert into s_community_attr(b_id,attr_id,community_id,spec_cd,value,status_cd)
  76. select sa.b_id,sa.attr_id,sa.community_id,sa.spec_cd,sa.value,'0'
  77. from business_community_attr sa
  78. where sa.operate = 'ADD' and sa.b_id=#{bId}
  79. </insert>
  80. <!-- 保存 小区照片信息 instance add by wuxw 2018-07-03 -->
  81. <insert id="saveCommunityPhotoInstance" parameterType="Map">
  82. insert into s_community_photo(community_photo_id,b_id,community_id,community_photo_type_cd,photo,status_cd)
  83. select sp.community_photo_id,sp.b_id,sp.community_id,sp.community_photo_type_cd,sp.photo,'0'
  84. from business_community_photo sp
  85. where sp.operate = 'ADD' and sp.b_id=#{bId}
  86. </insert>
  87. <!-- 查询小区信息 add by wuxw 2018-07-03 -->
  88. <select id="getCommunityInfo" parameterType="Map" resultType="Map">
  89. select s.community_id,s.b_id,s.name,s.address,s.city_code,s.nearby_landmarks,s.map_x,s.map_y,s.status_cd
  90. from s_community s
  91. where 1=1
  92. <if test="statusCd != null and statusCd != ''">
  93. and s.status_cd = #{statusCd}
  94. </if>
  95. <if test="bId != null and bId !=''">
  96. and s.b_id = #{bId}
  97. </if>
  98. <if test="communityId != null and communityId !=''">
  99. and s.community_id = #{communityId}
  100. </if>
  101. </select>
  102. <!-- 查询小区属性信息 add by wuxw 2018-07-03 -->
  103. <select id="getCommunityAttrs" parameterType="Map" resultType="Map">
  104. select sa.b_id,sa.attr_id,sa.community_id,sa.spec_cd,sa.value,sa.status_cd
  105. from s_community_attr sa
  106. where
  107. 1=1
  108. <if test="statusCd != null and statusCd != ''">
  109. and sa.status_cd = #{statusCd}
  110. </if>
  111. <if test="bId != null and bId !=''">
  112. and sa.b_id = #{bId}
  113. </if>
  114. <if test="communityId != null and communityId !=''">
  115. and sa.community_id = #{communityId}
  116. </if>
  117. <if test="attrId != null and attrId != ''">
  118. and sa.attr_id = #{attrId}
  119. </if>
  120. </select>
  121. <!-- 查询小区照片信息 add by wuxw 2018-07-03 -->
  122. <select id="getCommunityPhoto" parameterType="Map" resultType="Map">
  123. select sp.community_photo_id,sp.b_id,sp.community_id,sp.community_photo_type_cd,sp.photo,sp.status_cd
  124. from s_community_photo sp
  125. where 1=1
  126. <if test="statusCd != null and statusCd != ''">
  127. and sp.status_cd = #{statusCd}
  128. </if>
  129. <if test="bId != null and bId !=''">
  130. and sp.b_id = #{bId}
  131. </if>
  132. <if test="communityId != null and communityId !=''">
  133. and sp.community_id = #{communityId}
  134. </if>
  135. </select>
  136. <!-- 修改小区信息 add by wuxw 2018-07-03 -->
  137. <update id="updateCommunityInfoInstance" parameterType="Map">
  138. update s_community s set s.status_cd = #{statusCd}
  139. <if test="newBId != null and newBId != ''">
  140. ,s.b_id = #{newBId}
  141. </if>
  142. <if test="name != null and name != ''">
  143. ,s.name = #{name}
  144. </if>
  145. <if test="address != null and address != ''">
  146. ,s.address = #{address}
  147. </if>
  148. <if test="cityCode != null and cityCode != ''">
  149. ,s.city_code = #{cityCode}
  150. </if>
  151. <if test="nearbyLandmarks != null and nearbyLandmarks != ''">
  152. ,s.nearby_landmarks = #{nearbyLandmarks}
  153. </if>
  154. <if test="mapX != null and mapX != ''">
  155. ,s.map_x = #{mapX}
  156. </if>
  157. <if test="mapY != null and mapY != ''">
  158. ,s.map_y = #{mapY}
  159. </if>
  160. where 1=1
  161. <if test="bId != null and bId !=''">
  162. and s.b_id = #{bId}
  163. </if>
  164. <if test="communityId != null and communityId !=''">
  165. and s.community_id = #{communityId}
  166. </if>
  167. </update>
  168. <!-- 修改小区属性信息 add by wuxw 2018-07-03 -->
  169. <update id="updateCommunityAttrInstance" parameterType="Map">
  170. update s_community_attr sa set sa.status_cd = #{statusCd}
  171. <if test="newBId != null and newBId != ''">
  172. ,sa.b_id = #{newBId}
  173. </if>
  174. <if test="value != null and value != ''">
  175. ,sa.value = #{value}
  176. </if>
  177. where 1=1
  178. <if test="bId != null and bId !=''">
  179. and sa.b_id = #{bId}
  180. </if>
  181. <if test="communityId != null and communityId !=''">
  182. and sa.community_id = #{communityId}
  183. </if>
  184. <if test="specCd != null and specCd !=''">
  185. and sa.spec_cd = #{specCd}
  186. </if>
  187. <if test="attrId != null and attrId !=''">
  188. and sa.attr_id = #{attrId}
  189. </if>
  190. </update>
  191. <!-- 修改小区照片信息 add by wuxw 2018-07-03 -->
  192. <update id="updateCommunityPhotoInstance" parameterType="Map">
  193. update s_community_photo sp set sp.status_cd = #{statusCd}
  194. <if test="newBId != null and newBId != ''">
  195. ,sp.b_id = #{newBId}
  196. </if>
  197. <if test="communityPhotoTypeCd != null and communityPhotoTypeCd != ''">
  198. ,sp.community_photo_type_cd = #{communityPhotoTypeCd}
  199. </if>
  200. <if test="photo != null and photo != ''">
  201. ,sp.photo = #{photo}
  202. </if>
  203. where 1=1
  204. <if test="bId != null and bId !=''">
  205. and sp.b_id = #{bId}
  206. </if>
  207. <if test="communityId != null and communityId !=''">
  208. and sp.community_id = #{communityId}
  209. </if>
  210. <if test="communityPhotoId != null and communityPhotoId !=''">
  211. and sp.community_photo_id = #{communityPhotoId}
  212. </if>
  213. </update>
  214. <!--小区成员加入 add by wuxw 2018-10-27 saveBusinessCommunityMember-->
  215. <insert id="saveBusinessCommunityMember" parameterType="Map">
  216. insert into business_community_member(community_member_id,b_id,community_id,member_id,member_type_cd,month,operate,audit_status_cd)
  217. values(#{communityMemberId},#{bId},#{communityId},#{memberId},#{memberTypeCd},#{month},#{operate},#{auditStatusCd})
  218. </insert>
  219. <!-- 小区成员加入 instance表中 add by wuxw 2018-10-27 -->
  220. <insert id="saveCommunityMemberInstance" parameterType="Map">
  221. insert into s_community_member(community_member_id,b_id,community_id,member_id,member_type_cd,status_cd,audit_status_cd)
  222. select ms.community_member_id,ms.b_id,ms.community_id,ms.member_id,ms.member_type_cd,'0',ms.audit_status_cd
  223. from business_community_member ms where
  224. ms.operate = 'ADD' and ms.b_id=#{bId}
  225. </insert>
  226. <!-- 查询小区成员 add by wuxw 2018-10-27 getBusinessCommunityMember-->
  227. <select id="getBusinessCommunityMember" parameterType="Map" resultType="Map">
  228. select ms.community_member_id,ms.b_id,ms.community_id,ms.member_id,ms.member_type_cd,ms.operate,ms.audit_status_cd
  229. from business_community_member ms where 1 = 1
  230. <if test="operate != null and operate != ''">
  231. and ms.operate = #{operate}
  232. </if>
  233. <if test="bId != null and bId !=''">
  234. and ms.b_id = #{bId}
  235. </if>
  236. <if test="communityId != null and communityId != ''">
  237. and ms.community_id = #{communityId}
  238. </if>
  239. </select>
  240. <!-- 查询小区成员 add by wuxw 2018-07-03 -->
  241. <select id="getCommunityMember" parameterType="Map" resultType="Map">
  242. select ms.community_member_id ,ms.b_id,ms.community_id,ms.member_id,ms.member_type_cd,ms.status_cd,ms.audit_status_cd,
  243. ms.community_member_id communityMemberId ,ms.b_id bId,ms.community_id communityId,ms.member_id memberId,ms.member_type_cd memberTypeCd,ms.status_cd statusCd,
  244. ms.audit_status_cd auditStatusCd
  245. from s_community_member ms
  246. where 1=1
  247. <if test="statusCd != null and statusCd != ''">
  248. and ms.status_cd = #{statusCd}
  249. </if>
  250. <if test="bId != null and bId !=''">
  251. and ms.b_id = #{bId}
  252. </if>
  253. <if test="communityMemberId != null and communityMemberId !=''">
  254. and ms.community_member_id = #{communityMemberId}
  255. </if>
  256. <if test="memberId != null and memberId != ''">
  257. and ms.member_id = #{memberId}
  258. </if>
  259. <if test="memberTypeCd != null and memberTypeCd != ''">
  260. and ms.member_type_cd = #{memberTypeCd}
  261. </if>
  262. <if test="auditStatusCd != null and auditStatusCd != ''">
  263. and ms.audit_status_cd = #{auditStatusCd}
  264. </if>
  265. <if test="communityId != null and communityId != ''">
  266. and ms.community_id = #{communityId}
  267. </if>
  268. </select>
  269. <!-- 修改小区成员 add by wuxw 2018-07-03 -->
  270. <update id="updateCommunityMemberInstance" parameterType="Map">
  271. update s_community_member ms set ms.status_cd = #{statusCd}
  272. <if test="newBId != null and newBId != ''">
  273. ,ms.b_id = #{newBId}
  274. </if>
  275. <if test="auditStatusCd !=null and auditStatusCd !=''">
  276. ,ms.audit_status_cd = #{auditStatusCd}
  277. </if>
  278. where 1=1
  279. <if test="bId != null and bId !=''">
  280. and ms.b_id = #{bId}
  281. </if>
  282. <if test="communityMemberId != null and communityMemberId !=''">
  283. and ms.community_member_id = #{communityMemberId}
  284. </if>
  285. </update>
  286. </mapper>