StoreServiceDaoImplMapper.xml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  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,
  9. map_y, month, operate)
  10. values (#{storeId}, #{bId}, #{userId}, #{name}, #{address}, #{tel}, #{storeTypeCd}, #{nearByLandmarks}, #{mapX},
  11. #{mapY}, #{month}, #{operate})
  12. </insert>
  13. <!-- 保存商户属性信息 add by wuxw 2018-07-03 -->
  14. <insert id="saveBusinessStoreAttr" parameterType="Map">
  15. insert into business_store_attr(b_id, attr_id, store_id, spec_cd, value, month, operate)
  16. values (#{bId}, #{attrId}, #{storeId}, #{specCd}, #{value}, #{month}, #{operate})
  17. </insert>
  18. <!-- 保存商户照片信息 add by wuxw 2018-07-03 -->
  19. <insert id="saveBusinessStorePhoto" parameterType="Map">
  20. insert into business_store_photo(store_photo_id, b_id, store_id, store_photo_type_cd, photo, month, operate)
  21. values (#{storePhotoId}, #{bId}, #{storeId}, #{storePhotoTypeCd}, #{photo}, #{month}, #{operate})
  22. </insert>
  23. <!-- 保存商户证件信息 add by wuxw 2018-07-03 -->
  24. <insert id="saveBusinessStoreCerdentials" parameterType="Map">
  25. insert into business_store_cerdentials(store_cerdentials_id, b_id, store_id, credentials_cd, value,
  26. validity_period, positive_photo, negative_photo, month, operate)
  27. values (#{storeCerdentialsId}, #{bId}, #{storeId}, #{credentialsCd}, #{value}, #{validityPeriod},
  28. #{positivePhoto}, #{negativePhoto}, #{month}, #{operate})
  29. </insert>
  30. <!-- 查询商户信息(Business) add by wuxw 2018-07-03 -->
  31. <select id="getBusinessStoreInfo" parameterType="Map" resultType="Map">
  32. select
  33. 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
  34. from business_store s where 1 = 1
  35. <if test="operate != null and operate != ''">
  36. and s.operate = #{operate}
  37. </if>
  38. <if test="bId != null and bId !=''">
  39. and s.b_id = #{bId}
  40. </if>
  41. <if test="storeId != null and storeId != ''">
  42. and s.store_id = #{storeId}
  43. </if>
  44. </select>
  45. <!-- 查询商户属性信息(Business) add by wuxw 2018-07-03 -->
  46. <select id="getBusinessStoreAttrs" parameterType="Map" resultType="Map">
  47. select sa.b_id,sa.attr_id,sa.store_id,sa.spec_cd,sa.value,sa.operate
  48. from business_store_attr sa where 1=1
  49. <if test="operate != null and operate != ''">
  50. and sa.operate = #{operate}
  51. </if>
  52. <if test="bId != null and bId !=''">
  53. and sa.b_id = #{bId}
  54. </if>
  55. <if test="storeId != null and storeId != ''">
  56. and sa.store_id = #{storeId}
  57. </if>
  58. <if test="attrId != null and attrId != ''">
  59. and sa.attr_id = #{attrId}
  60. </if>
  61. </select>
  62. <!-- 查询商户照片信息 add by wuxw 2018-07-03 -->
  63. <select id="getBusinessStorePhoto" parameterType="Map" resultType="Map">
  64. select sp.store_photo_id,sp.b_id,sp.store_id,sp.store_photo_type_cd,sp.photo,sp.operate
  65. from business_store_photo sp where 1=1
  66. <if test="bId != null and bId !=''">
  67. and sp.b_id = #{bId}
  68. </if>
  69. <if test="operate != null and operate != ''">
  70. and sp.operate = #{operate}
  71. </if>
  72. <if test="storeId != null and storeId != ''">
  73. and sp.store_id = #{storeId}
  74. </if>
  75. </select>
  76. <!-- 查询商户 证件信息 add by wuxw 2018-07-03 -->
  77. <select id="getBusinessStoreCerdentials" parameterType="Map" resultType="Map">
  78. select
  79. 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
  80. from business_store_cerdentials sc where 1 = 1
  81. <if test="bId != null and bId !=''">
  82. and sc.b_id = #{bId}
  83. </if>
  84. <if test="operate != null and operate != ''">
  85. and sc.operate = #{operate}
  86. </if>
  87. <if test="storeId != null and storeId != ''">
  88. and sc.store_id = #{storeId}
  89. </if>
  90. </select>
  91. <!-- 保存商户信息至 instance表中 add by wuxw 2018-07-03 -->
  92. <insert id="saveStoreInfoInstance" parameterType="Map">
  93. insert into s_store(store_id, b_id, user_id, name, address, tel, store_type_cd, nearby_landmarks, map_x, map_y,
  94. status_cd)
  95. select s.store_id,
  96. s.b_id,
  97. s.user_id,
  98. s.name,
  99. s.address,
  100. s.tel,
  101. s.store_type_cd,
  102. s.nearby_landmarks,
  103. s.map_x,
  104. s.map_y,
  105. '0'
  106. from business_store s
  107. where s.operate = 'ADD'
  108. and s.b_id = #{bId}
  109. </insert>
  110. <!-- 保存商户属性信息到 instance add by wuxw 2018-07-03 -->
  111. <insert id="saveStoreAttrsInstance" parameterType="Map">
  112. insert into s_store_attr(b_id, attr_id, store_id, spec_cd, value, status_cd)
  113. select sa.b_id, sa.attr_id, sa.store_id, sa.spec_cd, sa.value, '0'
  114. from business_store_attr sa
  115. where sa.operate = 'ADD'
  116. and sa.b_id = #{bId}
  117. </insert>
  118. <!-- 保存 商户照片信息 instance add by wuxw 2018-07-03 -->
  119. <insert id="saveStorePhotoInstance" parameterType="Map">
  120. insert into s_store_photo(store_photo_id, b_id, store_id, store_photo_type_cd, photo, status_cd)
  121. select sp.store_photo_id, sp.b_id, sp.store_id, sp.store_photo_type_cd, sp.photo, '0'
  122. from business_store_photo sp
  123. where sp.operate = 'ADD'
  124. and sp.b_id = #{bId}
  125. </insert>
  126. <!-- 保存 商户证件信息 instance add by wuxw 2018-07-03 -->
  127. <insert id="saveStoreCerdentialsInstance" parameterType="Map">
  128. insert into s_store_cerdentials(store_cerdentials_id, b_id, store_id, credentials_cd, value, validity_period,
  129. positive_photo, negative_photo, status_cd)
  130. select sc.store_cerdentials_id,
  131. sc.b_id,
  132. sc.store_id,
  133. sc.credentials_cd,
  134. sc.value,
  135. sc.validity_period,
  136. sc.positive_photo,
  137. sc.negative_photo,
  138. '0'
  139. from business_store_cerdentials sc
  140. where sc.operate = 'ADD'
  141. and sc.b_id = #{bId}
  142. </insert>
  143. <!-- 查询商户信息 add by wuxw 2018-07-03 -->
  144. <select id="getStoreInfo" parameterType="Map" resultType="Map">
  145. select s.store_id,s.store_id storeId,
  146. s.b_id,
  147. s.user_id,
  148. s.name,
  149. s.address,
  150. s.tel,
  151. s.store_type_cd,
  152. s.nearby_landmarks,
  153. s.map_x,s.map_y,
  154. s.status_cd
  155. from s_store s
  156. where 1=1
  157. <if test="statusCd != null and statusCd != ''">
  158. and s.status_cd = #{statusCd}
  159. </if>
  160. <if test="bId != null and bId !=''">
  161. and s.b_id = #{bId}
  162. </if>
  163. <if test="storeId != null and storeId !=''">
  164. and s.store_id = #{storeId}
  165. </if>
  166. </select>
  167. <!-- 查询商户属性信息 add by wuxw 2018-07-03 -->
  168. <select id="getStoreAttrs" parameterType="Map" resultType="Map">
  169. select
  170. sa.b_id,sa.attr_id,sa.attr_id attrId,
  171. sa.store_id, sa.store_id storeId,sa.spec_cd,sa.spec_cd specCd,sa.value,sa.status_cd,
  172. c.name
  173. from s_store_attr sa inner join spec c on sa.spec_cd = c.spec_cd
  174. where
  175. 1=1
  176. <if test="statusCd != null and statusCd != ''">
  177. and sa.status_cd = #{statusCd}
  178. </if>
  179. <if test="bId != null and bId !=''">
  180. and sa.b_id = #{bId}
  181. </if>
  182. <if test="storeId != null and storeId !=''">
  183. and sa.store_id = #{storeId}
  184. </if>
  185. <if test="storeIds != null">
  186. and sa.store_id in
  187. <foreach collection="storeIds" open="(" close=")"
  188. separator="," item="item">
  189. #{item}
  190. </foreach>
  191. </if>
  192. <if test="specCd != null and specCd !=''">
  193. and sa.spec_cd = #{specCd}
  194. </if>
  195. <if test="attrId != null and attrId != ''">
  196. and sa.attr_id = #{attrId}
  197. </if>
  198. </select>
  199. <!-- 查询商户照片信息 add by wuxw 2018-07-03 -->
  200. <select id="getStorePhoto" parameterType="Map" resultType="Map">
  201. select sp.store_photo_id,sp.b_id,sp.store_id,sp.store_photo_type_cd,sp.photo,sp.status_cd
  202. from s_store_photo sp
  203. where 1=1
  204. <if test="statusCd != null and statusCd != ''">
  205. and sp.status_cd = #{statusCd}
  206. </if>
  207. <if test="bId != null and bId !=''">
  208. and sp.b_id = #{bId}
  209. </if>
  210. <if test="storeId != null and storeId !=''">
  211. and sp.store_id = #{storeId}
  212. </if>
  213. </select>
  214. <!-- 查询商户证件信息 add by wuxw 2018-07-03 -->
  215. <select id="getStoreCerdentials" parameterType="Map" resultType="Map">
  216. select
  217. 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
  218. from s_store_cerdentials sc
  219. where 1=1
  220. <if test="statusCd != null and statusCd != ''">
  221. and sc.status_cd = #{statusCd}
  222. </if>
  223. <if test="bId != null and bId !=''">
  224. and sc.b_id = #{bId}
  225. </if>
  226. <if test="storeId != null and storeId !=''">
  227. and sc.store_id = #{storeId}
  228. </if>
  229. </select>
  230. <!-- 修改商户信息 add by wuxw 2018-07-03 -->
  231. <update id="updateStoreInfoInstance" parameterType="Map">
  232. update s_store s set s.status_cd = #{statusCd}
  233. <if test="newBId != null and newBId != ''">
  234. ,s.b_id = #{newBId}
  235. </if>
  236. <if test="userId != null and userId != ''">
  237. ,s.user_id = #{userId}
  238. </if>
  239. <if test="name != null and name != ''">
  240. ,s.name = #{name}
  241. </if>
  242. <if test="address != null and address != ''">
  243. ,s.address = #{address}
  244. </if>
  245. <if test="tel != null and tel != ''">
  246. ,s.tel = #{tel}
  247. </if>
  248. <if test="storeTypeCd != null and storeTypeCd != ''">
  249. ,s.store_type_cd = #{storeTypeCd}
  250. </if>
  251. <if test="nearbyLandmarks != null and nearbyLandmarks != ''">
  252. ,s.nearby_landmarks = #{nearbyLandmarks}
  253. </if>
  254. <if test="mapX != null and mapX != ''">
  255. ,s.map_x = #{mapX}
  256. </if>
  257. <if test="mapY != null and mapY != ''">
  258. ,s.map_y = #{mapY}
  259. </if>
  260. where 1=1
  261. <if test="bId != null and bId !=''">
  262. and s.b_id = #{bId}
  263. </if>
  264. <if test="storeId != null and storeId !=''">
  265. and s.store_id = #{storeId}
  266. </if>
  267. </update>
  268. <!-- 修改商户属性信息 add by wuxw 2018-07-03 -->
  269. <update id="updateStoreAttrInstance" parameterType="Map">
  270. update s_store_attr sa set sa.status_cd = #{statusCd}
  271. <if test="newBId != null and newBId != ''">
  272. ,sa.b_id = #{newBId}
  273. </if>
  274. <if test="value != null and value != ''">
  275. ,sa.value = #{value}
  276. </if>
  277. where 1=1
  278. <if test="bId != null and bId !=''">
  279. and sa.b_id = #{bId}
  280. </if>
  281. <if test="storeId != null and storeId !=''">
  282. and sa.store_id = #{storeId}
  283. </if>
  284. <if test="specCd != null and specCd !=''">
  285. and sa.spec_cd = #{specCd}
  286. </if>
  287. <if test="attrId != null and attrId !=''">
  288. and sa.attr_id = #{attrId}
  289. </if>
  290. </update>
  291. <!-- 修改商户照片信息 add by wuxw 2018-07-03 -->
  292. <update id="updateStorePhotoInstance" parameterType="Map">
  293. update s_store_photo sp set sp.status_cd = #{statusCd}
  294. <if test="newBId != null and newBId != ''">
  295. ,sp.b_id = #{newBId}
  296. </if>
  297. <if test="storePhotoTypeCd != null and storePhotoTypeCd != ''">
  298. ,sp.store_photo_type_cd = #{storePhotoTypeCd}
  299. </if>
  300. <if test="photo != null and photo != ''">
  301. ,sp.photo = #{photo}
  302. </if>
  303. where 1=1
  304. <if test="bId != null and bId !=''">
  305. and sp.b_id = #{bId}
  306. </if>
  307. <if test="storeId != null and storeId !=''">
  308. and sp.store_id = #{storeId}
  309. </if>
  310. <if test="storePhotoId != null and storePhotoId !=''">
  311. and sp.store_photo_id = #{storePhotoId}
  312. </if>
  313. </update>
  314. <!-- 修改商户证件信息 add by wuxw 2018-07-03 -->
  315. <update id="updateStoreCerdentailsInstance" parameterType="Map">
  316. update s_store_cerdentials sc set sc.status_cd = #{statusCd}
  317. <if test="newBId != null and newBId != ''">
  318. ,sc.b_id = #{newBId}
  319. </if>
  320. <if test="credentialsCd != null and credentialsCd != ''">
  321. ,sc.credentials_cd = #{credentialsCd}
  322. </if>
  323. <if test="value != null and value != ''">
  324. ,sc.value = #{value}
  325. </if>
  326. <if test="validityPeriod != null">
  327. ,sc.validity_period = #{validityPeriod}
  328. </if>
  329. <if test="positivePhoto != null and positivePhoto != ''">
  330. ,sc.positive_photo = #{positivePhoto}
  331. </if>
  332. <if test="negativePhoto != null and negativePhoto != ''">
  333. ,sc.negative_photo = #{negativePhoto}
  334. </if>
  335. where 1=1
  336. <if test="bId != null and bId !=''">
  337. and sc.b_id = #{bId}
  338. </if>
  339. <if test="storeId != null and storeId !=''">
  340. and sc.store_id = #{storeId}
  341. </if>
  342. <if test="storeCerdentialsId != null and storeCerdentialsId !=''">
  343. and sc.store_cerdentials_id = #{storeCerdentialsId}
  344. </if>
  345. </update>
  346. <!--商户成员加入 add by wuxw 2018-10-27 saveBusinessMemberStore-->
  347. <insert id="saveBusinessMemberStore" parameterType="Map">
  348. insert into business_member_store(member_store_id, b_id, store_id, member_id, month, operate)
  349. values (#{memberStoreId}, #{bId}, #{storeId}, #{memberId}, #{month}, #{operate})
  350. </insert>
  351. <!-- 商户成员加入 instance表中 add by wuxw 2018-10-27 -->
  352. <insert id="saveMemberStoreInstance" parameterType="Map">
  353. insert into s_member_store(member_store_id, b_id, store_id, member_id, status_cd)
  354. select ms.member_store_id, ms.b_id, ms.store_id, ms.member_id, '0'
  355. from business_member_store ms
  356. where ms.operate = 'ADD'
  357. and ms.b_id = #{bId}
  358. </insert>
  359. <!-- 查询商户成员 add by wuxw 2018-10-27 getBusinessMemberStore-->
  360. <select id="getBusinessMemberStore" parameterType="Map" resultType="Map">
  361. select ms.member_store_id,ms.b_id,ms.store_id,ms.member_id,ms.operate
  362. from business_member_store ms where 1 = 1
  363. <if test="operate != null and operate != ''">
  364. and ms.operate = #{operate}
  365. </if>
  366. <if test="bId != null and bId !=''">
  367. and ms.b_id = #{bId}
  368. </if>
  369. <if test="storeId != null and storeId != ''">
  370. and ms.store_id = #{storeId}
  371. </if>
  372. </select>
  373. <!-- 查询商户成员 add by wuxw 2018-07-03 -->
  374. <select id="getMemberStore" parameterType="Map" resultType="Map">
  375. select ms.member_store_id,ms.b_id,ms.store_id,ms.member_id,ms.status_cd
  376. from business_member_store ms
  377. where 1=1
  378. <if test="statusCd != null and statusCd != ''">
  379. and ms.status_cd = #{statusCd}
  380. </if>
  381. <if test="bId != null and bId !=''">
  382. and ms.b_id = #{bId}
  383. </if>
  384. <if test="storeId != null and storeId !=''">
  385. and ms.member_store_id = #{memberStoreId}
  386. </if>
  387. </select>
  388. <!-- 修改商户成员 add by wuxw 2018-07-03 -->
  389. <update id="updateMemberStoreInstance" parameterType="Map">
  390. update s_member_store ms set ms.status_cd = #{statusCd}
  391. <if test="newBId != null and newBId != ''">
  392. ,ms.b_id = #{newBId}
  393. </if>
  394. where 1=1
  395. <if test="bId != null and bId !=''">
  396. and ms.b_id = #{bId}
  397. </if>
  398. <if test="memberStoreId != null and memberStoreId !=''">
  399. and ms.member_store_id = #{memberStoreId}
  400. </if>
  401. </update>
  402. <!-- 保存物业用户信息 add by wuxw 2018-07-03 -->
  403. <insert id="saveBusinessStoreUser" parameterType="Map">
  404. insert into business_store_user(store_user_id, b_id, store_id, user_id, rel_cd, month, operate)
  405. values (#{storeUserId}, #{bId}, #{storeId}, #{userId}, #{relCd}, #{month}, #{operate})
  406. </insert>
  407. <!-- 查询物业 用户信息 add by wuxw 2018-07-03 -->
  408. <select id="getBusinessStoreUser" parameterType="Map" resultType="Map">
  409. select sc.store_user_id,sc.b_id,sc.store_id,sc.user_id,sc.rel_cd,sc.operate
  410. from business_store_user sc where 1 = 1
  411. <if test="bId != null and bId !=''">
  412. and sc.b_id = #{bId}
  413. </if>
  414. <if test="operate != null and operate != ''">
  415. and sc.operate = #{operate}
  416. </if>
  417. <if test="storeId != null and storeId != ''">
  418. and sc.store_id = #{storeId}
  419. </if>
  420. </select>
  421. <!-- 保存 商户用户信息 instance add by wuxw 2018-07-03 -->
  422. <insert id="saveStoreUserInstance" parameterType="Map">
  423. insert into s_store_user(store_user_id, b_id, store_id, user_id, rel_cd, status_cd)
  424. select sc.store_user_id, sc.b_id, sc.store_id, sc.user_id, sc.rel_cd, '0'
  425. from business_store_user sc
  426. where sc.operate = 'ADD'
  427. and sc.b_id = #{bId}
  428. </insert>
  429. <!-- 查询商户证件信息 add by wuxw 2018-07-03 -->
  430. <select id="getStoreUser" parameterType="Map" resultType="Map">
  431. select sc.store_user_id,sc.b_id,sc.store_id,sc.user_id,sc.rel_cd,sc.status_cd
  432. from s_store_user sc
  433. where 1=1
  434. <if test="statusCd != null and statusCd != ''">
  435. and sc.status_cd = #{statusCd}
  436. </if>
  437. <if test="bId != null and bId !=''">
  438. and sc.b_id = #{bId}
  439. </if>
  440. <if test="storeId != null and storeId !=''">
  441. and sc.store_id = #{storeId}
  442. </if>
  443. <if test="userId != null and userId !=''">
  444. and sc.user_id = #{userId}
  445. </if>
  446. </select>
  447. <!-- 修改商户用户信息 add by wuxw 2018-07-03 -->
  448. <update id="updateStoreUserInstance" parameterType="Map">
  449. update s_store_user sc set sc.status_cd = #{statusCd}
  450. <if test="newBId != null and newBId != ''">
  451. ,sc.b_id = #{newBId}
  452. </if>
  453. <if test="relCd != null and relCd != ''">
  454. ,sc.rel_cd = #{relCd}
  455. </if>
  456. where 1=1
  457. <if test="bId != null and bId !=''">
  458. and sc.b_id = #{bId}
  459. </if>
  460. <if test="storeId != null and storeId !=''">
  461. and sc.store_id = #{storeId}
  462. </if>
  463. <if test="storeUserId != null and storeUserId !=''">
  464. and sc.store_user_id = #{storeUserId}
  465. </if>
  466. </update>
  467. <!-- 查询商户 -->
  468. <select id="getStores" parameterType="Map" resultType="Map">
  469. select
  470. s.store_id,
  471. s.b_id,
  472. s.user_id,
  473. s.name,s.name storeName,
  474. s.address,
  475. s.tel,
  476. s.store_id storeId,
  477. s.store_type_cd,s.store_type_cd storeTypeCd,
  478. s.nearby_landmarks,s.nearby_landmarks nearByLandmarks,
  479. s.map_x,s.map_x mapX,
  480. s.map_y,s.map_y mapY,
  481. s.status_cd,
  482. st.name storeTypeName
  483. from s_store s,store_type st
  484. where s.status_cd = '0'
  485. and s.store_type_cd = st.store_type_cd
  486. <if test="userId != null and userId != ''">
  487. and s.user_id = #{userId}
  488. </if>
  489. <if test="name != null and name !=''">
  490. and s.name like concat('%',#{name},'%')
  491. </if>
  492. <if test="address != null and address != ''">
  493. and s.address like concat('%',#{address},'%')
  494. </if>
  495. <if test="tel != null and tel != ''">
  496. and s.tel = #{tel}
  497. </if>
  498. <if test="storeTypeCd != null and storeTypeCd != ''">
  499. and s.store_type_cd = #{storeTypeCd}
  500. </if>
  501. <if test="nearbyLandmarks != null and nearbyLandmarks != ''">
  502. and s.nearby_landmarks = #{nearbyLandmarks}
  503. </if>
  504. <if test="storeId != null and storeId !=''">
  505. and s.store_id = #{storeId}
  506. </if>
  507. <if test="storeIds !=null">
  508. and s.store_id in
  509. <foreach collection="storeIds" open="(" close=")"
  510. separator="," item="item">
  511. #{item}
  512. </foreach>
  513. </if>
  514. order by s.create_time desc
  515. <if test="page != -1 and page != null ">
  516. limit #{page}, #{row}
  517. </if>
  518. </select>
  519. <!-- 查询商户 -->
  520. <select id="getStoreCount" parameterType="Map" resultType="Map">
  521. select count(1) count
  522. from s_store s,store_type st
  523. where s.status_cd = '0'
  524. and s.store_type_cd = st.store_type_cd
  525. <if test="userId != null and userId != ''">
  526. and s.user_id = #{userId}
  527. </if>
  528. <if test="name != null and name !=''">
  529. and s.name like concat('%',#{name},'%')
  530. </if>
  531. <if test="address != null and address != ''">
  532. and s.address like concat('%',#{address},'%')
  533. </if>
  534. <if test="tel != null and tel != ''">
  535. and s.tel = #{tel}
  536. </if>
  537. <if test="storeTypeCd != null and storeTypeCd != ''">
  538. and s.store_type_cd = #{storeTypeCd}
  539. </if>
  540. <if test="nearbyLandmarks != null and nearbyLandmarks != ''">
  541. and s.nearby_landmarks = #{nearbyLandmarks}
  542. </if>
  543. <if test="storeId != null and storeId !=''">
  544. and s.store_id = #{storeId}
  545. </if>
  546. <if test="storeIds !=null">
  547. and s.store_id in
  548. <foreach collection="storeIds" open="(" close=")"
  549. separator="," item="item">
  550. #{item}
  551. </foreach>
  552. </if>
  553. </select>
  554. <!--查询员工和商户信息-->
  555. <select id="getStoreUserInfo" parameterType="Map" resultType="Map">
  556. select s.store_id,s.store_id storeId,s.b_id,s.user_id,s.user_id
  557. userId,s.name,s.address,s.tel,s.store_type_cd,s.store_type_cd storeTypeCd,
  558. s.nearby_landmarks,s.map_x,s.map_y,s.create_time,su.store_user_id,su.rel_cd,s.state
  559. from s_store s
  560. left join s_store_user su on s.store_id=su.store_id and su.status_cd = '0'
  561. where
  562. s.status_cd = '0'
  563. <if test="userId != null and userId != ''">
  564. and su.user_id = #{userId}
  565. </if>
  566. <if test="storeTypeCd != null and storeTypeCd != ''">
  567. and s.store_type_cd = #{storeTypeCd}
  568. </if>
  569. <if test="storeId != null and storeId != ''">
  570. and s.store_id = #{storeId}
  571. </if>
  572. </select>
  573. <select id="getStoreStaffs" parameterType="Map" resultType="Map">
  574. select t.name storeName,t.address,su.user_id staffId , t.store_id storeId,t.create_time createTime,t.state
  575. from s_store t
  576. inner join s_store_user su on t.store_id = su.store_id and su.status_cd = '0'
  577. <if test="relCd != null and relCd != ''">
  578. and su.rel_cd = #{relCd}
  579. </if>
  580. where
  581. 1=1
  582. <if test="storeTypeCd != null and storeTypeCd != ''">
  583. and t.store_type_cd = #{storeTypeCd}
  584. </if>
  585. <if test="storeId != null and storeId != ''">
  586. and t.store_id = #{storeId}
  587. </if>
  588. and t.status_cd = '0'
  589. <if test="page != -1 and page != null ">
  590. limit #{page}, #{row}
  591. </if>
  592. </select>
  593. <select id="getStoreStaffCount" parameterType="Map" resultType="Map">
  594. select count(1) count
  595. from s_store t
  596. inner join s_store_user su on t.store_id = su.store_id and su.status_cd = '0'
  597. <if test="relCd != null and relCd != ''">
  598. and su.rel_cd = #{relCd}
  599. </if>
  600. where
  601. 1=1
  602. <if test="storeTypeCd != null and storeTypeCd != ''">
  603. and t.store_type_cd = #{storeTypeCd}
  604. </if>
  605. <if test="storeId != null and storeId != ''">
  606. and t.store_id = #{storeId}
  607. </if>
  608. and t.status_cd = '0'
  609. </select>
  610. <!-- 修改商户信息 add by wuxw 2018-07-03 -->
  611. <update id="updateStore" parameterType="Map">
  612. update s_store s
  613. <set>
  614. <if test="userId != null and userId != ''">
  615. s.user_id = #{userId},
  616. </if>
  617. <if test="name != null and name != ''">
  618. s.name = #{name},
  619. </if>
  620. <if test="address != null and address != ''">
  621. s.address = #{address},
  622. </if>
  623. <if test="tel != null and tel != ''">
  624. s.tel = #{tel},
  625. </if>
  626. <if test="storeTypeCd != null and storeTypeCd != ''">
  627. s.store_type_cd = #{storeTypeCd},
  628. </if>
  629. <if test="nearbyLandmarks != null and nearbyLandmarks != ''">
  630. s.nearby_landmarks = #{nearbyLandmarks},
  631. </if>
  632. <if test="mapX != null and mapX != ''">
  633. s.map_x = #{mapX},
  634. </if>
  635. <if test="mapY != null and mapY != ''">
  636. s.map_y = #{mapY},
  637. </if>
  638. <if test="state != null and state != ''">
  639. s.state = #{state},
  640. </if>
  641. </set>
  642. where 1=1
  643. and s.store_id = #{storeId}
  644. and s.status_cd = '0'
  645. </update>
  646. </mapper>