StoreServiceDaoImplMapper.xml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  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="storeServiceDaoImpl">
  6. <!-- 保存商户信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveBusinessStoreInfo" parameterType="Map">
  8. insert into business_store(store_id,b_id,user_id,name,address,tel,store_type_cd,nearby_landmarks,map_x,map_y,month,operate)
  9. values(#{storeId},#{bId},#{userId},#{name},#{address},#{tel},#{storeTypeCd},#{nearbyLandmarks},#{mapX},#{mapY},#{month},#{operate})
  10. </insert>
  11. <!-- 保存商户属性信息 add by wuxw 2018-07-03 -->
  12. <insert id="saveBusinessStoreAttr" parameterType="Map">
  13. insert into business_store_attr(b_id,attr_id,store_id,spec_cd,value,month,operate)
  14. values(#{bId},#{attrId},#{storeId},#{specCd},#{value},#{month},#{operate})
  15. </insert>
  16. <!-- 保存商户照片信息 add by wuxw 2018-07-03 -->
  17. <insert id="saveBusinessStorePhoto" parameterType="Map">
  18. insert into business_store_photo(store_photo_id,b_id,store_id,store_photo_type_cd,photo,month,operate)
  19. values(#{storePhotoId},#{bId},#{storeId},#{storePhotoTypeCd},#{photo},#{month},#{operate})
  20. </insert>
  21. <!-- 保存商户证件信息 add by wuxw 2018-07-03 -->
  22. <insert id="saveBusinessStoreCerdentials" parameterType="Map">
  23. insert into business_store_cerdentials(store_cerdentials_id,b_id,store_id,credentials_cd,value,validity_period,positive_photo,negative_photo,month,operate)
  24. values(#{storeCerdentialsId},#{bId},#{storeId},#{credentialsCd},#{value},#{validityPeriod},#{positivePhoto},#{negativePhoto},#{month},#{operate})
  25. </insert>
  26. <!-- 查询商户信息(Business) add by wuxw 2018-07-03 -->
  27. <select id="getBusinessStoreInfo" parameterType="Map" resultType="Map">
  28. select s.store_id,s.b_id,s.user_id,s.name,s.address,s.tel,s.store_type_cd,s.nearby_landmarks,s.map_x,s.map_y,s.operate
  29. from business_store s where 1 = 1
  30. <if test="operate != null and operate != ''">
  31. and s.operate = #{operate}
  32. </if>
  33. <if test="bId != null and bId !=''">
  34. and s.b_id = #{bId}
  35. </if>
  36. <if test="storeId != null and storeId != ''">
  37. and s.store_id = #{storeId}
  38. </if>
  39. </select>
  40. <!-- 查询商户属性信息(Business) add by wuxw 2018-07-03 -->
  41. <select id="getBusinessStoreAttrs" parameterType="Map" resultType="Map">
  42. select sa.b_id,sa.attr_id,sa.store_id,sa.spec_cd,sa.value,sa.operate
  43. from business_store_attr sa where 1=1
  44. <if test="operate != null and operate != ''">
  45. and sa.operate = #{operate}
  46. </if>
  47. <if test="bId != null and bId !=''">
  48. and sa.b_id = #{bId}
  49. </if>
  50. <if test="storeId != null and storeId != ''">
  51. and sa.store_id = #{storeId}
  52. </if>
  53. <if test="attrId != null and attrId != ''">
  54. and sa.attr_id = #{attrId}
  55. </if>
  56. </select>
  57. <!-- 查询商户照片信息 add by wuxw 2018-07-03 -->
  58. <select id="getBusinessStorePhoto" parameterType="Map" resultType="Map">
  59. select sp.store_photo_id,sp.b_id,sp.store_id,sp.store_photo_type_cd,sp.photo,sp.operate
  60. from business_store_photo sp where 1=1
  61. <if test="bId != null and bId !=''">
  62. and sp.b_id = #{bId}
  63. </if>
  64. <if test="operate != null and operate != ''">
  65. and sp.operate = #{operate}
  66. </if>
  67. <if test="storeId != null and storeId != ''">
  68. and sp.store_id = #{storeId}
  69. </if>
  70. </select>
  71. <!-- 查询商户 证件信息 add by wuxw 2018-07-03 -->
  72. <select id="getBusinessStoreCerdentials" parameterType="Map" resultType="Map">
  73. select sc.store_cerdentials_id,sc.b_id,sc.store_id,sc.credentials_cd,sc.value,sc.validity_period,sc.positive_photo,sc.negative_photo,sc.operate
  74. from business_store_cerdentials sc where 1 = 1
  75. <if test="bId != null and bId !=''">
  76. and sc.b_id = #{bId}
  77. </if>
  78. <if test="operate != null and operate != ''">
  79. and sc.operate = #{operate}
  80. </if>
  81. <if test="storeId != null and storeId != ''">
  82. and sc.store_id = #{storeId}
  83. </if>
  84. </select>
  85. <!-- 保存商户信息至 instance表中 add by wuxw 2018-07-03 -->
  86. <insert id="saveStoreInfoInstance" parameterType="Map">
  87. insert into s_store(store_id,b_id,user_id,name,address,tel,store_type_cd,nearby_landmarks,map_x,map_y,status_cd)
  88. select s.store_id,s.b_id,s.user_id,s.name,s.address,s.tel,s.store_type_cd,s.nearby_landmarks,s.map_x,s.map_y,'0'
  89. from business_store s where
  90. s.operate = 'ADD' and s.b_id=#{bId}
  91. </insert>
  92. <!-- 保存商户属性信息到 instance add by wuxw 2018-07-03 -->
  93. <insert id="saveStoreAttrsInstance" parameterType="Map">
  94. insert into s_store_attr(b_id,attr_id,store_id,spec_cd,value,status_cd)
  95. select sa.b_id,sa.attr_id,sa.store_id,sa.spec_cd,sa.value,'0'
  96. from business_store_attr sa
  97. where sa.operate = 'ADD' and sa.b_id=#{bId}
  98. </insert>
  99. <!-- 保存 商户照片信息 instance add by wuxw 2018-07-03 -->
  100. <insert id="saveStorePhotoInstance" parameterType="Map">
  101. insert into s_store_photo(store_photo_id,b_id,store_id,store_photo_type_cd,photo,status_cd)
  102. select sp.store_photo_id,sp.b_id,sp.store_id,sp.store_photo_type_cd,sp.photo,'0'
  103. from business_store_photo sp
  104. where sp.operate = 'ADD' and sp.b_id=#{bId}
  105. </insert>
  106. <!-- 保存 商户证件信息 instance add by wuxw 2018-07-03 -->
  107. <insert id="saveStoreCerdentialsInstance" parameterType="Map">
  108. insert into s_store_cerdentials(store_cerdentials_id,b_id,store_id,credentials_cd,value,validity_period,positive_photo,negative_photo,status_cd)
  109. select sc.store_cerdentials_id,sc.b_id,sc.store_id,sc.credentials_cd,sc.value,sc.validity_period,sc.positive_photo,sc.negative_photo,'0'
  110. from business_store_cerdentials sc
  111. where sc.operate = 'ADD' and sc.b_id=#{bId}
  112. </insert>
  113. <!-- 查询商户信息 add by wuxw 2018-07-03 -->
  114. <select id="getStoreInfo" parameterType="Map" resultType="Map">
  115. select s.store_id,s.store_id storeId,
  116. s.b_id,
  117. s.user_id,
  118. s.name,
  119. s.address,
  120. s.tel,
  121. s.store_type_cd,
  122. s.nearby_landmarks,
  123. s.map_x,s.map_y,
  124. s.status_cd
  125. from s_store s
  126. where 1=1
  127. <if test="statusCd != null and statusCd != ''">
  128. and s.status_cd = #{statusCd}
  129. </if>
  130. <if test="bId != null and bId !=''">
  131. and s.b_id = #{bId}
  132. </if>
  133. <if test="storeId != null and storeId !=''">
  134. and s.store_id = #{storeId}
  135. </if>
  136. </select>
  137. <!-- 查询商户属性信息 add by wuxw 2018-07-03 -->
  138. <select id="getStoreAttrs" parameterType="Map" resultType="Map">
  139. select sa.b_id,sa.attr_id,sa.store_id,sa.spec_cd,sa.value,sa.status_cd
  140. from s_store_attr sa
  141. where
  142. 1=1
  143. <if test="statusCd != null and statusCd != ''">
  144. and sa.status_cd = #{statusCd}
  145. </if>
  146. <if test="bId != null and bId !=''">
  147. and sa.b_id = #{bId}
  148. </if>
  149. <if test="storeId != null and storeId !=''">
  150. and sa.store_id = #{storeId}
  151. </if>
  152. <if test="attrId != null and attrId != ''">
  153. and sa.attr_id = #{attrId}
  154. </if>
  155. </select>
  156. <!-- 查询商户照片信息 add by wuxw 2018-07-03 -->
  157. <select id="getStorePhoto" parameterType="Map" resultType="Map">
  158. select sp.store_photo_id,sp.b_id,sp.store_id,sp.store_photo_type_cd,sp.photo,sp.status_cd
  159. from s_store_photo sp
  160. where 1=1
  161. <if test="statusCd != null and statusCd != ''">
  162. and sp.status_cd = #{statusCd}
  163. </if>
  164. <if test="bId != null and bId !=''">
  165. and sp.b_id = #{bId}
  166. </if>
  167. <if test="storeId != null and storeId !=''">
  168. and sp.store_id = #{storeId}
  169. </if>
  170. </select>
  171. <!-- 查询商户证件信息 add by wuxw 2018-07-03 -->
  172. <select id="getStoreCerdentials" parameterType="Map" resultType="Map">
  173. select sc.store_cerdentials_id,sc.b_id,sc.store_id,sc.credentials_cd,sc.value,sc.validity_period,sc.positive_photo,sc.negative_photo,sc.status_cd
  174. from s_store_cerdentials sc
  175. where 1=1
  176. <if test="statusCd != null and statusCd != ''">
  177. and sc.status_cd = #{statusCd}
  178. </if>
  179. <if test="bId != null and bId !=''">
  180. and sc.b_id = #{bId}
  181. </if>
  182. <if test="storeId != null and storeId !=''">
  183. and sc.store_id = #{storeId}
  184. </if>
  185. </select>
  186. <!-- 修改商户信息 add by wuxw 2018-07-03 -->
  187. <update id="updateStoreInfoInstance" parameterType="Map">
  188. update s_store s set s.status_cd = #{statusCd}
  189. <if test="newBId != null and newBId != ''">
  190. ,s.b_id = #{newBId}
  191. </if>
  192. <if test="userId != null and userId != ''">
  193. ,s.user_id = #{userId}
  194. </if>
  195. <if test="name != null and name != ''">
  196. ,s.name = #{name}
  197. </if>
  198. <if test="address != null and address != ''">
  199. ,s.address = #{address}
  200. </if>
  201. <if test="tel != null and tel != ''">
  202. ,s.tel = #{tel}
  203. </if>
  204. <if test="storeTypeCd != null and storeTypeCd != ''">
  205. ,s.store_type_cd = #{storeTypeCd}
  206. </if>
  207. <if test="nearbyLandmarks != null and nearbyLandmarks != ''">
  208. ,s.nearby_landmarks = #{nearbyLandmarks}
  209. </if>
  210. <if test="mapX != null and mapX != ''">
  211. ,s.map_x = #{mapX}
  212. </if>
  213. <if test="mapY != null and mapY != ''">
  214. ,s.map_y = #{mapY}
  215. </if>
  216. where 1=1
  217. <if test="bId != null and bId !=''">
  218. and s.b_id = #{bId}
  219. </if>
  220. <if test="storeId != null and storeId !=''">
  221. and s.store_id = #{storeId}
  222. </if>
  223. </update>
  224. <!-- 修改商户属性信息 add by wuxw 2018-07-03 -->
  225. <update id="updateStoreAttrInstance" parameterType="Map">
  226. update s_store_attr sa set sa.status_cd = #{statusCd}
  227. <if test="newBId != null and newBId != ''">
  228. ,sa.b_id = #{newBId}
  229. </if>
  230. <if test="value != null and value != ''">
  231. ,sa.value = #{value}
  232. </if>
  233. where 1=1
  234. <if test="bId != null and bId !=''">
  235. and sa.b_id = #{bId}
  236. </if>
  237. <if test="storeId != null and storeId !=''">
  238. and sa.store_id = #{storeId}
  239. </if>
  240. <if test="specCd != null and specCd !=''">
  241. and sa.spec_cd = #{specCd}
  242. </if>
  243. <if test="attrId != null and attrId !=''">
  244. and sa.attr_id = #{attrId}
  245. </if>
  246. </update>
  247. <!-- 修改商户照片信息 add by wuxw 2018-07-03 -->
  248. <update id="updateStorePhotoInstance" parameterType="Map">
  249. update s_store_photo sp set sp.status_cd = #{statusCd}
  250. <if test="newBId != null and newBId != ''">
  251. ,sp.b_id = #{newBId}
  252. </if>
  253. <if test="storePhotoTypeCd != null and storePhotoTypeCd != ''">
  254. ,sp.store_photo_type_cd = #{storePhotoTypeCd}
  255. </if>
  256. <if test="photo != null and photo != ''">
  257. ,sp.photo = #{photo}
  258. </if>
  259. where 1=1
  260. <if test="bId != null and bId !=''">
  261. and sp.b_id = #{bId}
  262. </if>
  263. <if test="storeId != null and storeId !=''">
  264. and sp.store_id = #{storeId}
  265. </if>
  266. <if test="storePhotoId != null and storePhotoId !=''">
  267. and sp.store_photo_id = #{storePhotoId}
  268. </if>
  269. </update>
  270. <!-- 修改商户证件信息 add by wuxw 2018-07-03 -->
  271. <update id="updateStoreCerdentailsInstance" parameterType="Map">
  272. update s_store_cerdentials sc set sc.status_cd = #{statusCd}
  273. <if test="newBId != null and newBId != ''">
  274. ,sc.b_id = #{newBId}
  275. </if>
  276. <if test="credentialsCd != null and credentialsCd != ''">
  277. ,sc.credentials_cd = #{credentialsCd}
  278. </if>
  279. <if test="value != null and value != ''">
  280. ,sc.value = #{value}
  281. </if>
  282. <if test="validityPeriod != null">
  283. ,sc.validity_period = #{validityPeriod}
  284. </if>
  285. <if test="positivePhoto != null and positivePhoto != ''">
  286. ,sc.positive_photo = #{positivePhoto}
  287. </if>
  288. <if test="negativePhoto != null and negativePhoto != ''">
  289. ,sc.negative_photo = #{negativePhoto}
  290. </if>
  291. where 1=1
  292. <if test="bId != null and bId !=''">
  293. and sc.b_id = #{bId}
  294. </if>
  295. <if test="storeId != null and storeId !=''">
  296. and sc.store_id = #{storeId}
  297. </if>
  298. <if test="storeCerdentialsId != null and storeCerdentialsId !=''">
  299. and sc.store_cerdentials_id = #{storeCerdentialsId}
  300. </if>
  301. </update>
  302. <!--商户成员加入 add by wuxw 2018-10-27 saveBusinessMemberStore-->
  303. <insert id="saveBusinessMemberStore" parameterType="Map">
  304. insert into business_member_store(member_store_id,b_id,store_id,member_id,month,operate)
  305. values(#{memberStoreId},#{bId},#{storeId},#{memberId},#{month},#{operate})
  306. </insert>
  307. <!-- 商户成员加入 instance表中 add by wuxw 2018-10-27 -->
  308. <insert id="saveMemberStoreInstance" parameterType="Map">
  309. insert into s_member_store(member_store_id,b_id,store_id,member_id,status_cd)
  310. select ms.member_store_id,ms.b_id,ms.store_id,ms.member_id,'0'
  311. from business_member_store ms where
  312. ms.operate = 'ADD' and ms.b_id=#{bId}
  313. </insert>
  314. <!-- 查询商户成员 add by wuxw 2018-10-27 getBusinessMemberStore-->
  315. <select id="getBusinessMemberStore" parameterType="Map" resultType="Map">
  316. select ms.member_store_id,ms.b_id,ms.store_id,ms.member_id,ms.operate
  317. from business_member_store ms where 1 = 1
  318. <if test="operate != null and operate != ''">
  319. and ms.operate = #{operate}
  320. </if>
  321. <if test="bId != null and bId !=''">
  322. and ms.b_id = #{bId}
  323. </if>
  324. <if test="storeId != null and storeId != ''">
  325. and ms.store_id = #{storeId}
  326. </if>
  327. </select>
  328. <!-- 查询商户成员 add by wuxw 2018-07-03 -->
  329. <select id="getMemberStore" parameterType="Map" resultType="Map">
  330. select ms.member_store_id,ms.b_id,ms.store_id,ms.member_id,ms.status_cd
  331. from business_member_store ms
  332. where 1=1
  333. <if test="statusCd != null and statusCd != ''">
  334. and ms.status_cd = #{statusCd}
  335. </if>
  336. <if test="bId != null and bId !=''">
  337. and ms.b_id = #{bId}
  338. </if>
  339. <if test="storeId != null and storeId !=''">
  340. and ms.member_store_id = #{memberStoreId}
  341. </if>
  342. </select>
  343. <!-- 修改商户成员 add by wuxw 2018-07-03 -->
  344. <update id="updateMemberStoreInstance" parameterType="Map">
  345. update s_member_store ms set ms.status_cd = #{statusCd}
  346. <if test="newBId != null and newBId != ''">
  347. ,ms.b_id = #{newBId}
  348. </if>
  349. where 1=1
  350. <if test="bId != null and bId !=''">
  351. and ms.b_id = #{bId}
  352. </if>
  353. <if test="memberStoreId != null and memberStoreId !=''">
  354. and ms.member_store_id = #{memberStoreId}
  355. </if>
  356. </update>
  357. <!-- 保存物业用户信息 add by wuxw 2018-07-03 -->
  358. <insert id="saveBusinessStoreUser" parameterType="Map">
  359. insert into business_store_user(store_user_id,b_id,store_id,user_id,rel_cd,month,operate)
  360. values(#{storeUserId},#{bId},#{storeId},#{userId},#{relCd},#{month},#{operate})
  361. </insert>
  362. <!-- 查询物业 用户信息 add by wuxw 2018-07-03 -->
  363. <select id="getBusinessStoreUser" parameterType="Map" resultType="Map">
  364. select sc.store_user_id,sc.b_id,sc.store_id,sc.user_id,sc.rel_cd,sc.operate
  365. from business_store_user sc where 1 = 1
  366. <if test="bId != null and bId !=''">
  367. and sc.b_id = #{bId}
  368. </if>
  369. <if test="operate != null and operate != ''">
  370. and sc.operate = #{operate}
  371. </if>
  372. <if test="storeId != null and storeId != ''">
  373. and sc.store_id = #{storeId}
  374. </if>
  375. </select>
  376. <!-- 保存 商户用户信息 instance add by wuxw 2018-07-03 -->
  377. <insert id="saveStoreUserInstance" parameterType="Map">
  378. insert into s_store_user(store_user_id,b_id,store_id,user_id,rel_cd,status_cd)
  379. select sc.store_user_id,sc.b_id,sc.store_id,sc.user_id,sc.rel_cd,'0'
  380. from business_store_user sc
  381. where sc.operate = 'ADD' and sc.b_id=#{bId}
  382. </insert>
  383. <!-- 查询商户证件信息 add by wuxw 2018-07-03 -->
  384. <select id="getStoreUser" parameterType="Map" resultType="Map">
  385. select sc.store_user_id,sc.b_id,sc.store_id,sc.user_id,sc.rel_cd,sc.status_cd
  386. from s_store_user sc
  387. where 1=1
  388. <if test="statusCd != null and statusCd != ''">
  389. and sc.status_cd = #{statusCd}
  390. </if>
  391. <if test="bId != null and bId !=''">
  392. and sc.b_id = #{bId}
  393. </if>
  394. <if test="storeId != null and storeId !=''">
  395. and sc.store_id = #{storeId}
  396. </if>
  397. <if test="userId != null and userId !=''">
  398. and sc.user_id = #{userId}
  399. </if>
  400. </select>
  401. <!-- 修改商户用户信息 add by wuxw 2018-07-03 -->
  402. <update id="updateStoreUserInstance" parameterType="Map">
  403. update s_store_user sc set sc.status_cd = #{statusCd}
  404. <if test="newBId != null and newBId != ''">
  405. ,sc.b_id = #{newBId}
  406. </if>
  407. <if test="relCd != null and relCd != ''">
  408. ,sc.rel_cd = #{relCd}
  409. </if>
  410. where 1=1
  411. <if test="bId != null and bId !=''">
  412. and sc.b_id = #{bId}
  413. </if>
  414. <if test="storeId != null and storeId !=''">
  415. and sc.store_id = #{storeId}
  416. </if>
  417. <if test="storeUserId != null and storeUserId !=''">
  418. and sc.store_user_id = #{storeUserId}
  419. </if>
  420. </update>
  421. <!-- 查询商户 -->
  422. <select id="getStores" parameterType="Map" resultType="Map">
  423. select s.store_id,s.b_id,s.user_id,s.name,s.name storeName,s.address,s.tel,s.store_id storeId,
  424. s.store_type_cd,s.store_type_cd storeTypeCd, s.nearby_landmarks,s.map_x,s.map_y,s.status_cd,
  425. st.name storeTypeName
  426. from s_store s,store_type st
  427. where s.status_cd = '0'
  428. and s.store_type_cd = st.store_type_cd
  429. <if test="userId != null and userId != ''">
  430. and s.user_id = #{userId}
  431. </if>
  432. <if test="name != null and name !=''">
  433. and s.name like concat('%',#{name},'%')
  434. </if>
  435. <if test="address != null and address != ''">
  436. and s.address like concat('%',#{address},'%')
  437. </if>
  438. <if test="tel != null and tel != ''">
  439. and s.tel = #{tel}
  440. </if>
  441. <if test="storeTypeCd != null and storeTypeCd != ''">
  442. and s.store_type_cd = #{storeTypeCd}
  443. </if>
  444. <if test="nearbyLandmarks != null and nearbyLandmarks != ''">
  445. and s.nearby_landmarks = #{nearbyLandmarks}
  446. </if>
  447. <if test="storeId != null and storeId !=''">
  448. and s.store_id = #{storeId}
  449. </if>
  450. <if test="storeIds !=null">
  451. and s.store_id in
  452. <foreach collection="storeIds" open="(" close=")"
  453. separator="," item="item">
  454. #{item}
  455. </foreach>
  456. </if>
  457. order by s.create_time desc
  458. <if test="page != -1 and page != null ">
  459. limit #{page}, #{row}
  460. </if>
  461. </select>
  462. </mapper>