1
0

StoreDao.xml 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  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="queryObjectByName" 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. where store_name = #{storeName}
  65. </select>
  66. <!--<select id="queryObjectByDistId" resultType="com.kmall.admin.entity.StoreEntity">-->
  67. <!--select-->
  68. <!--`id`,-->
  69. <!--`merch_sn`,-->
  70. <!--`merch_name`,-->
  71. <!--`store_name`,-->
  72. <!--`store_number`,-->
  73. <!--`store_address`,-->
  74. <!--`province_name`,-->
  75. <!--`city_name`,-->
  76. <!--`county_name`,-->
  77. <!--`latitude`,-->
  78. <!--`longitude`,-->
  79. <!--`cover_radius`,expr_agreement_type,-->
  80. <!--`remark`,merch_sn, merch_name, creater_sn, create_time,third_party_merch_code,third_party_merch_name,-->
  81. <!--moder_sn, mod_time, tstm,is_valid,dist_id-->
  82. <!--from mall_store-->
  83. <!--where dist_id = #{distId}-->
  84. <!--</select>-->
  85. <select id="queryList" resultType="com.kmall.admin.entity.StoreEntity">
  86. select
  87. s.`id`,
  88. s.`merch_sn`,
  89. s.`merch_name`,
  90. s.`store_name`,
  91. s.`store_number`,
  92. s.`store_address`,
  93. s.`province_name`,
  94. s.`city_name`,
  95. s.`county_name`,
  96. s.`latitude`,
  97. s.`longitude`,
  98. s.`cover_radius`,
  99. 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,
  100. s.moder_sn, s.mod_time, s.tstm,s.is_valid
  101. from mall_store s left join third_merchant_biz t on s.third_party_merch_code = t.third_party_merch_code
  102. WHERE 1=1
  103. <if test="merchSn != null and merchSn.trim() != ''">
  104. AND s.merch_sn = #{merchSn}
  105. </if>
  106. <if test="storeName != null and storeName.trim() != ''">
  107. AND s.store_name LIKE concat('%',#{storeName},'%')
  108. </if>
  109. <if test="storeNumber != null and storeNumber.trim() != ''">
  110. AND s.store_number LIKE concat('%',#{storeNumber},'%')
  111. </if>
  112. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  113. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  114. </if>
  115. <if test="thirdMerchSn != null and thirdMerchSn.trim() != ''">
  116. AND t.third_merch_sn = #{thirdMerchSn}
  117. </if>
  118. <if test="isSupplierGoods != null and isSupplierGoods.trim() != ''">
  119. AND t.is_supplier_goods = #{isSupplierGoods}
  120. </if>
  121. <if test="isValid != null and isValid.trim() != ''">
  122. AND s.is_valid = #{isValid}
  123. </if>
  124. <if test="id != null">
  125. AND s.id = #{id}
  126. </if>
  127. <choose>
  128. <when test="sidx != null and sidx.trim() != ''">
  129. order by ${sidx} ${order}
  130. </when>
  131. <otherwise>
  132. order by s.id desc
  133. </otherwise>
  134. </choose>
  135. <if test="offset != null and limit != null">
  136. limit #{offset}, #{limit}
  137. </if>
  138. </select>
  139. <select id="queryTotal" resultType="int">
  140. select count(*) from mall_store s left join third_merchant_biz t on s.third_party_merch_code = t.third_party_merch_code
  141. WHERE 1=1
  142. <if test="merchSn != null and merchSn.trim() != ''">
  143. AND s.merch_sn = #{merchSn}
  144. </if>
  145. <if test="storeName != null and storeName.trim() != ''">
  146. AND s.store_name LIKE concat('%',#{storeName},'%')
  147. </if>
  148. <if test="storeNumber != null and storeNumber.trim() != ''">
  149. AND s.store_number LIKE concat('%',#{storeNumber},'%')
  150. </if>
  151. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  152. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  153. </if>
  154. <if test="thirdMerchSn != null and thirdMerchSn.trim() != ''">
  155. AND t.third_merch_sn = #{thirdMerchSn}
  156. </if>
  157. <if test="id != null">
  158. AND s.id = #{id}
  159. </if>
  160. </select>
  161. <insert id="save" parameterType="com.kmall.admin.entity.StoreEntity" useGeneratedKeys="true" keyProperty="id">
  162. insert into mall_store(
  163. `merch_sn`,
  164. `merch_name`,
  165. `store_name`,
  166. `store_number`,
  167. `store_address`,
  168. `province_name`,
  169. `city_name`,
  170. `county_name`,
  171. `latitude`,
  172. `longitude`,
  173. `cover_radius`,
  174. is_valid,
  175. `remark`,
  176. third_party_merch_code,
  177. third_party_merch_name,
  178. expr_agreement_type,
  179. creater_sn,
  180. create_time,
  181. moder_sn,
  182. mod_time
  183. )
  184. values(
  185. #{merchSn},
  186. #{merchName},
  187. #{storeName},
  188. #{storeNumber},
  189. #{storeAddress},
  190. #{provinceName},
  191. #{cityName},
  192. #{countyName},
  193. #{latitude},
  194. #{longitude},
  195. #{coverRadius},
  196. #{isValid},
  197. #{remark},
  198. #{thirdPartyMerchCode},
  199. #{thirdPartyMerchName},
  200. #{exprAgreementType},
  201. #{createrSn},
  202. #{createTime},
  203. #{moderSn},
  204. #{modTime}
  205. )
  206. </insert>
  207. <update id="update" parameterType="com.kmall.admin.entity.StoreEntity">
  208. update mall_store
  209. <set>
  210. <if test="merchSn != null">`merch_sn` = #{merchSn}, </if>
  211. <if test="merchName != null">`merch_name` = #{merchName}, </if>
  212. <if test="storeName != null">`store_name` = #{storeName}, </if>
  213. <if test="storeNumber != null">`store_number` = #{storeNumber}, </if>
  214. <if test="storeAddress != null">`store_address` = #{storeAddress}, </if>
  215. <if test="provinceName != null">`province_name` = #{provinceName}, </if>
  216. <if test="cityName != null">`city_name` = #{cityName}, </if>
  217. <if test="countyName != null">`county_name` = #{countyName}, </if>
  218. <if test="latitude != null">`latitude` = #{latitude}, </if>
  219. <if test="longitude != null">`longitude` = #{longitude}, </if>
  220. <if test="coverRadius != null">`cover_radius` = #{coverRadius}, </if>
  221. <if test="isValid != null">`is_valid` = #{isValid}, </if>
  222. <if test="remark != null">`remark` = #{remark},</if>
  223. <if test="createrSn != null" >creater_sn = #{createrSn},</if>
  224. <if test="createTime != null" >create_time = #{createTime},</if>
  225. <if test="thirdPartyMerchCode != null" >third_party_merch_code = #{thirdPartyMerchCode},</if>
  226. <if test="thirdPartyMerchName != null" >third_party_merch_name = #{thirdPartyMerchName},</if>
  227. <if test="exprAgreementType != null" >expr_agreement_type = #{exprAgreementType},</if>
  228. <if test="moderSn != null" >moder_sn = #{moderSn},</if>
  229. <if test="modTime != null" >mod_time = #{modTime},</if>
  230. <if test="tstm != null" >tstm = #{tstm},</if>
  231. </set>
  232. where id = #{id}
  233. </update>
  234. <delete id="delete">
  235. delete from mall_store where id = #{value}
  236. </delete>
  237. <delete id="deleteBatch">
  238. delete from mall_store where id in
  239. <foreach item="id" collection="array" open="(" separator="," close=")">
  240. #{id}
  241. </foreach>
  242. </delete>
  243. <select id="queryExportList" resultType="com.kmall.admin.entity.StoreEntity">
  244. select
  245. s.`id`,
  246. s.`merch_sn`,
  247. s.`merch_name`,
  248. s.`store_name`,
  249. s.`store_number`,
  250. s.`store_address`,
  251. s.`province_name`,
  252. s.`city_name`,
  253. s.`county_name`,
  254. s.`latitude`,
  255. s.`longitude`,
  256. s.`cover_radius`,
  257. 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,
  258. s.moder_sn, s.mod_time, s.tstm,s.is_valid
  259. from mall_store s left join third_merchant_biz t on s.third_party_merch_code = t.third_party_merch_code
  260. WHERE 1=1
  261. <if test="merchSn != null and merchSn.trim() != ''">
  262. AND s.merch_sn = #{merchSn}
  263. </if>
  264. <if test="storeName != null and storeName.trim() != ''">
  265. AND s.store_name LIKE concat('%',#{storeName},'%')
  266. </if>
  267. <if test="storeNumber != null and storeNumber.trim() != ''">
  268. AND s.store_number LIKE concat('%',#{storeNumber},'%')
  269. </if>
  270. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  271. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  272. </if>
  273. <if test="thirdMerchSn != null and thirdMerchSn.trim() != ''">
  274. AND t.third_merch_sn = #{thirdMerchSn}
  275. </if>
  276. <if test="isSupplierGoods != null and isSupplierGoods.trim() != ''">
  277. AND t.is_supplier_goods = #{isSupplierGoods}
  278. </if>
  279. <if test="id != null">
  280. AND s.id = #{id}
  281. </if>
  282. </select>
  283. </mapper>