Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 

1008 linhas
45 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.iformall.mapper.WxCouponMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCoupon">
  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="type" jdbcType="INTEGER" property="type"/>
  9. <result column="cover_img" jdbcType="VARCHAR" property="coverImg"/>
  10. <result column="cover_picture" jdbcType="VARCHAR" property="coverPicture"/>
  11. <result column="detail_picture" jdbcType="VARCHAR" property="detailPicture"/>
  12. <result column="title" jdbcType="VARCHAR" property="title"/>
  13. <result column="sub_title" jdbcType="VARCHAR" property="subTitle"/>
  14. <result column="sale_price" jdbcType="INTEGER" property="salePrice"/>
  15. <result column="use_price" jdbcType="INTEGER" property="usePrice"/>
  16. <result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity"/>
  17. <result column="send_type" jdbcType="INTEGER" property="sendType"/>
  18. <result column="valid_type" jdbcType="INTEGER" property="validType"/>
  19. <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate"/>
  20. <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate"/>
  21. <result column="valid_days" jdbcType="INTEGER" property="validDays"/>
  22. <result column="detail" jdbcType="VARCHAR" property="detail"/>
  23. <result column="price" jdbcType="INTEGER" property="price"/>
  24. <result column="unit" jdbcType="INTEGER" property="unit"/>
  25. <result column="remain_inventory" jdbcType="INTEGER" property="remainInventory"/>
  26. <result column="inventory" jdbcType="INTEGER" property="inventory"/>
  27. <result column="remark" jdbcType="VARCHAR" property="remark"/>
  28. <result column="status" jdbcType="INTEGER" property="status"/>
  29. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  30. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  31. <result column="business" jdbcType="INTEGER" property="business"/>
  32. <result column="sub_business" jdbcType="INTEGER" property="subBusiness"/>
  33. <result column="support_transfer" jdbcType="INTEGER" property="supportTransfer"/>
  34. <result column="subsidy_type" jdbcType="INTEGER" property="subsidyType"/>
  35. <result column="subsidy_num" jdbcType="INTEGER" property="subsidyNum"/>
  36. <result column="press_limit_num" jdbcType="INTEGER" property="pressLimitNum"/>
  37. <result column="press_limit_hours" jdbcType="INTEGER" property="pressLimitHours"/>
  38. <result column="auto_refund" jdbcType="INTEGER" property="autoRefund"/>
  39. <result column="credit_price" jdbcType="INTEGER" property="creditPrice"/>
  40. <result column="credit_refund" jdbcType="INTEGER" property="creditRefund"/>
  41. <result column="is_del" property="isDel"/>
  42. <result column="put_apply_status" property="putApplyStatus"/>
  43. <result column="stock_apply_status" property="stockApplyStatus"/>
  44. <result column="cancle_apply_status" property="cancleApplyStatus"/>
  45. <result column="conditions" jdbcType="VARCHAR" property="conditions"/>
  46. <result column="approval_type" property="approvalType"/>
  47. <result column="password_support" property="passwordSupport"/>
  48. <result column="content_type" property="contentType"/>
  49. <result column="html" property="html"/>
  50. <result column="source_type" jdbcType="INTEGER" property="sourceType"/>
  51. </resultMap>
  52. <resultMap id="statisMap" type="com.iformall.domain.vo.WxCouponStatisVo">
  53. <id column="id" jdbcType="BIGINT" property="id"/>
  54. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  55. <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
  56. <result column="type" jdbcType="INTEGER" property="type"/>
  57. <result column="cover_img" jdbcType="VARCHAR" property="coverImg"/>
  58. <result column="cover_picture" jdbcType="VARCHAR" property="coverPicture"/>
  59. <result column="title" jdbcType="VARCHAR" property="title"/>
  60. <result column="sub_title" jdbcType="VARCHAR" property="subTitle"/>
  61. <result column="sale_price" jdbcType="INTEGER" property="salePrice"/>
  62. <result column="use_price" jdbcType="INTEGER" property="usePrice"/>
  63. <result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity"/>
  64. <result column="send_type" jdbcType="INTEGER" property="sendType"/>
  65. <result column="valid_type" jdbcType="INTEGER" property="validType"/>
  66. <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate"/>
  67. <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate"/>
  68. <result column="valid_days" jdbcType="INTEGER" property="validDays"/>
  69. <result column="detail" jdbcType="VARCHAR" property="detail"/>
  70. <result column="price" jdbcType="INTEGER" property="price"/>
  71. <result column="unit" jdbcType="INTEGER" property="unit"/>
  72. <result column="remain_inventory" jdbcType="INTEGER" property="remainInventory"/>
  73. <result column="inventory" jdbcType="INTEGER" property="inventory"/>
  74. <result column="remark" jdbcType="VARCHAR" property="remark"/>
  75. <result column="status" jdbcType="INTEGER" property="status"/>
  76. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  77. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  78. <result column="business" jdbcType="INTEGER" property="business"/>
  79. <result column="sub_business" jdbcType="INTEGER" property="subBusiness"/>
  80. <result column="support_transfer" jdbcType="INTEGER" property="supportTransfer"/>
  81. <result column="subsidy_type" jdbcType="INTEGER" property="subsidyType"/>
  82. <result column="subsidy_num" jdbcType="INTEGER" property="subsidyNum"/>
  83. <result column="press_limit_num" jdbcType="INTEGER" property="pressLimitNum"/>
  84. <result column="press_limit_hours" jdbcType="INTEGER" property="pressLimitHours"/>
  85. <result column="auto_refund" jdbcType="INTEGER" property="autoRefund"/>
  86. <result column="sale_count" property="saleCount"/>
  87. <result column="transfer_count" property="transferCount"/>
  88. <result column="sale_amount" property="saleAmount"/>
  89. <result column="sum_payment" property="sumPayment"/>
  90. <result column="press_count" property="pressSendCount"/>
  91. <result column="press_succ_count" property="pressSuccCount"/>
  92. <result column="join_count" property="pressJoinCount"/>
  93. <result column="sum_subsidy" property="sumSubsidy"/>
  94. <result column="payment_rate" property="paymentRate"/>
  95. <result column="change_rate" property="changeRate"/>
  96. <result column="source_type" jdbcType="INTEGER" property="sourceType"/>
  97. </resultMap>
  98. <sql id="allColumns">
  99. `id`,`tenant_id`,`parent_tenant_id`,`type`,`cover_img`,`cover_picture`,`detail_picture`,`title`,`sub_title`,`sale_price`,`use_price`,`use_limit_quantity`,`send_type`,
  100. `valid_type`,`valid_start_date`,`valid_end_date`,`valid_days`,`detail`,`price`,`unit`,`remain_inventory`,`inventory`,
  101. `remark`,`status`,`create_date`,`update_date`,`business`,`sub_business`,`support_transfer`,`subsidy_num`,`subsidy_type`,
  102. `press_limit_num`, `press_limit_hours`, `auto_refund`,`credit_price`,`credit_refund`,`put_apply_status`,`stock_apply_status`,`cancle_apply_status`,
  103. `conditions`,approval_type,content_type,source_type
  104. </sql>
  105. <sql id="statusColumns">
  106. `id`,`remain_inventory`,`status`
  107. </sql>
  108. <sql id="dynamicWhereConditions">
  109. where 1 = 1
  110. <if test=" null != id ">
  111. and `id` = #{id}
  112. </if>
  113. <if test=" null != tenantId and '' != tenantId">
  114. and `tenant_id` = #{tenantId}
  115. </if>
  116. <if test=" null != parentTenantId and '' != parentTenantId">
  117. and `parent_tenant_id` = #{parentTenantId}
  118. </if>
  119. <if test=" null != type ">
  120. and `type` = #{type}
  121. </if>
  122. <if test=" null != coverImg ">
  123. and `cover_img` like concat('%', #{coverImg},'%')
  124. </if>
  125. <if test=" null != title and ''!=title">
  126. and `title` like concat('%', #{title},'%')
  127. </if>
  128. <if test=" null != subTitle ">
  129. and `sub_title` like concat('%', #{subTitle},'%')
  130. </if>
  131. <if test=" null != salePrice ">
  132. and `sale_price` = #{salePrice}
  133. </if>
  134. <if test=" null != usePrice ">
  135. and `use_price` = #{usePrice}
  136. </if>
  137. <if test=" null != useLimitQuantity ">
  138. and `use_limit_quantity` = #{useLimitQuantity}
  139. </if>
  140. <if test=" null != sendType ">
  141. and `send_type` = #{sendType}
  142. </if>
  143. <if test=" null != validType ">
  144. and `valid_type` = #{validType}
  145. </if>
  146. <if test=" null != validStartDate ">
  147. and `valid_start_date` = #{validStartDate}
  148. </if>
  149. <if test=" null != validEndDate ">
  150. and `valid_end_date` = #{validEndDate}
  151. </if>
  152. <if test=" null != validDays ">
  153. and `valid_days` = #{validDays}
  154. </if>
  155. <if test=" null != detail ">
  156. and `detail` like concat('%', #{detail},'%')
  157. </if>
  158. <if test=" null != price ">
  159. and `price` = #{price}
  160. </if>
  161. <if test=" null != unit ">
  162. and `unit` = #{unit}
  163. </if>
  164. <if test=" null != remainInventory ">
  165. and `remain_inventory` = #{remainInventory}
  166. </if>
  167. <if test=" null != inventory ">
  168. and `inventory` = #{inventory}
  169. </if>
  170. <if test=" null != remark ">
  171. and `remark` like concat('%', #{remark},'%')
  172. </if>
  173. <if test=" null != status">
  174. and `status` = #{status}
  175. </if>
  176. <if test=" null != startdate and null!=enddate">
  177. and `create_date` between #{startdate} and #{enddate}
  178. </if>
  179. <if test=" null != updateDate ">
  180. and `update_date` = #{updateDate}
  181. </if>
  182. <if test=" null != business ">
  183. and `business` = #{business}
  184. </if>
  185. <if test=" null != subBusiness ">
  186. and `sub_business` = #{subBusiness}
  187. </if>
  188. <if test=" null != supportTransfer ">
  189. and `support_transfer` = #{supportTransfer}
  190. </if>
  191. <if test=" null != subsidyType ">
  192. and `subsidy_type` = #{subsidyType}
  193. </if>
  194. <if test=" null != subsidyNum ">
  195. and `subsidy_num` = #{subsidyNum}
  196. </if>
  197. <if test=" null != pressLimitNum ">
  198. and `press_limit_num` = #{pressLimitNum}
  199. </if>
  200. <if test=" null != pressLimitHours ">
  201. and `press_limit_hours` = #{pressLimitHours}
  202. </if>
  203. <if test=" null != autoRefund ">
  204. and `auto_refund` = #{autoRefund}
  205. </if>
  206. <if test=" null != creditPrice ">
  207. and `credit_price` = #{creditPrice}
  208. </if>
  209. <if test=" null != creditRefund ">
  210. and `credit_refund` = #{creditRefund}
  211. </if>
  212. <if test=" 1 == filterCanPut ">
  213. and `credit_refund` = #{creditRefund}
  214. </if>
  215. <if test=" null != contentType ">
  216. and `content_type` = #{contentType}
  217. </if>
  218. <if test=" null != sourceType ">
  219. and `source_type` = #{sourceType}
  220. </if>
  221. <if test=" null != ids ">
  222. and id in
  223. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  224. #{idItem}
  225. </foreach>
  226. </if>
  227. <if test=" null != notinTypes ">
  228. and type not in
  229. <foreach collection="notinTypes" index="index" item="typeItem" open="(" separator="," close=")">
  230. #{typeItem}
  231. </foreach>
  232. </if>
  233. <if test=" null != sortColumns">order by ${sortColumns}</if>
  234. </sql>
  235. <select id="findList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
  236. select
  237. <include refid="allColumns"/>
  238. from wx_coupon
  239. <include refid="dynamicWhereConditions"/>
  240. </select>
  241. <update id="updateStockAndValidDate" parameterType="com.iformall.domain.po.WxCoupon">
  242. update wx_coupon
  243. SET
  244. `remain_inventory` = #{remainInventory}, `inventory` = #{inventory},
  245. `valid_type` = #{validType}, `valid_end_date` = #{validEndDate}, `valid_days` = #{validDays}
  246. WHERE 1=1
  247. <if test=" null != tenantId and '' != tenantId">
  248. and `tenant_id` = #{tenantId}
  249. </if>
  250. <if test=" null != parentTenantId and '' != parentTenantId">
  251. and `parent_tenant_id` = #{parentTenantId}
  252. </if>
  253. and id = #{id} and `remain_inventory` = #{orgRemainInventory} and `inventory` = #{orgInventory}
  254. </update>
  255. <sql id="dynamicWhereConditionsForCoupon">
  256. where is_del = 0
  257. <if test=" null != targetAd ">
  258. and 0 = (select count(*) from wx_coupon_channel cc
  259. where c.`id` = cc.coupon_id
  260. and cc.status = 0
  261. and cc.target_ad = #{targetAd})
  262. </if>
  263. <if test=" null != id ">
  264. and c.`id` = #{id}
  265. </if>
  266. <if test=" null != tenantId and '' != tenantId">
  267. and c.`tenant_id` = #{tenantId}
  268. </if>
  269. <if test=" null != parentTenantId and '' != parentTenantId">
  270. and c.`parent_tenant_id` = #{parentTenantId}
  271. </if>
  272. <if test=" null == type and null == types">
  273. and c.`type` &lt; 7
  274. </if>
  275. <if test=" null != type ">
  276. and c.`type` = #{type}
  277. </if>
  278. <if test=" null != coverImg ">
  279. and c.`cover_img` like concat('%', #{coverImg},'%')
  280. </if>
  281. <if test=" null != title and ''!=title">
  282. and c.`title` like concat('%', #{title},'%')
  283. </if>
  284. <if test=" null != subTitle ">
  285. and c.`sub_title` like concat('%', #{subTitle},'%')
  286. </if>
  287. <if test=" null != salePrice ">
  288. and c.`sale_price` = #{salePrice}
  289. </if>
  290. <if test=" null != usePrice ">
  291. and c.`use_price` = #{usePrice}
  292. </if>
  293. <if test=" null != useLimitQuantity ">
  294. and c.`use_limit_quantity` = #{useLimitQuantity}
  295. </if>
  296. <if test=" null != sendType ">
  297. and c.`send_type` = #{sendType}
  298. </if>
  299. <if test=" null != validType ">
  300. and c.`valid_type` = #{validType}
  301. </if>
  302. <if test=" null != validStartDate ">
  303. and c.`valid_start_date` = #{validStartDate}
  304. </if>
  305. <if test=" null != validEndDate ">
  306. and c.`valid_end_date` = #{validEndDate}
  307. </if>
  308. <if test=" null != validDays ">
  309. and c.`valid_days` = #{validDays}
  310. </if>
  311. <if test=" null != detail ">
  312. and c.`detail` like concat('%', #{detail},'%')
  313. </if>
  314. <if test=" null != price ">
  315. and c.`price` = #{price}
  316. </if>
  317. <if test=" null != unit ">
  318. and c.`unit` = #{unit}
  319. </if>
  320. <if test=" null != remainInventory ">
  321. and c.`remain_inventory` = #{remainInventory}
  322. </if>
  323. <if test=" null != inventory ">
  324. and c.`inventory` = #{inventory}
  325. </if>
  326. <if test=" null != remark ">
  327. and c.`remark` like concat('%', #{remark},'%')
  328. </if>
  329. <if test=" null != status">
  330. and c.`status` = #{status}
  331. </if>
  332. <if test=" null != startdate and null!=enddate">
  333. and c.`create_date` between #{startdate} and #{enddate}
  334. </if>
  335. <if test=" null != updateDate ">
  336. and c.`update_date` = #{updateDate}
  337. </if>
  338. <if test=" null != business ">
  339. and c.`business` = #{business}
  340. </if>
  341. <if test=" null != subBusiness ">
  342. and `sub_business` = #{subBusiness}
  343. </if>
  344. <if test=" null != supportTransfer ">
  345. and c.`support_transfer` = #{supportTransfer}
  346. </if>
  347. <if test=" null != subsidyType ">
  348. and c.`subsidy_type` = #{subsidyType}
  349. </if>
  350. <if test=" null != subsidyNum ">
  351. and c.`subsidy_num` = #{subsidyNum}
  352. </if>
  353. <if test=" null != pressLimitNum ">
  354. and c.`press_limit_num` = #{pressLimitNum}
  355. </if>
  356. <if test=" null != pressLimitHours ">
  357. and c.`press_limit_hours` = #{pressLimitHours}
  358. </if>
  359. <if test=" null != autoRefund ">
  360. and c.`auto_refund` = #{autoRefund}
  361. </if>
  362. <if test=" null != contentType ">
  363. and c.`content_type` = #{contentType}
  364. </if>
  365. <if test=" null != sourceType ">
  366. and `source_type` = #{sourceType}
  367. </if>
  368. <!--如果配置了审批模板,需要过滤投放审批状态-->
  369. <if test="0 != filterCanPut or null ==filterCanPut ">
  370. <if test=" null != pressModelId and 0l != pressModelId">
  371. and if(type=8,put_apply_status =2 or c.id in (
  372. select coupon_id from wx_coupon_channel
  373. where status=0
  374. <if test=" null != tenantId and '' != tenantId">
  375. and `tenant_id` = #{tenantId}
  376. </if>
  377. <if test=" null != parentTenantId and '' != parentTenantId">
  378. and `parent_tenant_id` = #{parentTenantId}
  379. </if>
  380. ) ,1=1)
  381. </if>
  382. <if test=" null != groupModelId and 0l != groupModelId">
  383. and if(type=9,put_apply_status =2 or c.id in (
  384. select coupon_id from wx_coupon_channel
  385. where status=0
  386. <if test=" null != tenantId and '' != tenantId">
  387. and `tenant_id` = #{tenantId}
  388. </if>
  389. <if test=" null != parentTenantId and '' != parentTenantId">
  390. and `parent_tenant_id` = #{parentTenantId}
  391. </if>
  392. ),1=1)
  393. </if>
  394. <if test=" null != cardModelId and 0l != cardModelId">
  395. and if(type=100,put_apply_status =2 or c.id in (
  396. select coupon_id from wx_coupon_channel
  397. where status=0
  398. <if test=" null != tenantId and '' != tenantId">
  399. and `tenant_id` = #{tenantId}
  400. </if>
  401. <if test=" null != parentTenantId and '' != parentTenantId">
  402. and `parent_tenant_id` = #{parentTenantId}
  403. </if>
  404. ),1=1)
  405. </if>
  406. <if test=" null != couponModelId and 0l != couponModelId">
  407. and if(type !=8 and type !=9 and type!=100,put_apply_status =2 or c.id in (
  408. select coupon_id from wx_coupon_channel
  409. where status=0
  410. <if test=" null != tenantId and '' != tenantId">
  411. and `tenant_id` = #{tenantId}
  412. </if>
  413. <if test=" null != parentTenantId and '' != parentTenantId">
  414. and `parent_tenant_id` = #{parentTenantId}
  415. </if>
  416. ),1=1)
  417. </if>
  418. </if>
  419. <if test=" null != ids ">
  420. and c.id in
  421. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  422. #{idItem}
  423. </foreach>
  424. </if>
  425. <if test=" null != types ">
  426. and c.type in
  427. <foreach collection="types" index="index" item="typesItem" open="(" separator="," close=")">
  428. #{typesItem}
  429. </foreach>
  430. </if>
  431. <if test=" null != sortColumns">order by ${sortColumns}</if>
  432. </sql>
  433. <select id="findCouponList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
  434. select
  435. <include refid="allColumns"/>
  436. from wx_coupon c
  437. <include refid="dynamicWhereConditionsForCoupon"/>
  438. <if test="null != limitStart and null != limitEnd">
  439. limit #{limitStart},#{limitEnd}
  440. </if>
  441. </select>
  442. <select id="findCouponListCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="Integer">
  443. select
  444. count(*)
  445. from wx_coupon c
  446. <include refid="dynamicWhereConditionsForCoupon"/>
  447. </select>
  448. <resultMap id="WxCouponCVoMap" type="com.iformall.domain.vo.WxCouponCVo">
  449. <id column="id" jdbcType="BIGINT" property="id"/>
  450. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  451. <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
  452. <result column="type" jdbcType="INTEGER" property="type"/>
  453. <result column="cover_img" jdbcType="VARCHAR" property="coverImg"/>
  454. <result column="cover_picture" jdbcType="VARCHAR" property="coverPicture"/>
  455. <result column="detail_picture" jdbcType="VARCHAR" property="detailPicture"/>
  456. <result column="title" jdbcType="VARCHAR" property="title"/>
  457. <result column="sub_title" jdbcType="VARCHAR" property="subTitle"/>
  458. <result column="sale_price" jdbcType="INTEGER" property="salePrice"/>
  459. <result column="use_price" jdbcType="INTEGER" property="usePrice"/>
  460. <result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity"/>
  461. <result column="send_type" jdbcType="INTEGER" property="sendType"/>
  462. <result column="valid_type" jdbcType="INTEGER" property="validType"/>
  463. <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate"/>
  464. <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate"/>
  465. <result column="valid_days" jdbcType="INTEGER" property="validDays"/>
  466. <result column="detail" jdbcType="VARCHAR" property="detail"/>
  467. <result column="price" jdbcType="INTEGER" property="price"/>
  468. <result column="unit" jdbcType="INTEGER" property="unit"/>
  469. <result column="remain_inventory" jdbcType="INTEGER" property="remainInventory"/>
  470. <result column="inventory" jdbcType="INTEGER" property="inventory"/>
  471. <result column="remark" jdbcType="VARCHAR" property="remark"/>
  472. <result column="status" jdbcType="INTEGER" property="status"/>
  473. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  474. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  475. <result column="business" jdbcType="INTEGER" property="business"/>
  476. <result column="sub_business" jdbcType="INTEGER" property="subBusiness"/>
  477. <result column="support_transfer" jdbcType="INTEGER" property="supportTransfer"/>
  478. <result column="subsidy_type" jdbcType="INTEGER" property="subsidyType"/>
  479. <result column="subsidy_num" jdbcType="INTEGER" property="subsidyNum"/>
  480. <result column="press_limit_num" jdbcType="INTEGER" property="pressLimitNum"/>
  481. <result column="press_limit_hours" jdbcType="INTEGER" property="pressLimitHours"/>
  482. <result column="conditions" jdbcType="VARCHAR" property="conditions"/>
  483. <result column="content_type" jdbcType="INTEGER" property="contentType"/>
  484. <result column="source_type" jdbcType="INTEGER" property="sourceType"/>
  485. <collection column="{productId=id}" property="merchantVoList"
  486. ofType="com.iformall.domain.vo.WxMerchantVo"
  487. javaType="java.util.List"
  488. select="com.iformall.mapper.WxCouponMerchantMapper.findMerchantBaseList">
  489. </collection>
  490. </resultMap>
  491. <resultMap id="WxCouponCVoMapL" type="com.iformall.domain.vo.WxCouponCVo">
  492. <id column="id" jdbcType="BIGINT" property="id"/>
  493. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  494. <result column="type" jdbcType="INTEGER" property="type"/>
  495. <result column="cover_img" jdbcType="VARCHAR" property="coverImg"/>
  496. <result column="cover_picture" jdbcType="VARCHAR" property="coverPicture"/>
  497. <result column="detail_picture" jdbcType="VARCHAR" property="detailPicture"/>
  498. <result column="title" jdbcType="VARCHAR" property="title"/>
  499. <result column="sub_title" jdbcType="VARCHAR" property="subTitle"/>
  500. <result column="sale_price" jdbcType="INTEGER" property="salePrice"/>
  501. <result column="use_price" jdbcType="INTEGER" property="usePrice"/>
  502. <result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity"/>
  503. <result column="send_type" jdbcType="INTEGER" property="sendType"/>
  504. <result column="valid_type" jdbcType="INTEGER" property="validType"/>
  505. <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate"/>
  506. <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate"/>
  507. <result column="valid_days" jdbcType="INTEGER" property="validDays"/>
  508. <result column="detail" jdbcType="VARCHAR" property="detail"/>
  509. <result column="price" jdbcType="INTEGER" property="price"/>
  510. <result column="unit" jdbcType="INTEGER" property="unit"/>
  511. <result column="remain_inventory" jdbcType="INTEGER" property="remainInventory"/>
  512. <result column="inventory" jdbcType="INTEGER" property="inventory"/>
  513. <result column="remark" jdbcType="VARCHAR" property="remark"/>
  514. <result column="status" jdbcType="INTEGER" property="status"/>
  515. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  516. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  517. <result column="business" jdbcType="INTEGER" property="business"/>
  518. <result column="sub_business" jdbcType="INTEGER" property="subBusiness"/>
  519. <result column="support_transfer" jdbcType="INTEGER" property="supportTransfer"/>
  520. <result column="subsidy_type" jdbcType="INTEGER" property="subsidyType"/>
  521. <result column="subsidy_num" jdbcType="INTEGER" property="subsidyNum"/>
  522. <result column="press_limit_num" jdbcType="INTEGER" property="pressLimitNum"/>
  523. <result column="press_limit_hours" jdbcType="INTEGER" property="pressLimitHours"/>
  524. <result column="conditions" jdbcType="VARCHAR" property="conditions"/>
  525. <result column="content_type" jdbcType="INTEGER" property="contentType"/>
  526. <result column="source_type" jdbcType="INTEGER" property="sourceType"/>
  527. </resultMap>
  528. <select id="findVoDetail" parameterType="java.lang.Long" resultMap="WxCouponCVoMap">
  529. select
  530. <include refid="allColumns"/>
  531. from wx_coupon
  532. where id = #{id}
  533. </select>
  534. <select id="findVoStatusDetail" parameterType="java.lang.Long" resultMap="WxCouponCVoMapL">
  535. select id, remain_inventory, status
  536. from wx_coupon
  537. where id = #{id}
  538. </select>
  539. <update id="reduceInventory">
  540. update wx_coupon SET remain_inventory = remain_inventory - #{number} where id = #{id} and remain_inventory - #{number} &gt;= 0
  541. </update>
  542. <update id="backInventory">
  543. update wx_coupon SET remain_inventory = remain_inventory + #{number} where id = #{id} and remain_inventory + #{number} &lt;= inventory
  544. </update>
  545. <update id="offExpiriedCouponByValidDate">
  546. update wx_coupon SET status = 1, update_date = now()
  547. where status = 0 and valid_type = 1 and valid_end_date &lt; now()
  548. </update>
  549. <update id="offExpiriedCouponByMerchantStatus">
  550. update wx_coupon c
  551. SET c.status = 1, c.update_date = now()
  552. where c.status = 0 and
  553. (select count(*) from wx_coupon_merchant cm, wx_merchant m
  554. where m.id = cm.merchant_id
  555. and c.id = cm.product_id
  556. and cm.status = 0
  557. and m.status = 1) = 0
  558. </update>
  559. <select id="findSaleMoneyByDate" parameterType="com.iformall.domain.po.WxCoupon"
  560. resultType="com.iformall.domain.vo.WxCouponStatisVo">
  561. select DATE_FORMAT(ci.create_date,'%Y-%m-%d') xtime,sum(round(ci.sale_amount/100,2)) xcount from wx_card_info ci
  562. left join wx_coupon c on c.id = ci.coupon_id
  563. where c.type = 100
  564. and ci.create_date between #{startdate} and #{enddate}
  565. group by xtime
  566. </select>
  567. <select id="findPaymentByDate" parameterType="com.iformall.domain.po.WxCoupon"
  568. resultType="com.iformall.domain.vo.WxCouponStatisVo">
  569. select DATE_FORMAT(wcs.create_date,'%Y-%m-%d') xtime,sum(round(wcs.real_payment/100,2)) xcount from wx_card_info ci
  570. left join wx_coupon c on c.id = ci.coupon_id
  571. left join wx_card_spend wcs on wcs.card_id = ci.id
  572. where c.type = 100
  573. and wcs.create_date between #{startdate} and #{enddate}
  574. group by xtime
  575. </select>
  576. <select id="findSaleCardCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long">
  577. select count(co.id)
  578. from wx_card_info ci
  579. left join wx_coupon c on c.id = ci.coupon_id
  580. left join wx_coupon_order co on co.id = ci.id
  581. where c.type = 100
  582. and co.create_date between #{startdate} and #{enddate}
  583. </select>
  584. <select id="findTranCardCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long">
  585. select count(distinct wcs.coupon_order_id) from wx_card_info ci
  586. left join wx_coupon c on c.id = ci.coupon_id
  587. left join wx_card_transfer_info wcs on wcs.coupon_order_id = ci.id
  588. where c.type = 100 and wcs.create_date between #{startdate} and #{enddate}
  589. </select>
  590. <select id="findSubsidyMoney" parameterType="com.iformall.domain.po.WxCoupon" resultType="String">
  591. select sum(round(sc.subsidy/100,2)) from wx_card_info ci
  592. left join wx_coupon c on c.id = ci.coupon_id
  593. left join wx_merchant_subsidy sc on sc.coupon_order_id = ci.id
  594. where c.type = 100 and sc.create_date between #{startdate} and #{enddate}
  595. </select>
  596. <select id="findCountData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="statisMap">
  597. select c.*,
  598. IFNULL(round((select sum(wcs.real_payment) from wx_card_info ci
  599. left join wx_coupon wc on wc.id = ci.coupon_id
  600. left join wx_card_spend wcs on wcs.card_id = ci.id
  601. where wc.id = c.id)/(select sum(ci.sale_amount) from wx_card_info ci
  602. left join wx_coupon wc on wc.id = ci.coupon_id
  603. where wc.id = c.id)*100,2),0) payment_rate,
  604. (select count(wco.id) from wx_coupon wc
  605. left join wx_coupon_order wco on wc.id = wco.coupon_id
  606. where wc.id = c.id) as sale_count,
  607. (select count(distinct wcs.coupon_order_id) from wx_card_info ci
  608. left join wx_coupon wc on wc.id = ci.coupon_id
  609. left join wx_card_transfer_info wcs on wcs.coupon_order_id = ci.id
  610. where wc.id = c.id) as transfer_count,
  611. (select sum(ci.sale_amount) from wx_card_info ci
  612. left join wx_coupon wc on wc.id = ci.coupon_id
  613. where wc.id = c.id) as sale_amount,
  614. (select sum(wcs.real_payment) from wx_card_info ci
  615. left join wx_coupon wc on wc.id = ci.coupon_id
  616. left join wx_card_spend wcs on wcs.card_id = ci.id
  617. where wc.id = c.id) as sum_payment,
  618. (select sum(sc.subsidy) from wx_card_info ci
  619. left join wx_coupon wc on wc.id = ci.coupon_id
  620. left join wx_merchant_subsidy sc on sc.coupon_order_id = ci.id
  621. where wc.id = c.id) as sum_subsidy
  622. from wx_coupon c where c.type = 100
  623. <if test="title != null and title !=''">
  624. and c.title like concat('%', #{title},'%')
  625. </if>
  626. <if test="id != null">
  627. and c.id = #{id}
  628. </if>
  629. <if test=" null != sortColumns">order by ${sortColumns}</if>
  630. <if test=" null == sortColumns">order by c.status asc,c.create_date desc</if>
  631. </select>
  632. <select id="findCouponData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="statisMap">
  633. select c.*,
  634. IFNULL(round((select count(wco.id) from wx_coupon wc,wx_coupon_order wco where wco.coupon_id = wc.id and
  635. wco.coupon_order_status = 1 and wc.id = c.id)/(select count(wco.id) from wx_coupon_order wco where wco.coupon_id
  636. = c.id)*100,2),0) payment_rate,
  637. (select count(wco.id) from wx_coupon_order wco where wco.coupon_id = c.id) as sale_count,
  638. (select count(wco.id) from wx_coupon wc,wx_coupon_order wco where wco.coupon_id = wc.id and
  639. wco.coupon_order_status = 1 and wc.id = c.id) as sum_payment,
  640. (select count(wco.id) from wx_coupon wc,wx_coupon_order wco where wco.coupon_id = wc.id and
  641. wco.coupon_order_status = 3 and wc.id = c.id) as backpay_count,
  642. (select sum(sc.subsidy) from wx_coupon wc
  643. left join wx_coupon_order wo on wo.coupon_id = wc.id
  644. left join wx_merchant_subsidy sc on sc.coupon_order_id = wo.id
  645. where wc.id = c.id) as sum_subsidy
  646. from wx_coupon c where c.type not in(8,9,100)
  647. <if test=" 1 == type ">
  648. and c.sale_price > 0
  649. </if>
  650. <if test=" 2 == type ">
  651. and c.sale_price = 0
  652. </if>
  653. <if test="title != null and title != ''">
  654. and c.title like concat('%', #{title},'%')
  655. </if>
  656. <if test="id != null">
  657. and c.id = #{id}
  658. </if>
  659. <if test=" null != sortColumns">order by ${sortColumns}</if>
  660. <if test=" null == sortColumns">order by c.status asc,c.create_date desc</if>
  661. </select>
  662. <select id="findPressData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="statisMap">
  663. select c.id,c.tenant_id, c.`cover_img`,c.`title`,c.`sale_price`,c.`price`,
  664. ifnull(op.press_count,0) as press_count,
  665. ifnull(o.press_succ_count,0) as press_succ_count,
  666. ifnull(op2.join_count,0) as join_count,
  667. ifnull(round(o.press_succ_count/op.press_count*100,2),0) as change_rate,
  668. ifnull(round(cop.xCount/op.press_count*100,2),0) as payment_rate
  669. FROM wx_coupon c
  670. left join (SELECT count(id) as press_count, coupon_id FROM wx_order_press WHERE `first` = 1
  671. <if test=" null != tenantId and '' != tenantId">
  672. and `tenant_id` = #{tenantId}
  673. </if>
  674. <if test=" null != parentTenantId and '' != parentTenantId">
  675. and `parent_tenant_id` = #{parentTenantId}
  676. </if>
  677. group by coupon_id) op on op.coupon_id = c.id
  678. left join (SELECT count(id) as press_succ_count, product_id FROM wx_order WHERE order_status = 1
  679. <if test=" null != tenantId and '' != tenantId">
  680. and `tenant_id` = #{tenantId}
  681. </if>
  682. <if test=" null != parentTenantId and '' != parentTenantId">
  683. and `parent_tenant_id` = #{parentTenantId}
  684. </if>
  685. group by product_id) o on o.product_id = c.id
  686. left join (SELECT count(id) as join_count, coupon_id FROM wx_order_press WHERE 1=1
  687. <if test=" null != tenantId and '' != tenantId">
  688. and `tenant_id` = #{tenantId}
  689. </if>
  690. <if test=" null != parentTenantId and '' != parentTenantId">
  691. and `parent_tenant_id` = #{parentTenantId}
  692. </if>
  693. group by coupon_id) op2 on op2.coupon_id = c.id
  694. left join (SELECT count(id) as xCount, coupon_id FROM wx_coupon_order WHERE coupon_order_status = 1
  695. <if test=" null != tenantId and '' != tenantId">
  696. and `tenant_id` = #{tenantId}
  697. </if>
  698. <if test=" null != parentTenantId and '' != parentTenantId">
  699. and `parent_tenant_id` = #{parentTenantId}
  700. </if>
  701. group by coupon_id) cop on cop.coupon_id = c.id
  702. where c.type = 8
  703. <if test=" null != tenantId and '' != tenantId">
  704. and c.`tenant_id` = #{tenantId}
  705. </if>
  706. <if test=" null != parentTenantId and '' != parentTenantId">
  707. and c.`parent_tenant_id` = #{parentTenantId}
  708. </if>
  709. <if test="id != null">
  710. and c.id = #{id}
  711. </if>
  712. <if test="title != null and title != ''">
  713. and c.title like concat('%', #{title},'%')
  714. </if>
  715. <if test=" null != startdate and null!=enddate">
  716. and c.`create_date` between #{startdate} and #{enddate}
  717. </if>
  718. <if test=" null != sortColumns">order by ${sortColumns}</if>
  719. <if test=" null == sortColumns">order by c.status asc,c.create_date desc</if>
  720. </select>
  721. <select id="findCouponOrderCount" parameterType="com.iformall.domain.po.WxCoupon"
  722. resultType="com.iformall.domain.vo.WxCouponStatisVo">
  723. select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon c
  724. left join wx_coupon_order wco on c.id = wco.coupon_id
  725. where c.type not in(8,9,100)
  726. and wco.create_date between #{startdate} and #{enddate}
  727. group by xtime
  728. </select>
  729. <select id="findCouponPaymentCount" parameterType="com.iformall.domain.po.WxCoupon"
  730. resultType="com.iformall.domain.vo.WxCouponStatisVo">
  731. select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon c,wx_coupon_order wco
  732. where c.type not in(8,9,100)
  733. and wco.coupon_id = c.id and wco.coupon_order_status = 1
  734. and wco.update_date between #{startdate} and #{enddate}
  735. group by xtime
  736. </select>
  737. <select id="priceCouponSaleCount" parameterType="com.iformall.domain.po.WxCoupon"
  738. resultType="com.iformall.domain.vo.WxCouponStatisVo">
  739. select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon c,wx_coupon_order wco
  740. where c.type not in(8,9,100)
  741. and wco.coupon_id = c.id and wco.coupon_price > 0
  742. and wco.create_date between #{startdate} and #{enddate}
  743. group by xtime
  744. </select>
  745. <select id="priceCouponPaymentCount" parameterType="com.iformall.domain.po.WxCoupon"
  746. resultType="com.iformall.domain.vo.WxCouponStatisVo">
  747. select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon c,wx_coupon_order wco
  748. where c.type not in(8,9,100)
  749. and wco.coupon_id = c.id and wco.coupon_order_status = 1 and wco.coupon_price > 0
  750. and wco.update_date between #{startdate} and #{enddate}
  751. group by xtime
  752. </select>
  753. <select id="findSumPriceSaleMoney" parameterType="com.iformall.domain.po.WxCoupon" resultType="String">
  754. select sum(round(c.sale_price/100,2)) from wx_coupon c,wx_coupon_order wco
  755. where wco.coupon_id = c.id and wco.coupon_price > 0
  756. and wco.create_date between #{startdate} and #{enddate}
  757. </select>
  758. <select id="findSumPricePayMent" parameterType="com.iformall.domain.po.WxCoupon" resultType="String">
  759. select sum(round(c.sale_price/100,2)) from wx_coupon c,wx_coupon_order wco
  760. where wco.coupon_id = c.id and wco.coupon_price > 0 and wco.coupon_order_status = 1
  761. and wco.update_date between #{startdate} and #{enddate}
  762. </select>
  763. <select id="findSumSubsidyMoney" parameterType="com.iformall.domain.po.WxCoupon" resultType="String">
  764. select sum(round(sc.subsidy/100,2)) from wx_coupon c
  765. left join wx_coupon_order wo on wo.coupon_id = c.id
  766. left join wx_merchant_subsidy sc on sc.coupon_order_id = wo.id
  767. where c.type not in(8,9,100) and wo.coupon_order_status = 1
  768. and sc.create_date between #{startdate} and #{enddate}
  769. </select>
  770. <!--砍价-->
  771. <select id="pressSendHistory" parameterType="com.iformall.domain.po.WxCoupon"
  772. resultType="com.iformall.domain.vo.WxCouponStatisVo">
  773. select DATE_FORMAT(wop.create_date,'%Y-%m-%d') xtime,count(wop.id) xcount from wx_coupon wc
  774. left join wx_order wo on wo.product_id = wc.id
  775. left join wx_order_press wop on wop.order_id = wo.id
  776. where wc.type = 8 and wop.first = 1 and
  777. wop.create_date between #{startdate} and #{enddate}
  778. group by xtime
  779. </select>
  780. <select id="pressSuccHistory" parameterType="com.iformall.domain.po.WxCoupon"
  781. resultType="com.iformall.domain.vo.WxCouponStatisVo">
  782. select DATE_FORMAT(wo.create_date,'%Y-%m-%d') xtime,count(wo.id) xcount from wx_coupon wc
  783. left join wx_order wo on wo.product_id = wc.id
  784. where wc.type = 8 and wo.order_status = 1
  785. and wo.create_date between #{startdate} and #{enddate}
  786. group by xtime
  787. </select>
  788. <select id="pressPaymentHistory" parameterType="com.iformall.domain.po.WxCoupon"
  789. resultType="com.iformall.domain.vo.WxCouponStatisVo">
  790. select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon wc
  791. left join wx_coupon_order wco on wco.coupon_id = wc.id
  792. where wc.type = 8 and wco.coupon_order_status = 1
  793. and wco.create_date between #{startdate} and #{enddate}
  794. group by xtime
  795. </select>
  796. <select id="pressSuccRate" parameterType="com.iformall.domain.po.WxCoupon" resultType="java.lang.String">
  797. select
  798. round(
  799. (select count(wo.id) from wx_coupon wc
  800. left join wx_order wo on wo.product_id = wc.id
  801. where wo.order_status = 1 and wc.type = 8
  802. and wo.create_date between #{startdate} and #{enddate}
  803. <if test=" null != tenantId and '' != tenantId">
  804. and wo.`tenant_id` = #{tenantId}
  805. </if>
  806. <if test=" null != parentTenantId and '' != parentTenantId">
  807. and wo.`parent_tenant_id` = #{parentTenantId}
  808. </if>
  809. )
  810. /
  811. (select count(wop.id) from wx_coupon wc
  812. left join wx_order wo on wo.product_id = wc.id
  813. left join wx_order_press wop on wop.order_id = wo.id
  814. where wop.first = 1 and wc.type = 8
  815. and wop.create_date between #{startdate} and #{enddate}
  816. <if test=" null != tenantId and '' != tenantId">
  817. and wo.`tenant_id` = #{tenantId}
  818. and wop.`tenant_id` = #{tenantId}
  819. </if>
  820. <if test=" null != parentTenantId and '' != parentTenantId">
  821. and wo.`parent_tenant_id` = #{parentTenantId}
  822. and wop.`parent_tenant_id` = #{parentTenantId}
  823. </if>
  824. )
  825. * 100
  826. ,2)
  827. </select>
  828. <select id="sumJoin" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long">
  829. select count(wop.id) from wx_coupon wc
  830. left join wx_order wo on wo.product_id = wc.id
  831. left join wx_order_press wop on wop.order_id = wo.id
  832. where wc.type = 8
  833. and wop.create_date between #{startdate} and #{enddate}
  834. </select>
  835. <select id="priceCouponCancelCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long">
  836. select count(c.id) from wx_coupon c
  837. left join wx_coupon_order wco on c.id = wco.coupon_id
  838. where c.type not in(8,9,100)
  839. and wco.create_date between #{startdate} and #{enddate}
  840. and wco.coupon_order_status = 3
  841. </select>
  842. <select id="findSaleCardCountHistory" parameterType="com.iformall.domain.po.WxCoupon"
  843. resultType="com.iformall.domain.vo.WxCouponStatisVo">
  844. select DATE_FORMAT(co.create_date,'%Y-%m-%d') xtime,count(co.id) xcount
  845. from wx_card_info ci
  846. left join wx_coupon c on c.id = ci.coupon_id
  847. left join wx_coupon_order co on co.id = ci.id
  848. where c.type = 100
  849. and co.create_date between #{startdate} and #{enddate}
  850. group by xtime
  851. </select>
  852. <select id="findCouponByTopic" parameterType="com.iformall.domain.po.WxTopic"
  853. resultType="com.iformall.domain.po.WxCoupon">
  854. select ct.id as id,wc.id as couponId,
  855. wc.tenant_id,wc.parent_tenant_id,wc.`type`,wc.`cover_img`,wc.`cover_picture`,wc.`detail_picture`,wc.`title`,wc.`sub_title`,wc.`sale_price`,wc.`use_price`,wc.`use_limit_quantity`,wc.`send_type`,
  856. wc.`valid_type`,wc.`valid_start_date`,wc.`valid_end_date`,wc.`valid_days`,wc.`detail`,wc.`price`,wc.`unit`,wc.`remain_inventory`,wc.`inventory`,
  857. wc.`remark`,wc.`status`,wc.`create_date`,wc.`update_date`,wc.`business`,wc.`sub_business`,wc.`support_transfer`,wc.`subsidy_num`,wc.`subsidy_type`,
  858. wc.`press_limit_num`, wc.`press_limit_hours`, wc.`auto_refund`,wc.`credit_price`,wc.`credit_refund`,wc.`conditions`,
  859. wc.title as couponName,wc.`cover_img` as couponPic,wc.`cover_picture` as couponPicture,wc.`detail_picture` as detailPicture,wc.id as couponId
  860. from wx_coupon_channel ct
  861. left join wx_coupon wc on wc.id = ct.coupon_id
  862. where ct.`sub_target_id` = #{id} and ct.status = 0
  863. </select>
  864. <select id="findCouponModel" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon">
  865. select
  866. max(case type when 9 then model_id else 0 end) couponModelId,
  867. max(case type when 10 then model_id else 0 end) cardModelId,
  868. max(case type when 11 then model_id else 0 end) groupModelId,
  869. max(case type when 12 then model_id else 0 end) pressModelId
  870. from wx_flow_config
  871. where type in(9,10,11,12)
  872. <if test=" null != tenantId and '' != tenantId">
  873. and `tenant_id` = #{tenantId}
  874. </if>
  875. <if test=" null != parentTenantId and '' != parentTenantId">
  876. and `parent_tenant_id` = #{parentTenantId}
  877. </if>
  878. </select>
  879. </mapper>