OwnerAppUserServiceDaoImplMapper.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  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="ownerAppUserServiceDaoImpl">
  6. <!-- 保存绑定业主信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveBusinessOwnerAppUserInfo" parameterType="Map">
  8. insert into business_owner_app_user(
  9. id_card,open_id,link,remark,operate,app_user_name,community_name,state,app_user_id,community_id,app_type_cd,b_id,member_id,user_id,app_type,nickname,headimgurl
  10. ) values (
  11. #{idCard},#{openId},#{link},#{remark},#{operate},#{appUserName},#{communityName},#{state},#{appUserId},#{communityId},
  12. #{appTypeCd},#{bId},#{memberId},#{userId},#{appType},#{nickName},#{headImgUrl}
  13. )
  14. </insert>
  15. <!-- 查询绑定业主信息(Business) add by wuxw 2018-07-03 -->
  16. <select id="getBusinessOwnerAppUserInfo" parameterType="Map" resultType="Map">
  17. select t.id_card,t.id_card idCard,t.open_id,t.open_id
  18. openId,t.link,t.remark,t.operate,t.app_user_name,t.app_user_name appUserName,t.community_name,t.community_name
  19. communityName,t.state,t.app_user_id,t.app_user_id appUserId,t.community_id,t.community_id
  20. communityId,t.app_type_cd,t.app_type_cd appTypeCd,t.b_id,t.b_id bId,t.member_id,t.member_id memberId,t.user_id,
  21. t.user_id userId,t.app_type,t.app_type appType,t.nickname,t.nickname nickName,t.headimgurl,t.headimgurl
  22. headImgUrl
  23. from business_owner_app_user t
  24. where 1 =1
  25. <if test="idCard !=null and idCard != ''">
  26. and t.id_card= #{idCard}
  27. </if>
  28. <if test="openId !=null and openId != ''">
  29. and t.open_id= #{openId}
  30. </if>
  31. <if test="link !=null and link != ''">
  32. and t.link= #{link}
  33. </if>
  34. <if test="remark !=null and remark != ''">
  35. and t.remark= #{remark}
  36. </if>
  37. <if test="operate !=null and operate != ''">
  38. and t.operate= #{operate}
  39. </if>
  40. <if test="appUserName !=null and appUserName != ''">
  41. and t.app_user_name= #{appUserName}
  42. </if>
  43. <if test="communityName !=null and communityName != ''">
  44. and t.community_name= #{communityName}
  45. </if>
  46. <if test="state !=null and state != ''">
  47. and t.state= #{state}
  48. </if>
  49. <if test="appUserId !=null and appUserId != ''">
  50. and t.app_user_id= #{appUserId}
  51. </if>
  52. <if test="communityId !=null and communityId != ''">
  53. and t.community_id= #{communityId}
  54. </if>
  55. <if test="appTypeCd !=null and appTypeCd != ''">
  56. and t.app_type_cd= #{appTypeCd}
  57. </if>
  58. <if test="bId !=null and bId != ''">
  59. and t.b_id= #{bId}
  60. </if>
  61. <if test="memberId !=null and memberId != ''">
  62. and t.member_id= #{memberId}
  63. </if>
  64. <if test="userId !=null and userId != ''">
  65. and t.user_id= #{userId}
  66. </if>
  67. </select>
  68. <!-- 保存绑定业主信息至 instance表中 add by wuxw 2018-07-03 -->
  69. <insert id="saveOwnerAppUserInfoInstance" parameterType="Map">
  70. insert into owner_app_user(
  71. id_card,open_id,link,remark,status_cd,app_user_name,community_name,state,app_user_id,community_id,app_type_cd,b_id,member_id,user_id,
  72. app_type,nickname,headimgurl
  73. ) select
  74. t.id_card,t.open_id,t.link,t.remark,'0',t.app_user_name,t.community_name,t.state,t.app_user_id,t.community_id,t.app_type_cd,t.b_id,
  75. t.member_id,t.user_id,t.app_type,t.nickname,t.headimgurl
  76. from business_owner_app_user t where 1=1
  77. <if test="idCard !=null and idCard != ''">
  78. and t.id_card= #{idCard}
  79. </if>
  80. <if test="openId !=null and openId != ''">
  81. and t.open_id= #{openId}
  82. </if>
  83. <if test="link !=null and link != ''">
  84. and t.link= #{link}
  85. </if>
  86. <if test="remark !=null and remark != ''">
  87. and t.remark= #{remark}
  88. </if>
  89. and t.operate= 'ADD'
  90. <if test="appUserName !=null and appUserName != ''">
  91. and t.app_user_name= #{appUserName}
  92. </if>
  93. <if test="communityName !=null and communityName != ''">
  94. and t.community_name= #{communityName}
  95. </if>
  96. <if test="state !=null and state != ''">
  97. and t.state= #{state}
  98. </if>
  99. <if test="appUserId !=null and appUserId != ''">
  100. and t.app_user_id= #{appUserId}
  101. </if>
  102. <if test="communityId !=null and communityId != ''">
  103. and t.community_id= #{communityId}
  104. </if>
  105. <if test="appTypeCd !=null and appTypeCd != ''">
  106. and t.app_type_cd= #{appTypeCd}
  107. </if>
  108. <if test="bId !=null and bId != ''">
  109. and t.b_id= #{bId}
  110. </if>
  111. <if test="memberId !=null and memberId != ''">
  112. and t.member_id= #{memberId}
  113. </if>
  114. <if test="userId !=null and userId != ''">
  115. and t.user_id= #{userId}
  116. </if>
  117. <if test="nickName !=null and nickName != ''">
  118. and t.nickname= #{nickName}
  119. </if>
  120. <if test="headImgUrl !=null and headImgUrl != ''">
  121. and t.headimgurl= #{headImgUrl}
  122. </if>
  123. </insert>
  124. <!-- 查询绑定业主信息 add by wuxw 2018-07-03 -->
  125. <select id="getOwnerAppUserInfo" parameterType="Map" resultType="Map">
  126. select t.id_card,t.id_card idCard,t.open_id,t.open_id openId,t.link,t.remark,t.status_cd,t.status_cd
  127. statusCd,t.nickname,t.headimgurl,t.app_user_name,t.app_user_name appUserName,t.community_name,t.community_name
  128. communityName,t.state,t.app_user_id,t.app_user_id appUserId,t.community_id,t.community_id
  129. communityId,t.app_type_cd,t.app_type_cd appTypeCd,t.b_id,t.b_id bId,t.member_id,t.member_id memberId,
  130. td1.name stateName,t.user_id,t.user_id userId,t.app_type,t.app_type appType,t.create_time createTime,
  131. bo.owner_id ownerId,bo.owner_type_cd ownerTypeCd
  132. from owner_app_user t
  133. left join t_dict td1 on t.state = td1.status_cd and td1.table_name = 'owner_app_user' and td1.table_columns =
  134. 'state'
  135. left join building_owner bo on t.member_id = bo.member_id and t.community_id = bo.community_id and bo.status_cd
  136. = '0'
  137. where 1 =1
  138. <if test="idCard !=null and idCard != ''">
  139. and t.id_card= #{idCard}
  140. </if>
  141. <if test="openId !=null and openId != ''">
  142. and t.open_id= #{openId}
  143. </if>
  144. <if test="link !=null and link != ''">
  145. and t.link= #{link}
  146. </if>
  147. <if test="remark !=null and remark != ''">
  148. and t.remark= #{remark}
  149. </if>
  150. <if test="statusCd !=null and statusCd != ''">
  151. and t.status_cd= #{statusCd}
  152. </if>
  153. <if test="appUserName !=null and appUserName != ''">
  154. and t.app_user_name= #{appUserName}
  155. </if>
  156. <if test="communityName !=null and communityName != ''">
  157. and t.community_name= #{communityName}
  158. </if>
  159. <if test="state !=null and state != ''">
  160. and t.state= #{state}
  161. </if>
  162. <if test="states !=null">
  163. and t.state in
  164. <foreach collection="states" item="item" open="(" close=")" separator=",">
  165. #{item}
  166. </foreach>
  167. </if>
  168. <if test="appUserId !=null and appUserId != ''">
  169. and t.app_user_id= #{appUserId}
  170. </if>
  171. <if test="communityId !=null and communityId != ''">
  172. and t.community_id= #{communityId}
  173. </if>
  174. <if test="appTypeCd !=null and appTypeCd != ''">
  175. and t.app_type_cd= #{appTypeCd}
  176. </if>
  177. <if test="bId !=null and bId != ''">
  178. and t.b_id= #{bId}
  179. </if>
  180. <if test="memberId !=null and memberId != ''">
  181. and t.member_id= #{memberId}
  182. </if>
  183. <if test="appType !=null and appType != ''">
  184. and t.app_type = #{appType}
  185. </if>
  186. <if test="userIds !=null">
  187. and t.user_id in
  188. <foreach collection="userIds" open="(" close=")"
  189. separator="," item="item">
  190. #{item}
  191. </foreach>
  192. </if>
  193. <if test="userId !=null and userId != ''">
  194. and t.user_id= #{userId}
  195. </if>
  196. order by t.create_time desc
  197. <if test="page != -1 and page != null ">
  198. limit #{page}, #{row}
  199. </if>
  200. </select>
  201. <!-- 修改绑定业主信息 add by wuxw 2018-07-03 -->
  202. <update id="updateOwnerAppUserInfoInstance" parameterType="Map">
  203. update owner_app_user t set t.status_cd = #{statusCd}
  204. <if test="newBId != null and newBId != ''">
  205. ,t.b_id = #{newBId}
  206. </if>
  207. <if test="idCard !=null and idCard != ''">
  208. , t.id_card= #{idCard}
  209. </if>
  210. <if test="openId !=null and openId != ''">
  211. , t.open_id= #{openId}
  212. </if>
  213. <if test="link !=null and link != ''">
  214. , t.link= #{link}
  215. </if>
  216. <if test="remark !=null and remark != ''">
  217. , t.remark= #{remark}
  218. </if>
  219. <if test="appUserName !=null and appUserName != ''">
  220. , t.app_user_name= #{appUserName}
  221. </if>
  222. <if test="communityName !=null and communityName != ''">
  223. , t.community_name= #{communityName}
  224. </if>
  225. <if test="state !=null and state != ''">
  226. , t.state= #{state}
  227. </if>
  228. <if test="appTypeCd !=null and appTypeCd != ''">
  229. , t.app_type_cd= #{appTypeCd}
  230. </if>
  231. <if test="memberId !=null and memberId != ''">
  232. , t.member_id= #{memberId}
  233. </if>
  234. <if test="userId !=null and userId != ''">
  235. , t.user_id= #{userId}
  236. </if>
  237. <if test="appType !=null and appType != ''">
  238. , t.app_type = #{appType}
  239. </if>
  240. <if test="nickName !=null and nickName != ''">
  241. , t.nickname= #{nickName}
  242. </if>
  243. <if test="headImgUrl !=null and headImgUrl != ''">
  244. , t.headimgurl= #{headImgUrl}
  245. </if>
  246. where 1=1
  247. <if test="appUserId !=null and appUserId != ''">
  248. and t.app_user_id= #{appUserId}
  249. </if>
  250. <if test="memberId !=null and memberId != ''">
  251. and t.member_id= #{memberId}
  252. </if>
  253. <if test="communityId !=null and communityId != ''">
  254. and t.community_id= #{communityId}
  255. </if>
  256. <if test="bId !=null and bId != ''">
  257. and t.b_id= #{bId}
  258. </if>
  259. </update>
  260. <!-- 查询绑定业主数量 add by wuxw 2018-07-03 -->
  261. <select id="queryOwnerAppUsersCount" parameterType="Map" resultType="Map">
  262. select count(1) count
  263. from owner_app_user t,t_dict td1
  264. where 1 =1
  265. and t.state = td1.status_cd
  266. and td1.table_name = 'owner_app_user'
  267. and td1.table_columns = 'state'
  268. and t.status_cd = '0'
  269. <if test="idCard !=null and idCard != ''">
  270. and t.id_card= #{idCard}
  271. </if>
  272. <if test="openId !=null and openId != ''">
  273. and t.open_id= #{openId}
  274. </if>
  275. <if test="link !=null and link != ''">
  276. and t.link= #{link}
  277. </if>
  278. <if test="remark !=null and remark != ''">
  279. and t.remark= #{remark}
  280. </if>
  281. <if test="statusCd !=null and statusCd != ''">
  282. and t.status_cd= #{statusCd}
  283. </if>
  284. <if test="appUserName !=null and appUserName != ''">
  285. and t.app_user_name= #{appUserName}
  286. </if>
  287. <if test="communityName !=null and communityName != ''">
  288. and t.community_name= #{communityName}
  289. </if>
  290. <if test="state !=null and state != ''">
  291. and t.state= #{state}
  292. </if>
  293. <if test="appUserId !=null and appUserId != ''">
  294. and t.app_user_id= #{appUserId}
  295. </if>
  296. <if test="communityId !=null and communityId != ''">
  297. and t.community_id= #{communityId}
  298. </if>
  299. <if test="appTypeCd !=null and appTypeCd != ''">
  300. and t.app_type_cd= #{appTypeCd}
  301. </if>
  302. <if test="bId !=null and bId != ''">
  303. and t.b_id= #{bId}
  304. </if>
  305. <if test="memberId !=null and memberId != ''">
  306. and t.member_id= #{memberId}
  307. </if>
  308. <if test="appType !=null and appType != ''">
  309. and t.app_type = #{appType}
  310. </if>
  311. <if test="userIds !=null">
  312. and t.user_id in
  313. <foreach collection="userIds" open="(" close=")"
  314. separator="," item="item">
  315. #{item}
  316. </foreach>
  317. </if>
  318. <if test="userId !=null and userId != ''">
  319. and t.user_id= #{userId}
  320. </if>
  321. </select>
  322. </mapper>