StoreDao.xml 10 KB

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