后台服务
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

WxMerchantMapper.xml 18 KiB

2 lat temu
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  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.iformall.mapper.WxMerchantMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxMerchant">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  7. <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/>
  8. <result column="img_url" jdbcType="VARCHAR" property="imgUrl"/>
  9. <result column="name" jdbcType="VARCHAR" property="name"/>
  10. <result column="encode" jdbcType="VARCHAR" property="encode"/>
  11. <result column="link_phone" jdbcType="VARCHAR" property="linkPhone"/>
  12. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  13. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  14. <result column="car_vendor_type" jdbcType="INTEGER" property="carVendorType"/>
  15. <result column="car_params" jdbcType="VARCHAR" property="carParams"/>
  16. <result column="status" jdbcType="INTEGER" property="status"/>
  17. <result column="link_person" jdbcType="VARCHAR" property="linkPerson"/>
  18. <result column="business_id" jdbcType="INTEGER" property="businessId"/>
  19. <result column="business_types" jdbcType="VARCHAR" property="businessTypes"/>
  20. <result column="sub_business_id" jdbcType="INTEGER" property="subBusinessId"/>
  21. <result column="shop_type" jdbcType="INTEGER" property="shopType"/>
  22. <result column="brand" jdbcType="VARCHAR" property="brand"/>
  23. <result column="type" jdbcType="SMALLINT" property="type"/>
  24. <result column="is_public" jdbcType="SMALLINT" property="isPublic"/>
  25. <result column="is_private" jdbcType="SMALLINT" property="isPrivate"/>
  26. <result column="email" jdbcType="VARCHAR" property="email"/>
  27. <result column="title" jdbcType="VARCHAR" property="title"/>
  28. <result column="cover_picture" jdbcType="VARCHAR" property="coverPicture"/>
  29. <result column="is_admin" jdbcType="INTEGER" property="isAdmin"/>
  30. <result column="bill_setting" jdbcType="INTEGER" property="billSetting"/>
  31. <result column="qr_code" jdbcType="VARCHAR" property="qrCode"/>
  32. <result column="tt_qr_code" jdbcType="VARCHAR" property="ttQrCode"/>
  33. <result column="introduction" jdbcType="VARCHAR" property="introduction"/>
  34. <result column="action_desc" jdbcType="VARCHAR" property="actionDesc"/>
  35. <result column="mark" jdbcType="INTEGER" property="mark"/>
  36. <result column="mark_time" jdbcType="TIMESTAMP" property="markTime"/>
  37. <result column="is_del" jdbcType="INTEGER" property="isDel"/>
  38. <result column="talk_user_main" jdbcType="VARCHAR" property="talkUserMain"/>
  39. <result column="talk_user_aux" jdbcType="VARCHAR" property="talkUserAux"/>
  40. <result column="link_line_phone" property="linkLinePhone"/>
  41. <result column="rental_start_date" property="rentalStartDate"/>
  42. <result column="rental_end_date" property="rentalEndDate"/>
  43. <result column="credit_locked" property="creditLocked"/>
  44. <result column="entry_amount" jdbcType="INTEGER" property="entryAmount"/>
  45. <result column="cash_out_number" jdbcType="INTEGER" property="cashOutNumber"/>
  46. <result column="cash_out_count" jdbcType="INTEGER" property="cashOutCount"/>
  47. <result column="cash_out_last_time" jdbcType="TIMESTAMP" property="cashOutLastTime"/>
  48. </resultMap>
  49. <sql id="allColumns">
  50. m.`id`,m.`tenant_id`,m.`parent_tenant_id`,m.`img_url`,m.`name`,m.`encode`,m.`link_phone`,m.`create_date`,m.`update_date`,m.`car_vendor_type`,m.`car_params`,m.`status`,m.`link_person`,
  51. m.`business_id`,m.`business_types`,m.`sub_business_id`,m.`shop_type`,m.`brand`,m.`type`,m.`is_public`,m.`is_private`,m.email,m.`title`,m.`cover_picture`,m.`is_admin`,m.`bill_setting`,m.`qr_code`,m.`tt_qr_code`,
  52. m.`introduction`,m.`action_desc`,m.`mark`,m.mark_time,m.`is_del`,m.`talk_user_main`,m.`talk_user_aux`,m.link_line_phone,m.credit_locked,m.credit_locked,m.entry_amount,m.cash_out_count,m.cash_out_last_time
  53. </sql>
  54. <sql id="dynamicWhereConditions">
  55. where m.is_del = 0
  56. <if test=" null != id ">
  57. and m.`id` = #{id}
  58. </if>
  59. <if test=" null != tenantId and '' != tenantId">
  60. and m.`tenant_id` = #{tenantId}
  61. </if>
  62. <if test=" null != parentTenantId and '' != parentTenantId">
  63. and m.`parent_tenant_id` = #{parentTenantId}
  64. </if>
  65. <if test=" null != imgUrl ">
  66. and m.`img_url` like concat('%', #{imgUrl},'%')
  67. </if>
  68. <if test=" null != encode and ''!=encode ">
  69. and m.`encode` like concat('%', #{encode},'%')
  70. </if>
  71. <if test=" null != name and ''!=name ">
  72. and m.`name` like concat('%', #{name},'%')
  73. </if>
  74. <if test=" null != linkPhone and ''!=linkPhone ">
  75. and m.`link_phone` like concat('%', #{linkPhone},'%')
  76. </if>
  77. <if test=" null != linkPerson and ''!=linkPerson ">
  78. and m.`link_person` like concat('%', #{linkPerson},'%')
  79. </if>
  80. <if test=" null != createDate ">
  81. and m.`create_date` = #{createDate}
  82. </if>
  83. <if test=" null != updateDate ">
  84. and m.`update_date` = #{updateDate}
  85. </if>
  86. <if test="starttime != null">
  87. and m.create_date &gt;= #{starttime}
  88. </if>
  89. <if test="endtime != null">
  90. and m.create_date &lt;= #{endtime}
  91. </if>
  92. <if test=" null != carVendorType ">
  93. and m.`car_vendor_type` = #{carVendorType}
  94. </if>
  95. <if test=" null != businessId ">
  96. and m.`business_id` = #{businessId}
  97. </if>
  98. <if test=" null != businessForRule and '' != businessForRule ">
  99. and m.business_id in (${businessForRule}) and m.is_del=0
  100. </if>
  101. <if test=" null != businessTypes ">
  102. and JSON_CONTAINS(m.business_types,JSON_OBJECT('id', #{businessTypes}))
  103. </if>
  104. <if test=" null != subBusinessId ">
  105. and m.`sub_business_id` = #{subBusinessId}
  106. </if>
  107. <if test=" null != carParams ">
  108. and m.`car_params` like concat('%', #{carParams},'%')
  109. </if>
  110. <if test=" null != status ">
  111. and m.`status` = #{status}
  112. </if>
  113. <if test=" null != type ">
  114. and m.`type` = #{type}
  115. </if>
  116. <if test=" null != isPublic ">
  117. and m.`is_public` = #{isPublic}
  118. </if>
  119. <if test=" null != isPrivate ">
  120. and m.`is_private` = #{isPrivate}
  121. </if>
  122. <if test=" null != email ">
  123. and m.`email` = #{email}
  124. </if>
  125. <if test=" null != isAdmin ">
  126. and m.`is_admin` = #{isAdmin}
  127. </if>
  128. <if test=" null != mark ">
  129. <if test="mark == 0" >
  130. and (m.`mark` is null or m.`mark` &lt;&gt; 1)
  131. </if>
  132. <if test="mark == 1" >
  133. and m.`mark` = 1
  134. </if>
  135. </if>
  136. <if test=" null != isDel ">
  137. and m.`is_del` = #{isDel}
  138. </if>
  139. <if test=" null != brand ">
  140. and m.`brand` = #{brand}
  141. </if>
  142. <if test=" null != creditLocked ">
  143. and m.`credit_locked` = #{creditLocked}
  144. </if>
  145. <if test=" null != ids ">
  146. and m.id in
  147. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  148. #{idItem}
  149. </foreach>
  150. </if>
  151. <if test=" null != notInids ">
  152. and m.id not in
  153. <foreach collection="notInids" index="index" item="notInIdItem" open="(" separator="," close=")">
  154. #{notInIdItem}
  155. </foreach>
  156. </if>
  157. <if test=" null != sortColumns">order by ${sortColumns}</if>
  158. </sql>
  159. <select id="findIdNameList" parameterType="com.iformall.domain.po.WxMerchant" resultMap="BaseResultMap">
  160. select id,name
  161. from wx_merchant m
  162. <include refid="dynamicWhereConditions"/>
  163. </select>
  164. <select id="findList" parameterType="com.iformall.domain.po.WxMerchant" resultMap="BaseResultMap">
  165. select
  166. <include refid="allColumns"/>
  167. from wx_merchant m
  168. <include refid="dynamicWhereConditions"/>
  169. </select>
  170. <select id="findByTenantIds" parameterType="java.util.Map" resultMap="BaseResultMap">
  171. select
  172. <include refid="allColumns"/>
  173. from wx_merchant m
  174. where m.is_del = 0
  175. and m.`status` = 1
  176. <if test=" null != tenantIds ">
  177. and m.tenant_id in
  178. <foreach collection="tenantIds" index="index" item="tenantId" open="(" separator="," close=")">
  179. #{tenantId}
  180. </foreach>
  181. </if>
  182. </select>
  183. <select id="findIdList" parameterType="com.iformall.domain.po.WxMerchant" resultType="Long">
  184. select id
  185. from wx_merchant m
  186. <include refid="dynamicWhereConditions"/>
  187. </select>
  188. <select id="getMerchantByEncode" parameterType="String" resultMap="BaseResultMap">
  189. select
  190. <include refid="allColumns"/>
  191. from wx_merchant m where m.encode = #{encode}
  192. </select>
  193. <select id="getMerchantByCode" parameterType="java.util.Map" resultMap="BaseResultMap">
  194. select <include refid="allColumns"/>
  195. FROM wx_merchant m where md5(m.`id`) = #{merchantCode}
  196. <if test=" null != tenantId and '' != tenantId">
  197. and m.`tenant_id` = #{tenantId}
  198. </if>
  199. <if test=" null != parentTenantId and '' != parentTenantId">
  200. and m.`parent_tenant_id` = #{parentTenantId}
  201. </if>
  202. <if test=" null != status ">
  203. and m.`status` = #{status}
  204. </if>
  205. </select>
  206. <select id="findListCVo" parameterType="com.iformall.domain.dto.WxMerchantDto" resultMap="BaseResultMap">
  207. select
  208. <include refid="allColumns"/>
  209. FROM wx_merchant m where m.is_del=0
  210. <if test=" null != tenantId and '' != tenantId">
  211. and m.`tenant_id` = #{tenantId}
  212. </if>
  213. <if test=" null != parentTenantId and '' != parentTenantId">
  214. and m.`parent_tenant_id` = #{parentTenantId}
  215. </if>
  216. <if test=" null != merchantName and ''!=merchantName ">
  217. and m.`name` like concat('%', #{merchantName},'%')
  218. </if>
  219. <if test=" null != merchantLinkPhone and ''!=merchantLinkPhone ">
  220. and m.`link_phone` like concat('%', #{merchantLinkPhone},'%')
  221. </if>
  222. <if test=" null != businessId ">
  223. and m.`business_id` = #{businessId}
  224. </if>
  225. <if test=" null != subBusinessId ">
  226. and m.`sub_business_id` = #{subBusinessId}
  227. </if>
  228. <if test=" null != merchantStatus ">
  229. and m.`status` = #{merchantStatus}
  230. </if>
  231. <if test=" null != isPublic">
  232. and m.`is_public` = #{isPublic}
  233. </if>
  234. <if test=" null != isPrivate">
  235. and m.`is_private` = #{isPrivate}
  236. </if>
  237. <if test=" null != id">
  238. and m.`id` = #{id}
  239. </if>
  240. <if test=" null != ids ">
  241. and m.id in
  242. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  243. #{idItem}
  244. </foreach>
  245. </if>
  246. order by m.top_time desc
  247. </select>
  248. <select id="findQrcodeEmptyList" resultMap="BaseResultMap">
  249. select <include refid="allColumns"/> from wx_merchant m where (m.qr_code is null or m.tt_qr_code is null);
  250. </select>
  251. <select id="findBusByFloorId" resultType="hashmap" parameterType="hashmap">
  252. select count(distinct m.id) count,m.business_id bid
  253. from wx_merchant m
  254. where m.status = 1 and m.is_del = 0
  255. <if test=" null != tenantId and '' != tenantId">
  256. and m.`tenant_id` = #{tenantId}
  257. </if>
  258. <if test=" null != parentTenantId and '' != parentTenantId">
  259. and m.`parent_tenant_id` = #{parentTenantId}
  260. </if>
  261. <if test=" null != ids ">
  262. and m.id in
  263. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  264. #{idItem}
  265. </foreach>
  266. </if>
  267. group by m.business_id
  268. </select>
  269. <select id="hasMerchant" parameterType="com.iformall.domain.po.WxMerchant" resultType="int">
  270. select count(1) from wx_merchant where `name`=#{name}
  271. <if test=" null != status ">
  272. and `status` = #{status}
  273. </if>
  274. <if test=" null != id">
  275. and `id` != #{id}
  276. </if>
  277. </select>
  278. <select id="hasMerchantEncode" parameterType="com.iformall.domain.po.WxMerchant" resultType="int">
  279. select count(1) from wx_merchant where `encode`=#{encode}
  280. <if test=" null != status ">
  281. and `status` = #{status}
  282. </if>
  283. <if test=" null != id">
  284. and `id` != #{id}
  285. </if>
  286. </select>
  287. <select id="hasMerchantBrand" parameterType="com.iformall.domain.po.WxMerchant" resultType="int">
  288. select count(1) from wx_merchant where `brand`=#{brand}
  289. <if test=" null != status ">
  290. and `status` = #{status}
  291. </if>
  292. <if test=" null != id">
  293. and `id` != #{id}
  294. </if>
  295. </select>
  296. <select id="hasMerchantIsAdmin" parameterType="com.iformall.domain.po.WxMerchant" resultType="int">
  297. select count(1) from wx_merchant where `is_admin`=#{isAdmin}
  298. <if test=" null != status ">
  299. and `status` = #{status}
  300. </if>
  301. <if test=" null != id">
  302. and `id` != #{id}
  303. </if>
  304. </select>
  305. <update id="updateCreditLocked" parameterType="com.iformall.domain.po.WxMerchant">
  306. update wx_merchant set credit_locked = #{creditLocked} where tenant_id = #{tenantId}
  307. </update>
  308. <select id="userTradeMerchantList" parameterType="com.iformall.domain.po.WxMerchant" resultMap="BaseResultMap">
  309. SELECT m.id, m.`img_url` , m.`name` ,m.`encode` , m.`link_person`
  310. FROM wx_merchant m
  311. where m.status=1
  312. <if test=" null != name and ''!=name ">
  313. and `name` like concat('%', #{name},'%')
  314. </if>
  315. <if test=" null != linkPhone and ''!=linkPhone ">
  316. and `link_phone` like concat('%', #{linkPhone},'%')
  317. </if>
  318. <if test=" null != linkPerson and ''!=linkPerson ">
  319. and `link_person` like concat('%', #{linkPerson},'%')
  320. </if>
  321. <if test=" null != sortColumns">order by ${sortColumns}</if>
  322. </select>
  323. <select id="findByTrade" parameterType="java.util.Map" resultMap="BaseResultMap">
  324. select <include refid="allColumns"/> from wx_merchant m where
  325. m.id in
  326. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  327. #{idItem}
  328. </foreach>
  329. limit 1
  330. </select>
  331. <select id="getMerchantList" parameterType="com.iformall.domain.po.WxMerchant" resultMap="BaseResultMap">
  332. select <include refid="allColumns"/>
  333. from wx_merchant m
  334. where m.is_del=0 and m.status=1
  335. <if test=" null != tenantId and '' != tenantId">
  336. and m.`tenant_id` = #{tenantId}
  337. </if>
  338. <if test=" null != parentTenantId and '' != parentTenantId">
  339. and m.`parent_tenant_id` = #{parentTenantId}
  340. </if>
  341. <if test=" null != isPrivate">
  342. and m.`is_private` = #{isPrivate}
  343. </if>
  344. order by m.create_date desc
  345. </select>
  346. <update id="increaseCash" parameterType="com.iformall.domain.po.WxMerchant">
  347. update wx_merchant set cash_out_number = cash_out_number+#{cashOutNumber} where id = #{id}
  348. </update>
  349. <update id="reduceCash" parameterType="com.iformall.domain.po.WxMerchant">
  350. update wx_merchant set cash_out_number = cash_out_number-#{cashOutNumber}, cash_out_count = cash_out_count+1,cash_out_last_time = now() where id = #{id}
  351. </update>
  352. <update id="increaseCashCount" parameterType="com.iformall.domain.po.WxMerchant">
  353. update wx_merchant set cash_out_count = cash_out_count+1 where id = #{id}
  354. </update>
  355. <update id="reSetCashCount" parameterType="com.iformall.domain.po.WxMerchant">
  356. update wx_merchant set cash_out_count = 0 where id = #{id}
  357. </update>
  358. <update id="recordedAmount" parameterType="com.iformall.domain.po.WxMerchant">
  359. update wx_merchant set
  360. entry_amount = ifnull(entry_amount,0)+#{entryAmount}
  361. /*,cash_out_number = ifnull(cash_out_number,0)+#{cashOutNumber}*/
  362. where id = #{id}
  363. </update>
  364. <select id="findShopMerchant" parameterType="Long" resultType="hashmap">
  365. select
  366. m.`id`,m.`tenant_id`,m.`parent_tenant_id`,m.`img_url`,m.`name`,m.`encode`,m.`link_phone`,m.`create_date`,m.`update_date`,m.`car_vendor_type`,m.`car_params`,m.`status`,m.`link_person`,
  367. m.`business_id`,m.`business_types`,m.`sub_business_id`,m.`shop_type`,m.`brand`,m.`type`,m.`is_public`,m.`is_private`,m.email,m.`title`,m.`cover_picture`,m.`is_admin`,m.`bill_setting`,m.`qr_code`,m.`tt_qr_code`,
  368. m.`introduction`,m.`action_desc`,m.`mark`,m.mark_time,m.`is_del`,m.`talk_user_main`,m.`talk_user_aux`,m.link_line_phone,m.credit_locked,m.credit_locked
  369. from wx_merchant m where m.id = #{id}
  370. </select>
  371. <select id="detailShopMerchantById" parameterType="hashmap" resultType="hashmap">
  372. select
  373. m.`id`,m.`tenant_id` tenantId,m.`parent_tenant_id` parentTenantId,m.`img_url`,m.`name`,m.`encode`,m.`link_phone`,m.`create_date`,m.`update_date`,
  374. m.`car_vendor_type`,m.`car_params`,m.`status`,m.`link_person`,
  375. m.`business_id`,m.`business_types`,m.`sub_business_id`,m.`shop_type`,m.`brand`,m.`type`,m.`is_public`,m.`is_private`,m.email,m.`title`,m.`cover_picture`,m.`is_admin`,m.`bill_setting`,m.`qr_code`,m.`tt_qr_code`,
  376. m.`introduction`,m.`action_desc`,m.`mark`,m.mark_time,m.`is_del`,m.`talk_user_main`,m.`talk_user_aux`,m.link_line_phone,m.credit_locked,m.credit_locked
  377. from wx_merchant m where m.id = #{id} and m.is_del = 0
  378. <if test=" null != tenantInfo.tenantId and '' != tenantInfo.tenantId">
  379. and m.`tenant_id` = #{tenantInfo.tenantId}
  380. </if>
  381. <if test=" null != tenantInfo.parentTenantId and '' != tenantInfo.parentTenantId">
  382. and m.`parent_tenant_id` = #{tenantInfo.parentTenantId}
  383. </if>
  384. </select>
  385. <update id="deleteByUpdate" parameterType="Long">
  386. update wx_merchant set is_del = 1
  387. where id = #{id}
  388. </update>
  389. </mapper>