25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 

592 satır
23 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.WxCouponOrderMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCouponOrder">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
  7. <result column="coupon_id" jdbcType="BIGINT" property="couponId" />
  8. <result column="c_user_id" jdbcType="BIGINT" property="cUserId" />
  9. <result column="b_user_id" jdbcType="BIGINT" property="bUserId" />
  10. <result column="order_id" jdbcType="BIGINT" property="orderId" />
  11. <result column="expired_time" jdbcType="TIMESTAMP" property="expiredTime" />
  12. <result column="coupon_order_status" jdbcType="INTEGER" property="couponOrderStatus" />
  13. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  14. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
  15. <result column="coupon_price" jdbcType="INTEGER" property="couponPrice" />
  16. </resultMap>
  17. <sql id="allColumns">
  18. `id`,`tenant_id`,`coupon_id`,`c_user_id`,`b_user_id`,`order_id`,`expired_time`,`coupon_order_status`,`create_date`,`update_date`,`coupon_price`
  19. </sql>
  20. <sql id="dynamicWhereConditions">
  21. where 1 = 1
  22. <if test=" null != id ">
  23. and `id` = #{id}
  24. </if>
  25. <if test=" null != tenantId ">
  26. and `tenant_id` = #{tenantId}
  27. </if>
  28. <if test=" null != couponId ">
  29. and `coupon_id` = #{couponId}
  30. </if>
  31. <if test=" null != cUserId ">
  32. and `c_user_id` = #{cUserId}
  33. </if>
  34. <if test=" null != bUserId ">
  35. and `b_user_id` = #{bUserId}
  36. </if>
  37. <if test=" null != orderId ">
  38. and `order_id` = #{orderId}
  39. </if>
  40. <if test=" null != expiredTime ">
  41. and `expired_time` = #{expiredTime}
  42. </if>
  43. <if test=" null != couponOrderStatus ">
  44. and `coupon_order_status` = #{couponOrderStatus}
  45. </if>
  46. <if test=" null != createDate ">
  47. and `create_date` = #{createDate}
  48. </if>
  49. <if test=" null != updateDate ">
  50. and `update_date` = #{updateDate}
  51. </if>
  52. <if test=" null != couponPrice ">
  53. and `coupon_price` = #{couponPrice}
  54. </if>
  55. <if test=" null != ids ">
  56. and id in
  57. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  58. #{idItem}
  59. </foreach>
  60. </if>
  61. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  62. </sql>
  63. <select id="findList" parameterType="com.iformall.domain.po.WxCouponOrder" resultMap="BaseResultMap">
  64. select <include refid="allColumns" /> from wx_coupon_order
  65. <include refid="dynamicWhereConditions" />
  66. </select>
  67. <select id="countList" parameterType="com.iformall.domain.po.WxCouponOrder" resultType="java.lang.Integer">
  68. select count(*) from wx_coupon_order
  69. <include refid="dynamicWhereConditions" />
  70. </select>
  71. <select id="dayCountCarList" parameterType="hashmap" resultType="java.lang.Integer">
  72. select count(*) from wx_coupon_order
  73. <where>
  74. <if test=" null != tenantId ">
  75. and `tenant_id` = #{tenantId}
  76. </if>
  77. <if test=" null != couponId ">
  78. and `coupon_id` = #{couponId}
  79. </if>
  80. <if test=" null != cUserId ">
  81. and `c_user_id` = #{cUserId}
  82. </if>
  83. and date(`create_date`) = curdate()
  84. </where>
  85. </select>
  86. <resultMap id="BVoResultMap" type="com.iformall.domain.vo.WxCouponOrderBVo">
  87. <id column="id" jdbcType="BIGINT" property="id" />
  88. <result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
  89. <result column="coupon_id" jdbcType="BIGINT" property="couponId" />
  90. <result column="c_user_id" jdbcType="BIGINT" property="cUserId" />
  91. <result column="b_user_id" jdbcType="BIGINT" property="bUserId" />
  92. <result column="order_id" jdbcType="BIGINT" property="orderId" />
  93. <result column="expired_time" jdbcType="TIMESTAMP" property="expiredTime" />
  94. <result column="coupon_order_status" jdbcType="INTEGER" property="couponOrderStatus" />
  95. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  96. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
  97. <result column="coupon_price" jdbcType="INTEGER" property="couponPrice" />
  98. <result column="type" jdbcType="INTEGER" property="type" />
  99. <result column="title" jdbcType="VARCHAR" property="title" />
  100. <result column="sale_price" jdbcType="INTEGER" property="salePrice" />
  101. <result column="use_price" jdbcType="INTEGER" property="usePrice" />
  102. <result column="price" jdbcType="INTEGER" property="price" />
  103. <result column="merchant_name" jdbcType="VARCHAR" property="merchantName" />
  104. <result column="name" jdbcType="VARCHAR" property="bUserName" />
  105. <result column="bphone" jdbcType="VARCHAR" property="bUserPhone" />
  106. <result column="phone" jdbcType="VARCHAR" property="cUserPhone" />
  107. </resultMap>
  108. <sql id="allAdminCouponOrderColumns">
  109. co.id,co.tenant_id,co.coupon_id,co.c_user_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,
  110. c.type,c.title,c.sale_price,c.use_price,c.price,c.unit,
  111. m.name as merchant_name, bu.name, bu.phone as bphone, cu.phone
  112. </sql>
  113. <sql id="allBUserVerifiedCouponOrderColumns">
  114. co.id,co.tenant_id,co.coupon_id,co.c_user_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,
  115. c.type,c.title,c.sale_price,c.use_price,c.price,c.unit,
  116. bu.name,cu.phone
  117. </sql>
  118. <sql id="allBUserOrderedCouponOrderColumns">
  119. co.id,co.tenant_id,co.coupon_id,co.c_user_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,
  120. c.type,c.title,c.sale_price,c.use_price,c.price,c.unit,
  121. cu.phone
  122. </sql>
  123. <sql id="allCouponOrderColumns">
  124. co.id,co.tenant_id,co.coupon_id,co.c_user_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price
  125. </sql>
  126. <select id="findListOfOrderedByDateForBUser" parameterType="map" resultMap="BVoResultMap">
  127. select <include refid="allBUserOrderedCouponOrderColumns" />
  128. from wx_coupon_order co,wx_order o,wx_coupon c,wx_c_user cu
  129. where o.id = co.order_id
  130. and o.merchant_id = #{merchantId}
  131. and co.coupon_id = c.id
  132. and cu.id = co.c_user_id
  133. <if test="startDate != null">
  134. AND co.create_date &gt; #{startDate,jdbcType=TIMESTAMP}
  135. </if>
  136. <if test="endDate != null">
  137. AND co.create_date &lt; #{endDate,jdbcType=TIMESTAMP}
  138. </if>
  139. order by co.create_date desc
  140. </select>
  141. <select id="findListOfVerifiedByDateForBUser" parameterType="map" resultMap="BVoResultMap">
  142. select <include refid="allBUserVerifiedCouponOrderColumns" />
  143. from wx_coupon_order co,wx_order o,wx_coupon c,wx_c_user cu,wx_merchant_b_user bu
  144. where o.id = co.order_id
  145. and o.merchant_id = #{merchantId}
  146. and co.coupon_id = c.id
  147. and cu.id = co.c_user_id
  148. and bu.id = co.b_user_id
  149. <if test="startDate != null">
  150. AND co.update_date &gt; #{startDate,jdbcType=TIMESTAMP}
  151. </if>
  152. <if test="endDate != null">
  153. AND co.update_date &lt; #{endDate,jdbcType=TIMESTAMP}
  154. </if>
  155. AND co.coupon_order_status = '1'
  156. order by co.update_date desc
  157. </select>
  158. <select id="findListOfAdmin" parameterType="com.iformall.domain.vo.WxCouponOrderBVo" resultMap="BVoResultMap">
  159. select <include refid="allAdminCouponOrderColumns" />
  160. from wx_coupon_order co
  161. inner JOIN wx_order o on o.id = co.order_id
  162. inner JOIN wx_coupon c on co.coupon_id = c.id
  163. inner JOIN wx_c_user cu on cu.id = co.c_user_id
  164. inner JOIN wx_merchant m on o.merchant_id = m.id
  165. left join wx_merchant_b_user bu on co.b_user_id = bu.id
  166. where 1 = 1
  167. <if test=" null != id ">
  168. and co.id = #{id}
  169. </if>
  170. <if test=" null != tenantId ">
  171. and co.tenant_id = #{tenantId}
  172. </if>
  173. <if test=" null != couponOrderStatus ">
  174. and co.coupon_order_status = #{couponOrderStatus}
  175. </if>
  176. <if test=" null != merchantName ">
  177. and m.name like concat('%', #{merchantName},'%')
  178. </if>
  179. <if test="startDate != null">
  180. AND co.create_date &gt; #{startDate,jdbcType=TIMESTAMP}
  181. </if>
  182. <if test="endDate != null">
  183. AND co.create_date &lt; #{endDate,jdbcType=TIMESTAMP}
  184. </if>
  185. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  186. </select>
  187. <select id="findListOfOrderedByDate" parameterType="map" resultMap="BaseResultMap">
  188. select <include refid="allCouponOrderColumns" />
  189. from wx_coupon_order co,wx_order o
  190. where o.id = co.order_id
  191. and o.merchant_id = #{merchantId}
  192. <if test="startDate != null">
  193. AND co.create_date &gt; #{startDate,jdbcType=TIMESTAMP}
  194. </if>
  195. <if test="endDate != null">
  196. AND co.create_date &lt; #{endDate,jdbcType=TIMESTAMP}
  197. </if>
  198. </select>
  199. <select id="findListOfVerifiedByDate" parameterType="map" resultMap="BaseResultMap">
  200. select <include refid="allCouponOrderColumns" />
  201. from wx_coupon_order co,wx_order o
  202. where o.id = co.order_id
  203. and o.merchant_id = #{merchantId}
  204. <if test="startDate != null">
  205. AND co.update_date &gt; #{startDate,jdbcType=TIMESTAMP}
  206. </if>
  207. <if test="endDate != null">
  208. AND co.update_date &lt; #{endDate,jdbcType=TIMESTAMP}
  209. </if>
  210. AND co.coupon_order_status = '1'
  211. </select>
  212. <sql id="allCUserCouponOrderListColumns">
  213. c.id,c.expired_time,c.coupon_order_status,c.create_date,c.update_date,c.coupon_price,
  214. co.cover_img,co.title,co.sub_title,co.sale_price,co.use_price,co.price,co.unit,
  215. m.name
  216. </sql>
  217. <sql id="allCUserCouponOrderDetailColumns">
  218. c.id,c.tenant_id,c.coupon_id,c.c_user_id,c.b_user_id,c.order_id,c.expired_time,c.coupon_order_status,c.create_date,c.update_date,c.coupon_price,
  219. co.merchant_id,co.type,co.cover_img,co.title,co.sub_title,co.sale_price,co.use_price,co.price,co.unit,co.detail,co.remark,
  220. m.img_url,m.name,m.link_phone,m.status,
  221. s.addr,s.shop_number,s.baidu_poi,
  222. mb.building_name,mf.floor_name
  223. </sql>
  224. <resultMap id="CVoResultMap" type="com.iformall.domain.vo.WxCouponOrderCVo">
  225. <id column="id" jdbcType="BIGINT" property="id" />
  226. <result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
  227. <result column="coupon_id" jdbcType="BIGINT" property="couponId" />
  228. <result column="c_user_id" jdbcType="BIGINT" property="cUserId" />
  229. <result column="b_user_id" jdbcType="BIGINT" property="bUserId" />
  230. <result column="order_id" jdbcType="BIGINT" property="orderId" />
  231. <result column="expired_time" jdbcType="TIMESTAMP" property="expiredTime" />
  232. <result column="coupon_order_status" jdbcType="INTEGER" property="couponOrderStatus" />
  233. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  234. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
  235. <result column="coupon_price" jdbcType="INTEGER" property="couponPrice" />
  236. <result column="merchant_id" jdbcType="BIGINT" property="merchantId" />
  237. <result column="type" jdbcType="INTEGER" property="type" />
  238. <result column="cover_img" jdbcType="VARCHAR" property="coverImg" />
  239. <result column="title" jdbcType="VARCHAR" property="title" />
  240. <result column="sub_title" jdbcType="VARCHAR" property="subTitle" />
  241. <result column="sale_price" jdbcType="INTEGER" property="salePrice" />
  242. <result column="use_price" jdbcType="INTEGER" property="usePrice" />
  243. <result column="detail" jdbcType="VARCHAR" property="detail" />
  244. <result column="price" jdbcType="INTEGER" property="price" />
  245. <result column="unit" jdbcType="INTEGER" property="unit" />
  246. <result column="remark" jdbcType="VARCHAR" property="remark" />
  247. <result column="img_url" jdbcType="VARCHAR" property="merchantImgUrl" />
  248. <result column="name" jdbcType="VARCHAR" property="merchantName" />
  249. <result column="link_phone" jdbcType="VARCHAR" property="merchantLinkPhone" />
  250. <result column="status" jdbcType="VARCHAR" property="merchantStatus" />
  251. <result column="addr" jdbcType="VARCHAR" property="addr"/>
  252. <result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/>
  253. <result column="building_name" jdbcType="VARCHAR" property="buildingName" />
  254. <result column="floor_name" jdbcType="VARCHAR" property="floorName" />
  255. <result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/>
  256. </resultMap>
  257. <select id="findListOfCUser" parameterType="com.iformall.domain.vo.WxCouponOrderCVo" resultMap="CVoResultMap">
  258. select <include refid="allCUserCouponOrderListColumns" />
  259. from wx_coupon_order c,wx_coupon co,wx_merchant m
  260. where 1=1
  261. and c.coupon_id = co.id
  262. and co.merchant_id = m.id
  263. <if test="cUserId != null">
  264. and c.c_user_id = #{cUserId}
  265. </if>
  266. <if test="tenantId != null">
  267. and c.tenant_id = #{tenantId}
  268. </if>
  269. <if test="type != null">
  270. and co.type = #{type}
  271. </if>
  272. <if test="type == null">
  273. and co.type &lt; 5
  274. </if>
  275. <if test="couponOrderStatus != null">
  276. AND c.coupon_order_status = #{couponOrderStatus}
  277. </if>
  278. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  279. </select>
  280. <select id="selectDetailOfUser" parameterType="map" resultMap="CVoResultMap">
  281. select <include refid="allCUserCouponOrderDetailColumns" />
  282. from wx_coupon_order c,wx_coupon co,wx_merchant m
  283. left join wx_merchant_shop ms on ms.merchant_id = m.id and ms.is_del = 0
  284. left join wx_shop s on ms.shop_id = s.id
  285. left join wx_mall_building mb on s.building = mb.id
  286. left join wx_mall_floor mf on s.floor = mf.id
  287. where c.coupon_id = co.id
  288. and co.merchant_id = m.id
  289. <if test="cUserId != null">
  290. and c.c_user_id = #{cUserId}
  291. </if>
  292. <if test="merchantId != null">
  293. and co.merchant_id = #{merchantId}
  294. </if>
  295. <if test="tenantId != null">
  296. and c.tenant_id = #{tenantId}
  297. </if>
  298. <if test="couponOrderId != null">
  299. and c.id = #{couponOrderId}
  300. </if>
  301. </select>
  302. <select id="findCountByDateLimit" resultType="java.lang.Integer">
  303. select COUNT(*) FROM wx_coupon_order where tenant_id = #{tenantId} and create_date &gt;= #{startTime} and create_date &lt;= #{endTime}
  304. </select>
  305. <select id="couponDataMap" resultType="com.iformall.domain.vo.MarkingCouponDataReportVo" parameterType="hashmap">
  306. SELECT DATE_FORMAT(create_date,'%m/%d') as createTime
  307. ,COUNT(DISTINCT c_user_id) as couponUserCount,count(*) as couponCount
  308. ,(select Count(*) from wx_coupon_order c where coupon_order_status=1 AND DATE_FORMAT(create_date,'%m/%d')=createTime and tenant_id=#{tenantId} AND c.update_date &gt;= #{startTime} and c.update_date &lt;= #{endTime}) as verifyCount
  309. ,(select Count(DISTINCT c_user_id) from wx_coupon_order d where coupon_order_status=1 AND DATE_FORMAT(create_date,'%m/%d')=createTime and tenant_id=#{tenantId} AND d.update_date &gt;= #{startTime} and d.update_date &lt;= #{endTime}) as verifyUserCount
  310. from wx_coupon_order where tenant_id=#{tenantId} AND create_date &gt;= #{startTime} and create_date &lt;= #{endTime} GROUP BY createTime
  311. </select>
  312. <select id="couponDataList" resultType="com.iformall.domain.vo.MarkingCouponDataReportVo" parameterType="hashmap">
  313. SELECT DATE_FORMAT(wx_coupon_order.create_date,'%Y-%m-%d') as createTime,wx_coupon_order.coupon_id as couponId
  314. ,COUNT(DISTINCT c_user_id) as couponUserCount,count(*) as couponCount
  315. ,(select Count(coupon_id) from wx_coupon_order c
  316. where coupon_order_status=1
  317. and DATE_FORMAT(create_date,'%Y-%m-%d')=createTime
  318. and tenant_id=#{tenantId}
  319. and c.coupon_id=couponId
  320. <if test="startTime != null">
  321. and c.update_date &gt;= #{startTime}
  322. </if>
  323. <if test="endTime != null">
  324. and c.update_date &lt;= #{endTime}
  325. </if>
  326. ) as verifyCount
  327. ,(select Count(DISTINCT c_user_id) from wx_coupon_order d
  328. where coupon_order_status=1
  329. and d.coupon_id=couponId
  330. and DATE_FORMAT(create_date,'%Y-%m-%d')=createTime
  331. and tenant_id=#{tenantId}
  332. and d.coupon_id=couponId
  333. <if test="startTime != null">
  334. and d.update_date &gt;= #{startTime}
  335. </if>
  336. <if test="endTime != null">
  337. and d.update_date &lt;= #{endTime}
  338. </if>
  339. ) as verifyUserCount
  340. from wx_coupon_order
  341. join wx_coupon on wx_coupon_order.coupon_id=wx_coupon.id
  342. where wx_coupon_order.tenant_id=#{tenantId}
  343. <if test="startTime != null">
  344. and wx_coupon_order.create_date &gt;= #{startTime}
  345. </if>
  346. <if test="endTime != null">
  347. and wx_coupon_order.create_date &lt;= #{endTime}
  348. </if>
  349. <if test="couponType != null">
  350. and wx_coupon.type = #{couponType}
  351. </if>
  352. <if test="couponTitle != null">
  353. and wx_coupon.title like concat('%', #{couponTitle},'%')
  354. </if>
  355. GROUP BY createTime,couponId
  356. order by createTime desc
  357. </select>
  358. <select id="touchUsersReportList" resultType="com.iformall.domain.vo.TouchUsersReportVo" parameterType="hashmap">
  359. SELECT DATE_FORMAT(create_date,'%Y-%m-%d') as xTime
  360. ,COUNT(DISTINCT c_user_id) as userCount,count(*) as couponCount
  361. ,(select Count(*) from wx_coupon_order c
  362. where coupon_order_status=1
  363. and DATE_FORMAT(create_date,'%Y-%m-%d')=xTime
  364. and tenant_id=#{tenantId}
  365. <if test="startTime != null">
  366. and c.update_date &gt;= #{startTime}
  367. </if>
  368. <if test="endTime != null">
  369. and c.update_date &lt;= #{endTime}
  370. </if>
  371. )
  372. as verifyCount
  373. ,(select Count(DISTINCT c_user_id) from wx_coupon_order d
  374. where coupon_order_status=1
  375. and DATE_FORMAT(create_date,'%Y-%m-%d')=xTime
  376. and tenant_id=#{tenantId}
  377. <if test="startTime != null">
  378. and d.update_date &gt;= #{startTime}
  379. </if>
  380. <if test="endTime != null">
  381. and d.update_date &lt;= #{endTime}
  382. </if>
  383. )
  384. as verifyUserCount
  385. from wx_coupon_order
  386. where tenant_id=#{tenantId}
  387. <if test="startTime != null">
  388. AND create_date &gt;= #{startTime}
  389. </if>
  390. <if test="endTime != null">
  391. and create_date &lt;= #{endTime}
  392. </if>
  393. GROUP BY xTime
  394. order by xTime desc
  395. </select>
  396. <select id="queryPriceTotalGroup" resultType="com.iformall.domain.vo.CUserDateAmountVo" >
  397. SELECT DATE_FORMAT(create_date,'%Y-%m-%d') as xTime,SUM(coupon_price) as price from wx_coupon_order
  398. where tenant_id=#{tenantId} AND create_date &gt;= #{startTime} and create_date &lt; #{endTime} GROUP BY xTime
  399. </select>
  400. <select id="queryPriceTotal" resultType="java.lang.Integer" >
  401. SELECT SUM(coupon_price) from wx_coupon_order
  402. where tenant_id=#{tenantId} AND create_date &gt;= #{startTime} and create_date &lt; #{endTime}
  403. </select>
  404. <update id="offExpiredCouponOrderByValidDate">
  405. update wx_coupon_order SET coupon_order_status = 2, update_date = now()
  406. where expired_time &lt; now() and coupon_price = 0 and coupon_order_status = 0
  407. </update>
  408. <select id="findExpiredCouponOrderByValidDate" parameterType="com.iformall.domain.po.WxCouponOrder" resultMap="BaseResultMap">
  409. select <include refid="allColumns" /> from wx_coupon_order
  410. where expired_time &lt; now() and coupon_price &gt; 0 and coupon_order_status = 0
  411. </select>
  412. <sql id="allCUserCouponOrderCarListColumns">
  413. c.id,c.expired_time,c.coupon_order_status,c.create_date,c.update_date,c.coupon_price,
  414. co.cover_img,co.title,co.sub_title,co.sale_price,co.use_price,co.price,co.unit,m.id as merchant_id,
  415. m.name,json_extract(car.vendor_params,'$.id') as coupon_free_id
  416. </sql>
  417. <resultMap id="CCarVoResultMap" type="com.iformall.domain.vo.WxCouponOrderCarCVo">
  418. <id column="id" jdbcType="BIGINT" property="id" />
  419. <result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
  420. <result column="coupon_id" jdbcType="BIGINT" property="couponId" />
  421. <result column="c_user_id" jdbcType="BIGINT" property="cUserId" />
  422. <result column="b_user_id" jdbcType="BIGINT" property="bUserId" />
  423. <result column="order_id" jdbcType="BIGINT" property="orderId" />
  424. <result column="expired_time" jdbcType="TIMESTAMP" property="expiredTime" />
  425. <result column="coupon_order_status" jdbcType="INTEGER" property="couponOrderStatus" />
  426. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  427. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
  428. <result column="coupon_price" jdbcType="INTEGER" property="couponPrice" />
  429. <result column="merchant_id" jdbcType="BIGINT" property="merchantId" />
  430. <result column="type" jdbcType="INTEGER" property="type" />
  431. <result column="cover_img" jdbcType="VARCHAR" property="coverImg" />
  432. <result column="title" jdbcType="VARCHAR" property="title" />
  433. <result column="sub_title" jdbcType="VARCHAR" property="subTitle" />
  434. <result column="sale_price" jdbcType="INTEGER" property="salePrice" />
  435. <result column="use_price" jdbcType="INTEGER" property="usePrice" />
  436. <result column="detail" jdbcType="VARCHAR" property="detail" />
  437. <result column="price" jdbcType="INTEGER" property="price" />
  438. <result column="remark" jdbcType="VARCHAR" property="remark" />
  439. <result column="img_url" jdbcType="VARCHAR" property="merchantImgUrl" />
  440. <result column="name" jdbcType="VARCHAR" property="merchantName" />
  441. <result column="link_phone" jdbcType="VARCHAR" property="merchantLinkPhone" />
  442. <result column="status" jdbcType="VARCHAR" property="merchantStatus" />
  443. <result column="addr" jdbcType="VARCHAR" property="addr"/>
  444. <result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/>
  445. <result column="building_name" jdbcType="VARCHAR" property="buildingName" />
  446. <result column="floor_name" jdbcType="VARCHAR" property="floorName" />
  447. <result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/>
  448. <result column="coupon_free_id" jdbcType="INTEGER" property="couponFreeId"/>
  449. </resultMap>
  450. <select id="findCarListOfCUser" parameterType="com.iformall.domain.vo.WxCouponOrderCarCVo" resultMap="CCarVoResultMap">
  451. select <include refid="allCUserCouponOrderCarListColumns" />
  452. from wx_coupon_order c,wx_coupon co,wx_merchant m, wx_coupon_car car
  453. where 1=1
  454. and c.coupon_id = co.id
  455. and c.coupon_id = car.id
  456. and co.merchant_id = m.id
  457. <if test="cUserId != null">
  458. and c.c_user_id = #{cUserId}
  459. </if>
  460. <if test="tenantId != null">
  461. and c.tenant_id = #{tenantId}
  462. </if>
  463. <if test="type != null">
  464. and co.type = #{type}
  465. </if>
  466. <if test="id != null">
  467. and c.id = #{id}
  468. </if>
  469. <if test="couponOrderStatus != null">
  470. AND c.coupon_order_status = #{couponOrderStatus}
  471. </if>
  472. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  473. </select>
  474. <select id="queryForSceneRepotyHistoryVerified" resultType="com.iformall.domain.vo.MarkingSceneDataVo" parameterType="hashmap">
  475. select DATE_FORMAT(update_date,'%Y-%m-%d') xTime, count(c.id) triggerCount
  476. from wx_coupon_order c
  477. where c.tenant_id = #{tenantId}
  478. and c.coupon_order_status = 1
  479. <if test=" null != startTime and null != endTime">
  480. and c.update_date BETWEEN #{startTime} and #{endTime}
  481. </if>
  482. group by xTime
  483. </select>
  484. <select id="findVerifiedCountForCUser" resultType="java.lang.Integer">
  485. select COUNT(*) FROM wx_coupon_order
  486. where c_user_id = #{cUserId}
  487. and update_date &gt;= #{startTime}
  488. and update_date &lt;= #{endTime}
  489. and coupon_order_status = 1
  490. </select>
  491. <select id="findOrderedCountForCUser" resultType="java.lang.Integer">
  492. select COUNT(*) FROM wx_coupon_order
  493. where c_user_id = #{cUserId}
  494. and create_date &gt;= #{startTime}
  495. and create_date &lt;= #{endTime}
  496. </select>
  497. <select id="findVerifiedCount" resultType="java.lang.Integer">
  498. select COUNT(*) FROM wx_coupon_order
  499. where tenant_id = #{tenantId}
  500. and update_date &gt;= #{startTime}
  501. and update_date &lt;= #{endTime}
  502. and coupon_order_status = 1
  503. </select>
  504. <select id="findOrderedCount" resultType="java.lang.Integer">
  505. select COUNT(*) FROM wx_coupon_order
  506. where tenant_id = #{tenantId}
  507. and create_date &gt;= #{startTime}
  508. and create_date &lt;= #{endTime}
  509. </select>
  510. </mapper>