Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 

544 lignes
14 KiB

  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.simple.mapper.WxCouponMapper">
  4. <resultMap id="BaseResultMap" type="com.simple.domain.po.WxCoupon">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
  7. <result column="merchant_id" jdbcType="BIGINT" property="merchantId" />
  8. <result column="type" jdbcType="INTEGER" property="type" />
  9. <result column="cover_img" jdbcType="VARCHAR" property="coverImg" />
  10. <result column="title" jdbcType="VARCHAR" property="title" />
  11. <result column="sub_title" jdbcType="VARCHAR" property="subTitle" />
  12. <result column="sale_price" jdbcType="INTEGER" property="salePrice" />
  13. <result column="use_price" jdbcType="INTEGER" property="usePrice" />
  14. <result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity" />
  15. <result column="target_ad" jdbcType="INTEGER" property="targetAd" />
  16. <result column="send_type" jdbcType="INTEGER" property="sendType" />
  17. <result column="valid_type" jdbcType="INTEGER" property="validType" />
  18. <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate" />
  19. <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate" />
  20. <result column="valid_days" jdbcType="INTEGER" property="validDays" />
  21. <result column="detail" jdbcType="VARCHAR" property="detail" />
  22. <result column="price" jdbcType="INTEGER" property="price" />
  23. <result column="remain_inventory" jdbcType="INTEGER" property="remainInventory" />
  24. <result column="inventory" jdbcType="INTEGER" property="inventory" />
  25. <result column="remark" jdbcType="VARCHAR" property="remark" />
  26. <result column="status" jdbcType="INTEGER" property="status" />
  27. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  28. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
  29. <result column="business" jdbcType="VARCHAR" property="business" />
  30. </resultMap>
  31. <sql id="allColumns">
  32. `id`,`tenant_id`,`merchant_id`,`type`,`cover_img`,`title`,`sub_title`,`sale_price`,`use_price`,`use_limit_quantity`,`target_ad`,`send_type`,`valid_type`,`valid_start_date`,`valid_end_date`,`valid_days`,`detail`,`price`,`remain_inventory`,`inventory`,`remark`,`status`,`create_date`,`update_date`,`business`
  33. </sql>
  34. <sql id="dynamicWhereConditions">
  35. where 1 = 1
  36. <if test=" null != id ">
  37. and `id` = #{id}
  38. </if>
  39. <if test=" null != tenantId ">
  40. and `tenant_id` like concat('%', #{tenantId},'%')
  41. </if>
  42. <if test=" null != merchantId ">
  43. and `merchant_id` = #{merchantId}
  44. </if>
  45. <if test=" null != type ">
  46. and `type` = #{type}
  47. </if>
  48. <if test=" null != coverImg ">
  49. and `cover_img` like concat('%', #{coverImg},'%')
  50. </if>
  51. <if test=" null != title ">
  52. and `title` like concat('%', #{title},'%')
  53. </if>
  54. <if test=" null != subTitle ">
  55. and `sub_title` like concat('%', #{subTitle},'%')
  56. </if>
  57. <if test=" null != salePrice ">
  58. and `sale_price` = #{salePrice}
  59. </if>
  60. <if test=" null != usePrice ">
  61. and `use_price` = #{usePrice}
  62. </if>
  63. <if test=" null != useLimitQuantity ">
  64. and `use_limit_quantity` = #{useLimitQuantity}
  65. </if>
  66. <if test=" null != targetAd ">
  67. and `target_ad` = #{targetAd}
  68. </if>
  69. <if test=" null != sendType ">
  70. and `send_type` = #{sendType}
  71. </if>
  72. <if test=" null != validType ">
  73. and `valid_type` = #{validType}
  74. </if>
  75. <if test=" null != validStartDate ">
  76. and `valid_start_date` = #{validStartDate}
  77. </if>
  78. <if test=" null != validEndDate ">
  79. and `valid_end_date` = #{validEndDate}
  80. </if>
  81. <if test=" null != validDays ">
  82. and `valid_days` = #{validDays}
  83. </if>
  84. <if test=" null != detail ">
  85. and `detail` like concat('%', #{detail},'%')
  86. </if>
  87. <if test=" null != price ">
  88. and `price` = #{price}
  89. </if>
  90. <if test=" null != remainInventory ">
  91. and `remain_inventory` = #{remainInventory}
  92. </if>
  93. <if test=" null != inventory ">
  94. and `inventory` = #{inventory}
  95. </if>
  96. <if test=" null != remark ">
  97. and `remark` like concat('%', #{remark},'%')
  98. </if>
  99. <if test=" null != status ">
  100. and `status` = #{status}
  101. </if>
  102. <if test=" null != createDate ">
  103. and `create_date` = #{createDate}
  104. </if>
  105. <if test=" null != updateDate ">
  106. and `update_date` = #{updateDate}
  107. </if>
  108. <if test=" null != business ">
  109. and `business` like concat('%', #{business},'%')
  110. </if>
  111. <if test=" null != ids ">
  112. and id in
  113. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  114. #{idItem}
  115. </foreach>
  116. </if>
  117. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  118. </sql>
  119. <sql id="findEnableConditions">
  120. where 1 = 1
  121. <if test=" null != id ">
  122. and `id` = #{id}
  123. </if>
  124. <if test=" null != tenantId ">
  125. and `tenant_id` like concat('%', #{tenantId},'%')
  126. </if>
  127. <if test=" null != merchantId ">
  128. and `merchant_id` = #{merchantId}
  129. </if>
  130. <if test=" null != type ">
  131. and `type` = #{type}
  132. </if>
  133. <if test=" null != coverImg ">
  134. and `cover_img` like concat('%', #{coverImg},'%')
  135. </if>
  136. <if test=" null != title ">
  137. and `title` like concat('%', #{title},'%')
  138. </if>
  139. <if test=" null != subTitle ">
  140. and `sub_title` like concat('%', #{subTitle},'%')
  141. </if>
  142. <if test=" null != salePrice ">
  143. and `sale_price` = #{salePrice}
  144. </if>
  145. <if test=" null != usePrice ">
  146. and `use_price` = #{usePrice}
  147. </if>
  148. <if test=" null != useLimitQuantity ">
  149. and `use_limit_quantity` = #{useLimitQuantity}
  150. </if>
  151. <if test=" null != targetAd ">
  152. and `target_ad` = #{targetAd}
  153. </if>
  154. <if test=" null != sendType ">
  155. and `send_type` = #{sendType}
  156. </if>
  157. <if test=" null != validType ">
  158. and `valid_type` = #{validType}
  159. </if>
  160. <if test=" null != validStartDate ">
  161. and `valid_start_date` = #{validStartDate}
  162. </if>
  163. <if test=" null != validEndDate ">
  164. and `valid_end_date` = #{validEndDate}
  165. </if>
  166. <if test=" null != validDays ">
  167. and `valid_days` = #{validDays}
  168. </if>
  169. <if test=" null != detail ">
  170. and `detail` like concat('%', #{detail},'%')
  171. </if>
  172. <if test=" null != price ">
  173. and `price` = #{price}
  174. </if>
  175. <if test=" null != remainInventory ">
  176. and `remain_inventory` = #{remainInventory}
  177. </if>
  178. <if test=" null != inventory ">
  179. and `inventory` = #{inventory}
  180. </if>
  181. <if test=" null != remark ">
  182. and `remark` like concat('%', #{remark},'%')
  183. </if>
  184. <if test=" null != status ">
  185. and `status` =0
  186. </if>
  187. <if test=" null != createDate ">
  188. and `create_date` = #{createDate}
  189. </if>
  190. <if test=" null != updateDate ">
  191. and `update_date` = #{updateDate}
  192. </if>
  193. <if test=" null != business ">
  194. and `business` like concat('%', #{business},'%')
  195. </if>
  196. <if test=" null != ids ">
  197. and id in
  198. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  199. #{idItem}
  200. </foreach>
  201. </if>
  202. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  203. </sql>
  204. <sql id="findCanSendConditions">
  205. where 1 = 1
  206. <if test=" null != id ">
  207. and `id` = #{id}
  208. </if>
  209. <if test=" null != tenantId ">
  210. and `tenant_id` like concat('%', #{tenantId},'%')
  211. </if>
  212. <if test=" null != merchantId ">
  213. and `merchant_id` = #{merchantId}
  214. </if>
  215. <if test=" null != type ">
  216. and `type` = #{type}
  217. </if>
  218. <if test=" null != coverImg ">
  219. and `cover_img` like concat('%', #{coverImg},'%')
  220. </if>
  221. <if test=" null != title ">
  222. and `title` like concat('%', #{title},'%')
  223. </if>
  224. <if test=" null != subTitle ">
  225. and `sub_title` like concat('%', #{subTitle},'%')
  226. </if>
  227. <if test=" null != salePrice ">
  228. and `sale_price` = #{salePrice}
  229. </if>
  230. <if test=" null != usePrice ">
  231. and `use_price` = #{usePrice}
  232. </if>
  233. <if test=" null != useLimitQuantity ">
  234. and `use_limit_quantity` = #{useLimitQuantity}
  235. </if>
  236. <if test=" null != targetAd ">
  237. and `target_ad` = #{targetAd}
  238. </if>
  239. <if test=" null != sendType ">
  240. and `send_type` = #{sendType}
  241. </if>
  242. <if test=" null != validType ">
  243. and `valid_type` = #{validType}
  244. </if>
  245. <if test=" null != validStartDate ">
  246. and `valid_start_date` = #{validStartDate}
  247. </if>
  248. <if test=" null != validEndDate ">
  249. and `valid_end_date` = #{validEndDate}
  250. </if>
  251. <if test=" null != validDays ">
  252. and `valid_days` = #{validDays}
  253. </if>
  254. <if test=" null != detail ">
  255. and `detail` like concat('%', #{detail},'%')
  256. </if>
  257. <if test=" null != price ">
  258. and `price` = #{price}
  259. </if>
  260. <if test=" null != remainInventory ">
  261. and `remain_inventory` = #{remainInventory}
  262. </if>
  263. <if test=" null != inventory ">
  264. and `inventory` = #{inventory}
  265. </if>
  266. <if test=" null != remark ">
  267. and `remark` like concat('%', #{remark},'%')
  268. </if>
  269. <if test=" null != status ">
  270. and `status` =0
  271. </if>
  272. <if test=" null != createDate ">
  273. and `create_date` = #{createDate}
  274. </if>
  275. <if test=" null != updateDate ">
  276. and `update_date` = #{updateDate}
  277. </if>
  278. <if test=" null != business ">
  279. and `business` like concat('%', #{business},'%')
  280. </if>
  281. <if test=" null != ids ">
  282. and id in
  283. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  284. #{idItem}
  285. </foreach>
  286. </if>
  287. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  288. </sql>
  289. <select id="findList" parameterType="com.simple.domain.po.WxCoupon" resultMap="BaseResultMap">
  290. select <include refid="allColumns" /> from wx_coupon
  291. <include refid="dynamicWhereConditions" />
  292. </select>
  293. <select id="findEnableList" parameterType="com.simple.domain.po.WxCoupon" resultMap="BaseResultMap">
  294. select <include refid="allColumns" /> from wx_coupon
  295. <include refid="findEnableConditions" />
  296. </select>
  297. <select id="findCanSendList" parameterType="com.simple.domain.po.WxCoupon" resultMap="BaseResultMap">
  298. select <include refid="allColumns" /> from wx_coupon
  299. <include refid="findCanSendConditions" />
  300. </select>
  301. <resultMap id="CUserResultMap" type="com.simple.domain.vo.WxCouponCVo">
  302. <id column="id" jdbcType="BIGINT" property="id" />
  303. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
  304. <result column="merchant_id" jdbcType="BIGINT" property="merchantId" />
  305. <result column="type" jdbcType="INTEGER" property="type" />
  306. <result column="cover_img" jdbcType="VARCHAR" property="coverImg" />
  307. <result column="title" jdbcType="VARCHAR" property="title" />
  308. <result column="sub_title" jdbcType="VARCHAR" property="subTitle" />
  309. <result column="sale_price" jdbcType="INTEGER" property="salePrice" />
  310. <result column="use_price" jdbcType="INTEGER" property="usePrice" />
  311. <result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity" />
  312. <result column="target_ad" jdbcType="INTEGER" property="targetAd" />
  313. <result column="send_type" jdbcType="INTEGER" property="sendType" />
  314. <result column="valid_type" jdbcType="INTEGER" property="validType" />
  315. <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate" />
  316. <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate" />
  317. <result column="valid_days" jdbcType="INTEGER" property="validDays" />
  318. <result column="detail" jdbcType="VARCHAR" property="detail" />
  319. <result column="price" jdbcType="INTEGER" property="price" />
  320. <result column="remain_inventory" jdbcType="INTEGER" property="remainInventory" />
  321. <result column="inventory" jdbcType="INTEGER" property="inventory" />
  322. <result column="remark" jdbcType="VARCHAR" property="remark" />
  323. <result column="status" jdbcType="INTEGER" property="status" />
  324. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  325. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
  326. <result column="business" jdbcType="VARCHAR" property="business" />
  327. <result column="begin_time" jdbcType="TIMESTAMP" property="beginTime" />
  328. <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
  329. <result column="img_url" jdbcType="VARCHAR" property="merchantImgUrl" />
  330. <result column="name" jdbcType="VARCHAR" property="merchantName" />
  331. <result column="link_phone" jdbcType="VARCHAR" property="merchantLinkPhone" />
  332. <result column="status" jdbcType="VARCHAR" property="merchantStatus" />
  333. <result column="addr" jdbcType="VARCHAR" property="addr"/>
  334. <result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/>
  335. <result column="building_name" jdbcType="VARCHAR" property="buildingName" />
  336. <result column="floor_name" jdbcType="VARCHAR" property="floorName" />
  337. <result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/>
  338. </resultMap>
  339. <sql id="allCUserColumns">
  340. c.id,c.tenant_id,c.merchant_id,c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.use_limit_quantity,c.target_ad,c.send_type,c.valid_type,c.valid_start_date,c.valid_end_date,c.valid_days,c.detail,c.price,c.remain_inventory,c.inventory,c.remark,c.status,c.create_date,c.update_date,c.business,
  341. m.img_url,m.name,m.link_phone,m.status,
  342. s.addr,s.shop_number,s.baidu_poi,
  343. mb.building_name,mf.floor_name,
  344. cc.begin_time,cc.end_time
  345. </sql>
  346. <select id="selectDetailForCUser" parameterType="com.simple.domain.po.WxCouponChannel" resultMap="CUserResultMap">
  347. select <include refid="allCUserColumns" />
  348. from wx_coupon_channel cc,
  349. wx_coupon c,wx_merchant m,
  350. wx_shop s,wx_merchant_shop ms,
  351. wx_mall_building mb,
  352. wx_mall_floor mf
  353. where c.merchant_id = m.id
  354. <if test=" null != couponId ">
  355. and c.id = #{couponId}
  356. and cc.coupon_id = #{couponId}
  357. </if>
  358. <if test=" null != tenantId ">
  359. and c.tenant_id = #{tenantId}
  360. </if>
  361. <if test=" null != targetAd ">
  362. and cc.target_ad = #{targetAd}
  363. </if>
  364. and ms.merchant_id = m.id
  365. and ms.shop_id = s.id
  366. and s.building = mb.id
  367. and s.floor = mf.id
  368. </select>
  369. </mapper>