StoreServiceDaoImplMapper.xml 24 KB

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