StoreDao.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.kmall.admin.dao.StoreDao">
  4. <resultMap type="com.kmall.admin.entity.StoreEntity" id="storeMap">
  5. <result property="id" column="id"/>
  6. <result property="merchSn" column="merch_sn"/>
  7. <result property="merchName" column="merch_name"/>
  8. <result property="storeName" column="store_name"/>
  9. <result property="storeNumber" column="store_number"/>
  10. <result property="storeAddress" column="store_address"/>
  11. <result property="provinceName" column="province_name"/>
  12. <result property="cityName" column="city_name"/>
  13. <result property="countyName" column="county_name"/>
  14. <result property="latitude" column="latitude"/>
  15. <result property="longitude" column="longitude"/>
  16. <result property="coverRadius" column="cover_radius"/>
  17. <result property="remark" column="remark"/>
  18. <result column="creater_sn" property="createrSn"/>
  19. <result column="create_time" property="createTime"/>
  20. <result column="moder_sn" property="moderSn"/>
  21. <result column="mod_time" property="modTime"/>
  22. <result column="tstm" property="tstm"/>
  23. <result property="thirdPartyMerchCode" column="third_party_merch_code"/>
  24. <result property="thirdPartyMerchName" column="third_party_merch_name"/>
  25. <result property="exprAgreementType" column="expr_agreement_type"/>
  26. <result property="isValid" column="is_valid"/>
  27. </resultMap>
  28. <select id="queryObject" resultType="com.kmall.admin.entity.StoreEntity">
  29. select
  30. `id`,
  31. `merch_sn`,
  32. `merch_name`,
  33. `store_name`,
  34. `store_number`,
  35. `store_address`,
  36. `province_name`,
  37. `city_name`,
  38. `county_name`,
  39. `latitude`,
  40. `longitude`,
  41. `cover_radius`,expr_agreement_type,
  42. `remark`,merch_sn, merch_name, creater_sn, create_time,third_party_merch_code,third_party_merch_name,
  43. moder_sn, mod_time, tstm,is_valid
  44. from mall_store
  45. where id = #{id}
  46. </select>
  47. <select id="queryStoreByAll" resultType="com.kmall.admin.entity.StoreEntity">
  48. select
  49. `id`,
  50. `merch_sn`,
  51. `merch_name`,
  52. `store_name`,
  53. `store_number`,
  54. `store_address`,
  55. `province_name`,
  56. `city_name`,
  57. `county_name`,
  58. `latitude`,
  59. `longitude`,
  60. `cover_radius`,expr_agreement_type,
  61. `remark`,merch_sn, merch_name, creater_sn, create_time,third_party_merch_code,third_party_merch_name,
  62. moder_sn, mod_time, tstm,is_valid
  63. from mall_store
  64. </select>
  65. <select id="queryObjectByName" resultType="com.kmall.admin.entity.StoreEntity">
  66. select
  67. `id`,
  68. `merch_sn`,
  69. `merch_name`,
  70. `store_name`,
  71. `store_number`,
  72. `store_address`,
  73. `province_name`,
  74. `city_name`,
  75. `county_name`,
  76. `latitude`,
  77. `longitude`,
  78. `cover_radius`,expr_agreement_type,
  79. `remark`,merch_sn, merch_name, creater_sn, create_time,third_party_merch_code,third_party_merch_name,
  80. moder_sn, mod_time, tstm,is_valid
  81. from mall_store
  82. where store_name = #{storeName}
  83. </select>
  84. <select id="queryObjectByNumber" resultType="com.kmall.admin.entity.StoreEntity">
  85. select
  86. `id`,
  87. `merch_sn`,
  88. `merch_name`,
  89. `store_name`,
  90. `store_number`,
  91. `store_address`,
  92. `province_name`,
  93. `city_name`,
  94. `county_name`,
  95. `latitude`,
  96. `longitude`,
  97. `cover_radius`,expr_agreement_type,
  98. `remark`,merch_sn, merch_name, creater_sn, create_time,third_party_merch_code,third_party_merch_name,
  99. moder_sn, mod_time, tstm,is_valid
  100. from mall_store
  101. where store_number = #{storeNumber}
  102. </select>
  103. <!--<select id="queryObjectByDistId" resultType="com.kmall.admin.entity.StoreEntity">-->
  104. <!--select-->
  105. <!--`id`,-->
  106. <!--`merch_sn`,-->
  107. <!--`merch_name`,-->
  108. <!--`store_name`,-->
  109. <!--`store_number`,-->
  110. <!--`store_address`,-->
  111. <!--`province_name`,-->
  112. <!--`city_name`,-->
  113. <!--`county_name`,-->
  114. <!--`latitude`,-->
  115. <!--`longitude`,-->
  116. <!--`cover_radius`,expr_agreement_type,-->
  117. <!--`remark`,merch_sn, merch_name, creater_sn, create_time,third_party_merch_code,third_party_merch_name,-->
  118. <!--moder_sn, mod_time, tstm,is_valid,dist_id-->
  119. <!--from mall_store-->
  120. <!--where dist_id = #{distId}-->
  121. <!--</select>-->
  122. <select id="queryList" resultType="com.kmall.admin.entity.StoreEntity">
  123. select
  124. s.`id`,
  125. s.`merch_sn`,
  126. s.`merch_name`,
  127. s.`store_name`,
  128. s.`store_number`,
  129. s.`store_address`,
  130. s.`province_name`,
  131. s.`city_name`,
  132. s.`county_name`,
  133. s.`latitude`,
  134. s.`longitude`,
  135. s.`cover_radius`,
  136. s.`remark`,s.merch_sn, s.merch_name, s.creater_sn, s.create_time,s.third_party_merch_code,t.third_party_merch_name,s.expr_agreement_type,
  137. s.moder_sn, s.mod_time, s.tstm,s.is_valid
  138. from mall_store s left join third_merchant_biz t on s.third_party_merch_code = t.third_party_merch_code
  139. WHERE 1=1
  140. <if test="merchSn != null and merchSn.trim() != ''">
  141. AND s.merch_sn = #{merchSn}
  142. </if>
  143. <if test="storeName != null and storeName.trim() != ''">
  144. AND s.store_name LIKE concat('%',#{storeName},'%')
  145. </if>
  146. <if test="storeNumber != null and storeNumber.trim() != ''">
  147. AND s.store_number LIKE concat('%',#{storeNumber},'%')
  148. </if>
  149. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  150. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  151. </if>
  152. <if test="thirdMerchSn != null and thirdMerchSn.trim() != ''">
  153. AND t.third_merch_sn = #{thirdMerchSn}
  154. </if>
  155. <if test="isSupplierGoods != null and isSupplierGoods.trim() != ''">
  156. AND t.is_supplier_goods = #{isSupplierGoods}
  157. </if>
  158. <if test="isValid != null and isValid.trim() != ''">
  159. AND s.is_valid = #{isValid}
  160. </if>
  161. <if test="id != null">
  162. AND s.id = #{id}
  163. </if>
  164. <choose>
  165. <when test="sidx != null and sidx.trim() != ''">
  166. order by ${sidx} ${order}
  167. </when>
  168. <otherwise>
  169. order by s.id desc
  170. </otherwise>
  171. </choose>
  172. <if test="offset != null and limit != null">
  173. limit #{offset}, #{limit}
  174. </if>
  175. </select>
  176. <select id="queryTotal" resultType="int">
  177. select count(*) from mall_store s left join third_merchant_biz t on s.third_party_merch_code = t.third_party_merch_code
  178. WHERE 1=1
  179. <if test="merchSn != null and merchSn.trim() != ''">
  180. AND s.merch_sn = #{merchSn}
  181. </if>
  182. <if test="storeName != null and storeName.trim() != ''">
  183. AND s.store_name LIKE concat('%',#{storeName},'%')
  184. </if>
  185. <if test="storeNumber != null and storeNumber.trim() != ''">
  186. AND s.store_number LIKE concat('%',#{storeNumber},'%')
  187. </if>
  188. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  189. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  190. </if>
  191. <if test="thirdMerchSn != null and thirdMerchSn.trim() != ''">
  192. AND t.third_merch_sn = #{thirdMerchSn}
  193. </if>
  194. <if test="id != null">
  195. AND s.id = #{id}
  196. </if>
  197. </select>
  198. <insert id="save" parameterType="com.kmall.admin.entity.StoreEntity" useGeneratedKeys="true" keyProperty="id">
  199. insert into mall_store(
  200. `merch_sn`,
  201. `merch_name`,
  202. `store_name`,
  203. `store_number`,
  204. `store_address`,
  205. `province_name`,
  206. `city_name`,
  207. `county_name`,
  208. `latitude`,
  209. `longitude`,
  210. `cover_radius`,
  211. is_valid,
  212. `remark`,
  213. third_party_merch_code,
  214. third_party_merch_name,
  215. expr_agreement_type,
  216. creater_sn,
  217. create_time,
  218. moder_sn,
  219. mod_time
  220. )
  221. values(
  222. #{merchSn},
  223. #{merchName},
  224. #{storeName},
  225. #{storeNumber},
  226. #{storeAddress},
  227. #{provinceName},
  228. #{cityName},
  229. #{countyName},
  230. #{latitude},
  231. #{longitude},
  232. #{coverRadius},
  233. #{isValid},
  234. #{remark},
  235. #{thirdPartyMerchCode},
  236. #{thirdPartyMerchName},
  237. #{exprAgreementType},
  238. #{createrSn},
  239. #{createTime},
  240. #{moderSn},
  241. #{modTime}
  242. )
  243. </insert>
  244. <update id="update" parameterType="com.kmall.admin.entity.StoreEntity">
  245. update mall_store
  246. <set>
  247. <if test="merchSn != null">`merch_sn` = #{merchSn}, </if>
  248. <if test="merchName != null">`merch_name` = #{merchName}, </if>
  249. <if test="storeName != null">`store_name` = #{storeName}, </if>
  250. <if test="storeNumber != null">`store_number` = #{storeNumber}, </if>
  251. <if test="storeAddress != null">`store_address` = #{storeAddress}, </if>
  252. <if test="provinceName != null">`province_name` = #{provinceName}, </if>
  253. <if test="cityName != null">`city_name` = #{cityName}, </if>
  254. <if test="countyName != null">`county_name` = #{countyName}, </if>
  255. <if test="latitude != null">`latitude` = #{latitude}, </if>
  256. <if test="longitude != null">`longitude` = #{longitude}, </if>
  257. <if test="coverRadius != null">`cover_radius` = #{coverRadius}, </if>
  258. <if test="isValid != null">`is_valid` = #{isValid}, </if>
  259. <if test="remark != null">`remark` = #{remark},</if>
  260. <if test="createrSn != null" >creater_sn = #{createrSn},</if>
  261. <if test="createTime != null" >create_time = #{createTime},</if>
  262. <if test="thirdPartyMerchCode != null" >third_party_merch_code = #{thirdPartyMerchCode},</if>
  263. <if test="thirdPartyMerchName != null" >third_party_merch_name = #{thirdPartyMerchName},</if>
  264. <if test="exprAgreementType != null" >expr_agreement_type = #{exprAgreementType},</if>
  265. <if test="moderSn != null" >moder_sn = #{moderSn},</if>
  266. <if test="modTime != null" >mod_time = #{modTime},</if>
  267. <if test="tstm != null" >tstm = #{tstm},</if>
  268. </set>
  269. where id = #{id}
  270. </update>
  271. <delete id="delete">
  272. delete from mall_store where id = #{value}
  273. </delete>
  274. <delete id="deleteBatch">
  275. delete from mall_store where id in
  276. <foreach item="id" collection="array" open="(" separator="," close=")">
  277. #{id}
  278. </foreach>
  279. </delete>
  280. <select id="queryExportList" resultType="com.kmall.admin.entity.StoreEntity">
  281. select
  282. s.`id`,
  283. s.`merch_sn`,
  284. s.`merch_name`,
  285. s.`store_name`,
  286. s.`store_number`,
  287. s.`store_address`,
  288. s.`province_name`,
  289. s.`city_name`,
  290. s.`county_name`,
  291. s.`latitude`,
  292. s.`longitude`,
  293. s.`cover_radius`,
  294. s.`remark`,s.merch_sn, s.merch_name, s.creater_sn, s.create_time,s.third_party_merch_code,t.third_party_merch_name,s.expr_agreement_type,
  295. s.moder_sn, s.mod_time, s.tstm,s.is_valid
  296. from mall_store s left join third_merchant_biz t on s.third_party_merch_code = t.third_party_merch_code
  297. WHERE 1=1
  298. <if test="merchSn != null and merchSn.trim() != ''">
  299. AND s.merch_sn = #{merchSn}
  300. </if>
  301. <if test="storeName != null and storeName.trim() != ''">
  302. AND s.store_name LIKE concat('%',#{storeName},'%')
  303. </if>
  304. <if test="storeNumber != null and storeNumber.trim() != ''">
  305. AND s.store_number LIKE concat('%',#{storeNumber},'%')
  306. </if>
  307. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  308. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  309. </if>
  310. <if test="thirdMerchSn != null and thirdMerchSn.trim() != ''">
  311. AND t.third_merch_sn = #{thirdMerchSn}
  312. </if>
  313. <if test="isSupplierGoods != null and isSupplierGoods.trim() != ''">
  314. AND t.is_supplier_goods = #{isSupplierGoods}
  315. </if>
  316. <if test="id != null">
  317. AND s.id = #{id}
  318. </if>
  319. </select>
  320. </mapper>