|
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.iformall.mapper.WxCouponOrderMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCouponOrder">
- <id column="id" jdbcType="BIGINT" property="id" />
- <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
- <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
- <result column="coupon_id" jdbcType="BIGINT" property="couponId" />
- <result column="coupon_type" jdbcType="INTEGER" property="couponType" />
- <result column="c_user_id" jdbcType="BIGINT" property="cUserId" />
- <result column="owner_id" jdbcType="BIGINT" property="ownerId" />
- <result column="b_user_id" jdbcType="BIGINT" property="bUserId" />
- <result column="b_merchant_id" jdbcType="BIGINT" property="bMerchantId" />
- <result column="b_tenant_id" jdbcType="VARCHAR" property="bTenantId" />
- <result column="a_user_id" jdbcType="BIGINT" property="aUserId" />
- <result column="order_id" jdbcType="BIGINT" property="orderId" />
- <result column="expired_time" jdbcType="TIMESTAMP" property="expiredTime" />
- <result column="coupon_order_status" jdbcType="INTEGER" property="couponOrderStatus" />
- <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
- <result column="create_date_times" jdbcType="BIGINT" property="createDateTimes" />
- <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
- <result column="coupon_price" jdbcType="INTEGER" property="couponPrice" />
- <result column="auto_refund" jdbcType="INTEGER" property="autoRefund" />
- <result column="verify_type" jdbcType="INTEGER" property="verifyType" />
- <result column="verify_remark" jdbcType="VARCHAR" property="verifyRemark" />
- <result column="pay_vendor" jdbcType="INTEGER" property="payVendor" />
- <result column="pay_version" jdbcType="INTEGER" property="payVersion" />
- <result column="send_merchant_id" jdbcType="INTEGER" property="sendMerchantId" />
- <result column="send_merchant_user_id" jdbcType="INTEGER" property="sendMerchantUserId" />
- <result column="compose_order_type" jdbcType="INTEGER" property="composeOrderType" />
- <result column="compose_order_id" jdbcType="BIGINT" property="composeOrderId" />
- <result column="parent_coupon_order_id" jdbcType="BIGINT" property="parentCouponOrderId" />
- <result column="coupon_number" jdbcType="BIGINT" property="couponNumber" />
- <result column="subsidy" jdbcType="INTEGER" property="subsidy" />
- <result column="ext_param" jdbcType="VARCHAR" property="extParam" />
- <result column="freight_price" jdbcType="INTEGER" property="freightPrice"/>
- <result column="shipping_type" jdbcType="INTEGER" property="shippingType"/>
- <result column="shipping_address" jdbcType="VARCHAR" property="shippingAddress"/>
- <result column="shipping_status" jdbcType="INTEGER" property="shippingStatus"/>
- <result column="delivery_info" jdbcType="VARCHAR" property="deliveryInfo"/>
- </resultMap>
-
- <sql id="allColumns">
- `id`,`tenant_id`,`parent_tenant_id`,`coupon_id`,`coupon_type`,`c_user_id`,`owner_id`,`b_user_id`,`b_merchant_id`,`b_tenant_id`,`order_id`,`expired_time`,`coupon_order_status`,`create_date`,`update_date`,`coupon_price`, `auto_refund`,
- `verify_type`,`verify_remark`,`pay_vendor`,`pay_version`,`send_merchant_id`,`send_merchant_user_id`,`compose_order_type`,`compose_order_id`,`parent_coupon_order_id`,`coupon_number`,
- `freight_price`,`shipping_type`,`shipping_address`,`shipping_status`,`delivery_info`,`subsidy`,`ext_param`
- </sql>
-
- <sql id="dynamicWhereConditions">
- where `tenant_id` = #{tenantId}
- <if test=" null != id ">
- and `id` = #{id}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
-
- <if test=" null != couponId ">
- and `coupon_id` = #{couponId}
- </if>
-
- <if test=" null != couponType ">
- and `coupon_type` = #{couponType}
- </if>
-
- <if test=" null != cUserId ">
- and `c_user_id` = #{cUserId}
- </if>
-
- <if test=" null != ownerId ">
- and `owner_id` = #{ownerId}
- </if>
-
- <if test=" null != bUserId ">
- and `b_user_id` = #{bUserId}
- </if>
-
- <if test=" null != bMerchantId ">
- and `b_merchant_id` = #{bMerchantId}
- </if>
-
- <if test=" null != bTenantId ">
- and `b_tenant_id` = #{bTenantId}
- </if>
-
- <if test=" null != aUserId ">
- and `a_user_id` = #{aUserId}
- </if>
-
- <if test=" null != orderId ">
- and `order_id` = #{orderId}
- </if>
-
- <if test=" null != expiredTime ">
- and `expired_time` = #{expiredTime}
- </if>
-
- <if test=" null != couponOrderStatus ">
- and `coupon_order_status` = #{couponOrderStatus}
- </if>
-
- <if test=" null != createDate ">
- and `create_date` = #{createDate}
- </if>
-
- <if test=" null != updateDate ">
- and `update_date` = #{updateDate}
- </if>
-
- <if test=" null != couponPrice ">
- and `coupon_price` = #{couponPrice}
- </if>
-
- <if test=" null != autoRefund ">
- and `auto_refund` = #{autoRefund}
- </if>
-
- <if test=" null != payVendor ">
- and `pay_vendor` = #{payVendor}
- </if>
-
- <if test=" null != payVersion ">
- and `pay_version` = #{payVersion}
- </if>
-
- <if test=" null != sendMerchantId ">
- and `send_merchant_id` = #{sendMerchantId}
- </if>
-
- <if test=" null != sendMerchantUserId ">
- and `send_merchant_user_id` = #{sendMerchantUserId}
- </if>
-
- <if test=" null != composeOrderType ">
- and `compose_order_type` = #{composeOrderType}
- </if>
-
- <if test=" null != composeOrderId ">
- and `compose_order_id` = #{composeOrderId}
- </if>
-
- <if test=" null != parentCouponOrderId ">
- and `parent_coupon_order_id` = #{parentCouponOrderId}
- </if>
-
- <if test=" null != shippingType ">
- and `shipping_type` = #{shippingType}
- </if>
-
- <if test=" null != shippingStatus ">
- and `shipping_status` = #{shippingStatus}
- </if>
-
- <if test=" null != ids ">
- and id in
- <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
- #{idItem}
- </foreach>
- </if>
- <if test=" null != sortColumns"> order by ${sortColumns} </if>
- </sql>
-
- <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- select <include refid="allColumns" /> from wx_coupon_order where id = #{id} and tenant_id=#{tenantId}
- </select>
-
- <select id="findList" parameterType="com.iformall.domain.po.WxCouponOrder" resultMap="BaseResultMap">
- select <include refid="allColumns" /> from wx_coupon_order
- <include refid="dynamicWhereConditions" />
- </select>
-
- <select id="findListOfVerifiedByDateForBUser" parameterType="map" resultMap="BaseResultMap">
- select co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.b_merchant_id,co.b_tenant_id,co.order_id,co.expired_time,
- co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type,co.verify_remark,co.pay_vendor,co.pay_version,
- co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,co.ext_param
- from wx_coupon_order co
- where co.tenant_id = #{tenantId}
- AND co.coupon_order_status = '1'
- <if test=" null != bMerchantId ">
- and co.b_merchant_id = #{bMerchantId}
- </if>
- <if test="startDate != null">
- AND co.update_date > #{startDate,jdbcType=TIMESTAMP}
- </if>
- <if test="endDate != null">
- AND co.update_date < #{endDate,jdbcType=TIMESTAMP}
- </if>
- order by co.update_date desc
- </select>
-
- <select id="findListOfOrderedByDateForBUser" parameterType="map" resultMap="BaseResultMap">
- select co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.b_merchant_id,co.b_tenant_id,co.order_id,co.expired_time,
- co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type,co.verify_remark,co.pay_vendor,co.pay_version,
- co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,co.ext_param
- from wx_coupon_order co
- where co.tenant_id = #{tenantId}
- <if test="startDateTimes != null">
- AND co.create_date_times > #{startDateTimes}
- </if>
- <if test="endDateTimes != null">
- AND co.create_date_times < #{endDateTimes}
- </if>
- <if test=" null != couponIds ">
- and co.coupon_id in
- <foreach collection="couponIds" index="index" item="couponIdItem" open="(" separator="," close=")">
- #{couponIdItem}
- </foreach>
- </if>
- order by co.create_date_times desc
- </select>
-
- <update id="updateVerifyCouponOrder" parameterType="com.iformall.domain.po.WxCouponOrder">
- update wx_coupon_order
- set `coupon_order_status` = #{couponOrderStatus},
- `b_user_id` = #{bUserId},
- <if test=" null != bMerchantId">
- `b_merchant_id` = #{bMerchantId},
- </if>
- `update_date` = #{updateDate},
- `verify_type` = #{verifyType}
- <if test=" null != verifyRemark">
- ,`verify_remark` = #{verifyRemark}
- </if>
- <if test=" null != shippingStatus">
- ,`shipping_status` = #{shippingStatus}
- </if>
- <if test=" null != bTenantId">
- ,`b_tenant_id` = #{bTenantId}
- </if>
- where id=#{id} and `b_user_id` is null
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- </update>
-
- <update id="updateVerifyCouponOrderStatus" parameterType="com.iformall.domain.po.WxCouponOrder">
- update wx_coupon_order
- set `coupon_order_status` = #{couponOrderStatus},
- `b_user_id` = #{bUserId},
- <if test=" null != bMerchantId">
- `b_merchant_id` = #{bMerchantId},
- </if>
- `update_date` = #{updateDate},
- `verify_type` = #{verifyType}
- <if test=" null != verifyRemark">
- ,`verify_remark` = #{verifyRemark}
- </if>
- <if test=" null != shippingStatus">
- ,`shipping_status` = #{shippingStatus}
- </if>
- <if test=" null != bTenantId">
- ,`b_tenant_id` = #{bTenantId}
- </if>
- where id=#{id}
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- <if test=" null == #{bUserId} ">
- and `b_user_id` is null
- </if>
- <if test=" null != #{bUserId} ">
- and `b_user_id` = #{bUserId}
- </if>
- </update>
-
- <update id="updateVerifyCouponOrderStatusForMicroPay" parameterType="com.iformall.domain.po.WxCouponOrder">
- update wx_coupon_order
- set `coupon_order_status` = #{couponOrderStatus},
- `b_user_id` = #{bUserId},
- <if test=" null != bMerchantId">
- `b_merchant_id` = #{bMerchantId},
- </if>
- `update_date` = #{updateDate},
- `verify_type` = #{verifyType}
- <if test=" null != verifyRemark">
- ,`verify_remark` = #{verifyRemark}
- </if>
- <if test=" null != shippingStatus">
- ,`shipping_status` = #{shippingStatus}
- </if>
- <if test=" null != bTenantId">
- ,`b_tenant_id` = #{bTenantId}
- </if>
- where 1=1
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- and id=#{id}
- </update>
-
- <update id="cancelVerifyCouponOrder" parameterType="com.iformall.domain.po.WxCouponOrder">
- update wx_coupon_order
- set `coupon_order_status` = #{couponOrderStatus},
- `b_user_id` = null,
- `b_merchant_id` = null,
- `update_date` = #{updateDate},
- `verify_type` = null,
- `b_tenant_id` = null
- where id=#{id}
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- </update>
-
- <update id="updateVerifyCouponOrderSubsidy" parameterType="com.iformall.domain.po.WxCouponOrder">
- update wx_coupon_order
- set `subsidy` = #{subsidy}
- where id=#{id}
- </update>
-
-
- <select id = "findCreateDateCouponOrderCount" resultType="hashmap" parameterType="hashmap">
- select DATE_FORMAT(create_date,'%m/%d') as createTime ,count(1) as count from wx_coupon_order co
- where `tenant_id` = #{tenantId}
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- <if test="startCreateDateTimes != null">
- AND co.create_date_times >= #{startCreateDateTimes}
- </if>
- <if test="endCreateDateTimes != null">
- AND co.create_date_times <= #{endCreateDateTimes}
- </if>
- <if test="couponOrderStatus != null">
- and co.coupon_order_status = #{couponOrderStatus}
- </if>
- <if test="updateStartTime != null">
- AND co.update_date >= #{updateStartTime}
- </if>
- <if test="updateEndTime != null">
- AND co.update_date <= #{updateEndTime}
- </if>
- group by DATE_FORMAT(create_date,'%m/%d')
- </select>
-
- <select id = "findCreateDateCouponOrderUserCount" resultType="hashmap" parameterType="hashmap">
- select DATE_FORMAT(create_date,'%m/%d') as createTime ,count(DISTINCT c_user_id) as count from wx_coupon_order co
- where `tenant_id` = #{tenantId}
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- <if test="startCreateDateTimes != null">
- AND co.create_date_times >= #{startCreateDateTimes}
- </if>
- <if test="endCreateDateTimes != null">
- AND co.create_date_times <= #{endCreateDateTimes}
- </if>
- <if test="couponOrderStatus != null">
- and co.coupon_order_status = #{couponOrderStatus}
- </if>
- <if test="updateStartTime != null">
- AND co.update_date >= #{updateStartTime}
- </if>
- <if test="updateEndTime != null">
- AND co.update_date <= #{updateEndTime}
- </if>
- group by DATE_FORMAT(create_date,'%m/%d')
- </select>
-
- <select id="couponDataList" resultType="com.iformall.domain.vo.MarkingCouponDataReportVo" parameterType="hashmap">
- SELECT createTime,couponId,sum(couponCount) couponCount,sum(couponUserCount) couponUserCount,sum(verifyCount) verifyCount,sum(verifyUserCount) verifyUserCount
- from view_coupon_data${tenantEntity.shardTableSuffix} WHERE `tenant_id` = #{tenantEntity.tenantId}
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- <if test="startTime != null">
- and createTime >= DATE_FORMAT(#{startTime},'%Y-%m-%d')
- </if>
- <if test="endTime != null">
- and view_coupon_data.createTime <= DATE_FORMAT(#{endTime},'%Y-%m-%d')
- </if>
- <if test="couponType != null">
- and couponType = #{couponType}
- </if>
- <if test="couponTitle != null">
- and couponTitle like concat('%', #{couponTitle},'%')
- </if>
- GROUP BY createTime,couponId
- order by createTime desc
-
- </select>
-
- <select id="touchUsersReportList" resultType="com.iformall.domain.vo.TouchUsersReportVo" parameterType="com.iformall.domain.dto.MarkingCouponDataReportDto">
- SELECT xTime, sum(pv) pv, sum(uv) uv, sum(couponCount) couponCount, sum(userCount) userCount, sum(verifyCount) verifyCount, sum(verifyUserCount) verifyUserCount
- from view_touch_user${tenantEntity.shardTableSuffix} WHERE `tenant_id` = #{tenantEntity.tenantId}
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- <if test="startTime != null">
- and xTime >= DATE_FORMAT(#{startTime},'%Y-%m-%d')
- </if>
- <if test="endTime != null">
- and xTime <= DATE_FORMAT(#{endTime},'%Y-%m-%d')
- </if>
- GROUP BY xTime
- order by xTime desc
- </select>
-
-
- <select id="queryForSceneRepotyHistoryVerified" resultType="com.iformall.domain.vo.MarkingSceneDataVo" parameterType="hashmap">
- select DATE_FORMAT(update_date,'%Y-%m-%d') xTime, count(c.id) triggerCount
- from wx_coupon_order c
- where c.coupon_order_status = 1
- <if test=" null != tenantId and '' != tenantId">
- and c.`tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and c.`parent_tenant_id` = #{parentTenantId}
- </if>
- <if test=" null != startTime and null != endTime">
- and c.update_date BETWEEN #{startTime} and #{endTime}
- </if>
- group by xTime
- </select>
-
- <select id="queryForSceneRepotyHistoryOrdered" resultType="com.iformall.domain.vo.MarkingSceneDataVo" parameterType="hashmap">
- select DATE_FORMAT(update_date,'%Y-%m-%d') xTime, count(c.id) triggerCount
- from wx_coupon_order c where c.`tenant_id` = #{tenantId}
- <if test=" null != parentTenantId and '' != parentTenantId">
- and c.`parent_tenant_id` = #{parentTenantId}
- </if>
- <if test=" null != startTime and null != endTime">
- and c.create_date BETWEEN #{startTime} and #{endTime}
- </if>
- group by xTime
- </select>
-
- <!-- <select id="queryForSceneRepotyMechantHistoryOrdered" resultType="com.iformall.domain.vo.MarkingSceneDataVo" parameterType="hashmap">
- select DATE_FORMAT(update_date,'%Y-%m-%d') xTime, count(c.id) triggerCount
- from (
- SELECT * from wx_coupon_order
- ) c left join (
- SELECT * from wx_coupon_action_log
- ) cal on cal.tenant_id = c.tenant_id
- where cal.coupon_order_id=c.id
- <if test=" null != tenantId and '' != tenantId">
- and c.`tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and c.`parent_tenant_id` = #{parentTenantId}
- </if>
- <if test=" null != channelType and null != channelType">
- and cal.channel_type=#{channelType}
- </if>
- <if test=" null != startTime and null != endTime">
- and c.create_date BETWEEN #{startTime} and #{endTime}
- </if>
- group by xTime
- </select> -->
-
- <select id="queryPriceTotal" parameterType="com.iformall.domain.po.WxCouponOrder" resultType="java.lang.Integer" >
- SELECT IFNULL(SUM(coupon_price),0) from wx_coupon_order
- where `tenant_id` = #{tenantId}
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- <if test=" null != couponOrderStatus">
- and coupon_order_status = #{couponOrderStatus}
- </if>
- <if test=" null != cUserId">
- and c_user_id = #{cUserId}
- </if>
- <if test=" null != couponId ">
- and coupon_id = #{couponId}
- </if>
- <if test=" null != couponType ">
- and coupon_type = #{couponType}
- </if>
- <if test=" null != startTime">
- and create_date_times >= unix_timestamp(#{startTime})*1000
- </if>
- <if test=" null != endTime">
- and create_date_times <= unix_timestamp(#{endTime})*1000
- </if>
- </select>
-
- <select id="findCount" parameterType="com.iformall.domain.po.WxCouponOrder" resultType="java.lang.Integer">
- select COUNT(co.id) FROM wx_coupon_order co
- where co.`tenant_id` = #{tenantId}
- <if test=" null != parentTenantId and '' != parentTenantId">
- and co.`parent_tenant_id` = #{parentTenantId}
- </if>
- <if test=" null != couponOrderStatus">
- and co.coupon_order_status = #{couponOrderStatus}
- </if>
- <if test=" null != cUserId">
- and co.c_user_id = #{cUserId}
- </if>
- <if test=" null != couponId ">
- and co.coupon_id = #{couponId}
- </if>
- <if test=" null != couponType ">
- and co.coupon_type = #{couponType}
- </if>
-
- <if test=" null != sendMerchantId ">
- and co.send_merchant_id = #{sendMerchantId}
- </if>
-
- <if test=" 1 == couponOrderStatus">
- <if test=" null != startTime">
- and co.update_date >= #{startTime}
- </if>
- <if test=" null != endTime">
- and co.update_date <= #{endTime}
- </if>
- <if test=" 0 == timeSlot">
- and date_format(co.update_date,'%H:%m') >= '06:00'
- and date_format(co.update_date,'%H:%m') < '18:00'
- and date_format(co.update_date,'%w') in (1,2,3,4,5)
- </if>
- <if test=" 1 == timeSlot">
- and ((date_format(co.update_date,'%H:%m') >= '18:00'
- and date_format(co.update_date,'%w') in (1,2,3,4))
- or
- ((date_format(co.update_date,'%H:%m') < '06:00')
- and date_format(co.update_date,'%w') in (1,2,3,4,5)))
- </if>
- <if test=" 2 == timeSlot">
- and date_format(co.update_date,'%H:%m') >= '06:00'
- and date_format(co.update_date,'%H:%m') < '18:00'
- and date_format(co.update_date,'%w') in (0,6)
- </if>
- <if test=" 3 == timeSlot">
- and ((date_format(co.update_date,'%H:%m') >= '18:00'
- and date_format(co.update_date,'%w') in (5,6,0))
- or
- ((date_format(co.update_date,'%H:%m') < '06:00')
- and date_format(co.update_date,'%w') in (6,0)))
- </if>
- </if>
-
- <if test=" 1 != couponOrderStatus">
- <if test=" null != startTime">
- and co.create_date >= #{startTime}
- </if>
- <if test=" null != endTime">
- and co.create_date <= #{endTime}
- </if>
- <if test=" 0 == timeSlot">
- and date_format(co.create_date,'%H:%m') >= '06:00'
- and date_format(co.create_date,'%H:%m') < '18:00'
- and date_format(co.create_date,'%w') in (1,2,3,4,5)
- </if>
- <if test=" 1 == timeSlot">
- and ((date_format(co.create_date,'%H:%m') >= '18:00'
- and date_format(co.create_date,'%w') in (1,2,3,4))
- or
- ((date_format(co.create_date,'%H:%m') < '06:00')
- and date_format(co.create_date,'%w') in (1,2,3,4,5)))
- </if>
- <if test=" 2 == timeSlot">
- and date_format(co.create_date,'%H:%m') >= '06:00'
- and date_format(co.create_date,'%H:%m') < '18:00'
- and date_format(co.create_date,'%w') in (0,6)
- </if>
- <if test=" 3 == timeSlot">
- and ((date_format(co.create_date,'%H:%m') >= '18:00'
- and date_format(co.create_date,'%w') in (5,6,0))
- or
- ((date_format(co.create_date,'%H:%m') < '06:00')
- and date_format(co.create_date,'%w') in (6,0)))
- </if>
- </if>
- </select>
-
- <select id="findProductCount" parameterType="com.iformall.domain.po.WxCouponOrder" resultType="java.lang.Integer">
- select COALESCE(sum(coupon_number),0) FROM wx_coupon_order co
- where co.`tenant_id` = #{tenantId}
- <if test=" null != parentTenantId and '' != parentTenantId">
- and co.`parent_tenant_id` = #{parentTenantId}
- </if>
- <if test=" null != couponOrderStatus">
- and co.coupon_order_status = #{couponOrderStatus}
- </if>
- <if test=" null != cUserId">
- and co.c_user_id = #{cUserId}
- </if>
- <if test=" null != couponId ">
- and co.coupon_id = #{couponId}
- </if>
- <if test=" null != couponType ">
- and co.coupon_type = #{couponType}
- </if>
- <if test=" null != couponIds">
- and co.coupon_id in
- <foreach collection="couponIds" index="index" item="couponIdItem" open="(" separator="," close=")">
- #{couponIdItem}
- </foreach>
- </if>
- </select>
-
- <select id="getCouponCount" parameterType="com.iformall.domain.po.WxCouponOrder" resultType="hashmap">
- select co.coupon_id as couponId, count(1) as count FROM wx_coupon_order co
- where co.`tenant_id` = #{tenantId}
- <if test=" null != parentTenantId and '' != parentTenantId">
- and co.`parent_tenant_id` = #{parentTenantId}
- </if>
- <if test=" null != couponOrderStatus">
- and co.coupon_order_status = #{couponOrderStatus}
- </if>
- <if test=" null != cUserId">
- and co.c_user_id = #{cUserId}
- </if>
- <if test=" null != couponId ">
- and co.coupon_id = #{couponId}
- </if>
- <if test=" null != couponType ">
- and co.coupon_type = #{couponType}
- </if>
- <if test=" null != couponIds">
- and co.coupon_id in
- <foreach collection="couponIds" index="index" item="couponIdItem" open="(" separator="," close=")">
- #{couponIdItem}
- </foreach>
- </if>
- <if test=" 1 == couponOrderStatus">
- <if test=" null != startTime">
- and co.update_date >= #{startTime}
- </if>
- <if test=" null != endTime">
- and co.update_date <= #{endTime}
- </if>
- <if test=" 0 == timeSlot">
- and date_format(co.update_date,'%H:%m') >= '06:00'
- and date_format(co.update_date,'%H:%m') < '18:00'
- and date_format(co.update_date,'%w') in (1,2,3,4,5)
- </if>
- <if test=" 1 == timeSlot">
- and ((date_format(co.update_date,'%H:%m') >= '18:00'
- and date_format(co.update_date,'%w') in (1,2,3,4))
- or
- ((date_format(co.update_date,'%H:%m') < '06:00')
- and date_format(co.update_date,'%w') in (1,2,3,4,5)))
- </if>
- <if test=" 2 == timeSlot">
- and date_format(co.update_date,'%H:%m') >= '06:00'
- and date_format(co.update_date,'%H:%m') < '18:00'
- and date_format(co.update_date,'%w') in (0,6)
- </if>
- <if test=" 3 == timeSlot">
- and ((date_format(co.update_date,'%H:%m') >= '18:00'
- and date_format(co.update_date,'%w') in (5,6,0))
- or
- ((date_format(co.update_date,'%H:%m') < '06:00')
- and date_format(co.update_date,'%w') in (6,0)))
- </if>
- </if>
-
- <if test=" 1 != couponOrderStatus">
- <if test=" null != startTime">
- and co.create_date >= #{startTime}
- </if>
- <if test=" null != endTime">
- and co.create_date <= #{endTime}
- </if>
- <if test=" 0 == timeSlot">
- and date_format(co.create_date,'%H:%m') >= '06:00'
- and date_format(co.create_date,'%H:%m') < '18:00'
- and date_format(co.create_date,'%w') in (1,2,3,4,5)
- </if>
- <if test=" 1 == timeSlot">
- and ((date_format(co.create_date,'%H:%m') >= '18:00'
- and date_format(co.create_date,'%w') in (1,2,3,4))
- or
- ((date_format(co.create_date,'%H:%m') < '06:00')
- and date_format(co.create_date,'%w') in (1,2,3,4,5)))
- </if>
- <if test=" 2 == timeSlot">
- and date_format(co.create_date,'%H:%m') >= '06:00'
- and date_format(co.create_date,'%H:%m') < '18:00'
- and date_format(co.create_date,'%w') in (0,6)
- </if>
- <if test=" 3 == timeSlot">
- and ((date_format(co.create_date,'%H:%m') >= '18:00'
- and date_format(co.create_date,'%w') in (5,6,0))
- or
- ((date_format(co.create_date,'%H:%m') < '06:00')
- and date_format(co.create_date,'%w') in (6,0)))
- </if>
- </if>
- group by co.coupon_id
- </select>
-
- <select id="queryPriceTotalGroup" resultType="com.iformall.domain.vo.CUserDateAmountVo" >
- SELECT DATE_FORMAT(create_date,'%Y-%m-%d') as xTime,IFNULL(SUM(coupon_price),0) as price
- from wx_coupon_order
- where create_date_times >= unix_timestamp(#{startTime})*1000 and create_date_times < unix_timestamp(#{endTime})*1000
- and `tenant_id` = #{tenantId}
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- GROUP BY xTime
- </select>
-
- <select id="findExpiredFreeCouponOrderByValidDate" parameterType="String" resultMap="BaseResultMap">
- select <include refid="allColumns" /> from wx_coupon_order
- where tenant_id = #{tenantId} and expired_time >= date_sub(curdate(),interval 360 day) and expired_time < now() and coupon_price = 0 and coupon_order_status in (0, 4)
- </select>
-
- <select id="findExpiredCouponOrderByValidDate" parameterType="String" resultMap="BaseResultMap">
- select <include refid="allColumns" /> from wx_coupon_order
- where tenant_id = #{tenantId} and expired_time >= date_sub(curdate(),interval 360 day) and expired_time < now() and coupon_price > 0 and coupon_order_status in (0, 4)
- </select>
-
- <select id="findExpiredCouponOrderGoodsVerify" parameterType="String" resultMap="BaseResultMap">
- select <include refid="allColumns" /> from wx_coupon_order
- where tenant_id = #{tenantId} and coupon_type = 11
- and update_date < DATE_SUB(curdate(),interval 14 day)
- and shipping_type = 2 and shipping_status = 24 and coupon_order_status = 0
- </select>
-
- <select id="findListOfAdmin" parameterType="com.iformall.domain.vo.WxCouponOrderBVo" resultMap="BaseResultMap">
- select co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.b_merchant_id,co.b_tenant_id,co.expired_time,co.coupon_order_status,co.order_id,
- co.create_date,co.update_date,co.coupon_price, co.verify_type, co.verify_remark,co.pay_vendor,co.pay_version,
- co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,co.send_merchant_id,co.subsidy,co.ext_param
- FROM wx_coupon_order co where co.`tenant_id` = #{tenantId}
- <if test=" null != id ">
- and co.id = #{id}
- </if>
- <if test=" null != orderId ">
- and co.order_id = #{orderId}
- </if>
- <if test=" null != cUserId and '' != cUserId">
- and co.c_user_id = #{cUserId}
- </if>
- <choose>
- <when test=" null != couponType">
- and co.coupon_type = #{couponType}
- </when>
- <otherwise>
- <!-- and co.coupon_type != 5 -->
- and co.coupon_type != 11
- <!-- and co.coupon_type != 12 -->
- <!-- and co.coupon_type != 51 -->
- and co.coupon_type < 100
- </otherwise>
- </choose>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and co.`parent_tenant_id` = #{parentTenantId}
- </if>
- <if test=" null != couponOrderStatus ">
- and co.coupon_order_status = #{couponOrderStatus}
- </if>
-
- <if test=" null != shippingType ">
- and co.`shipping_type` = #{shippingType}
- </if>
-
- <if test=" null != shippingStatus ">
- and co.`shipping_status` = #{shippingStatus}
- </if>
-
- <if test="startDate != null">
- AND co.create_date > #{startDate,jdbcType=TIMESTAMP}
- </if>
-
- <if test="startDateTimes != null">
- AND co.create_date_times > #{startDateTimes}
- </if>
-
- <if test="endDate != null">
- AND co.create_date < #{endDate,jdbcType=TIMESTAMP}
- </if>
-
- <if test="endDateTimes != null">
- AND co.create_date_times < #{endDateTimes}
- </if>
-
- <if test="verifyStartDate != null">
- AND co.update_date > #{verifyStartDate,jdbcType=TIMESTAMP}
- </if>
-
- <if test="verifyEndDate != null">
- AND co.update_date < #{verifyEndDate,jdbcType=TIMESTAMP}
- </if>
-
- <if test="bTenantId != null">
- AND co.b_tenant_id = #{bTenantId}
- </if>
-
- <if test=" null != couponIds">
- and co.coupon_id in
- <foreach collection="couponIds" index="index" item="couponIdItem" open="(" separator="," close=")">
- #{couponIdItem}
- </foreach>
- </if>
-
- <if test=" null != bMerchantIdList">
- and co.b_merchant_id in
- <foreach collection="bMerchantIdList" index="index" item="bMerchantIdItem" open="(" separator="," close=")">
- #{bMerchantIdItem}
- </foreach>
- </if>
-
- <if test=" null != sortColumns">order by ${sortColumns} </if>
- <if test=" null == sortColumns">order by co.update_date desc</if>
-
- </select>
-
- <select id="findDetailOfAdmin" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- select co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.b_merchant_id,co.b_tenant_id,
- co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type,co.verify_remark, co.pay_vendor,co.pay_version,
- co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,co.subsidy,co.ext_param
- FROM wx_coupon_order co
- where co.id = #{id} and co.tenant_id = #{tenantId}
- </select>
-
-
- <select id="findGoodsList" parameterType="com.iformall.domain.vo.WxCouponOrderBVo" resultMap="BaseResultMap">
- select
- co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.b_merchant_id,co.b_tenant_id,
- co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type,co.verify_remark, co.pay_vendor,co.pay_version,
- co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,co.ext_param
- FROM wx_coupon_order co
- where co.`tenant_id` = #{tenantId}
- <choose>
- <when test=" null != couponType">
- and co.coupon_type = #{couponType}
- </when>
- <otherwise>
- <!-- and co.coupon_type != 5 -->
- and co.coupon_type != 11
- <!-- and co.coupon_type != 12 -->
- <!-- and co.coupon_type != 51 -->
- and co.coupon_type < 100
- </otherwise>
- </choose>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and co.`parent_tenant_id` = #{parentTenantId}
- </if>
-
- <if test=" null != couponOrderStatus ">
- and co.coupon_order_status = #{couponOrderStatus}
- </if>
- <if test=" null != shippingStatuss ">
- and co.`shipping_status` in
- <foreach collection="shippingStatuss" index="index" item="idItem" open="(" separator="," close=")">
- #{idItem}
- </foreach>
- </if>
-
- <if test="startDate != null">
- AND co.create_date_times > unix_timestamp(#{startDate})*1000
- </if>
-
- <if test="endDate != null">
- AND co.create_date_times < unix_timestamp(#{endDate})*1000
- </if>
-
- <if test="verifyStartDate != null">
- AND co.update_date > #{verifyStartDate,jdbcType=TIMESTAMP}
- </if>
-
- <if test="verifyEndDate != null">
- AND co.update_date < #{verifyEndDate,jdbcType=TIMESTAMP}
- </if>
-
- <if test=" null != id ">
- and co.id = #{id}
- </if>
- <if test=" null != orderId ">
- and co.order_id = #{orderId}
- </if>
-
- <if test=" null != couponIds">
- and co.coupon_id in
- <foreach collection="couponIds" index="index" item="couponIdItem" open="(" separator="," close=")">
- #{couponIdItem}
- </foreach>
- </if>
-
- order by co.update_date desc
- </select>
-
- <select id="findListOfOrderedByDate" parameterType="map" resultMap="BaseResultMap">
- select co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.b_merchant_id,co.b_tenant_id,
- co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type,co.verify_remark,co.pay_vendor,co.pay_version,
- co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,co.ext_param
- from wx_coupon_order co
- where co.tenant_id = #{tenantId}
- <if test="startDateTimes != null">
- AND co.create_date_times > #{startDateTimes}
- </if>
- <if test="endDateTimes != null">
- AND co.create_date_times < #{endDateTimes}
- </if>
- <if test=" null != couponIds">
- and co.coupon_id in
- <foreach collection="couponIds" index="index" item="couponIdItem" open="(" separator="," close=")">
- #{couponIdItem}
- </foreach>
- </if>
-
- </select>
-
- <select id="findListOfVerifiedByDate" parameterType="map" resultMap="BaseResultMap">
- select co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.b_merchant_id,co.b_tenant_id,
- co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type,co.verify_remark,co.pay_vendor,co.pay_version,
- co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,co.ext_param
- from wx_coupon_order co
- where co.coupon_order_status = '1'
- and co.tenant_id = #{tenantId}
- <if test=" null != bMerchantId">
- AND co.b_merchant_id = #{bMerchantId}
- </if>
- <if test="startDate != null">
- AND co.update_date > #{startDate,jdbcType=TIMESTAMP}
- </if>
- <if test="endDate != null">
- AND co.update_date < #{endDate,jdbcType=TIMESTAMP}
- </if>
- </select>
-
- <select id="findListOfCUserOptimize" parameterType="com.iformall.domain.vo.WxCouponOrderCVo" resultMap="BaseResultMap">
- select
- co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type,co.verify_remark,co.pay_vendor,
- co.pay_version,co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,co.ext_param
- from wx_coupon_order co
- where co.c_user_id = #{cUserId} and co.`tenant_id` = #{tenantId}
- <choose>
- <when test=" null != couponType">
- and co.coupon_type = #{couponType}
- </when>
- <otherwise>
- and co.coupon_type != 5
- and co.coupon_type != 11
- and co.coupon_type != 12
- and co.coupon_type != 51
- and co.coupon_type < 100
- </otherwise>
- </choose>
-
- <if test="ownerId != null">
- and co.owner_id = #{ownerId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and co.`parent_tenant_id` = #{parentTenantId}
- </if>
- <if test="couponOrderStatus != null and 0 == couponOrderStatus">
- AND (co.coupon_order_status = #{couponOrderStatus} OR co.coupon_order_status = 100 )
- </if>
- <if test="couponOrderStatus != null and 0 != couponOrderStatus">
- AND co.coupon_order_status = #{couponOrderStatus}
- </if>
- <if test=" null != couponIds">
- and co.coupon_id in
- <foreach collection="couponIds" index="index" item="couponIdItem" open="(" separator="," close=")">
- #{couponIdItem}
- </foreach>
- </if>
- <if test=" null != sortColumns"> order by ${sortColumns} </if>
- </select>
-
- <select id="findDetailOfCUser" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- select
- co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.b_merchant_id,co.b_tenant_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type,co.verify_remark,co.pay_vendor,
- co.pay_version,co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,co.ext_param
- from wx_coupon_order co
- where co.id = #{id} and co.tenant_id = #{tenantId}
- </select>
-
- <select id="findCouponOrderForPos" parameterType="java.util.Map" resultMap="BaseResultMap">
- select
- co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.b_merchant_id,co.b_tenant_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type,co.verify_remark,co.pay_vendor,
- co.pay_version,co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,co.ext_param
- from wx_coupon_order co
- where co.c_user_id = #{cUserId}
- and co.coupon_order_status = #{status}
- <if test=" null != tenantId and '' != tenantId">
- and co.`tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and co.`parent_tenant_id` = #{parentTenantId}
- </if>
- and co.expired_time > now()
- <if test=" null != couponIds">
- and co.coupon_id in
- <foreach collection="couponIds" index="index" item="couponIdItem" open="(" separator="," close=")">
- #{couponIdItem}
- </foreach>
- </if>
- <if test=" null != ids ">
- and id in
- <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
- #{idItem}
- </foreach>
- </if>
- </select>
-
- <select id="findCarListOfCUser" parameterType="com.iformall.domain.vo.WxCouponOrderCarCVo" resultMap="BaseResultMap">
- select
- co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type,co.verify_remark,co.pay_vendor,
- co.pay_version from wx_coupon_order co
- where co.c_user_id = #{cUserId}
- <if test="id != null">
- and co.id = #{id}
- </if>
- <if test=" null != tenantId and '' != tenantId">
- and co.`tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and co.`parent_tenant_id` = #{parentTenantId}
- </if>
- <if test="couponOrderStatus != null and 0 == couponOrderStatus ">
- AND ( co.coupon_order_status = #{couponOrderStatus} OR co.coupon_order_status = 100 )
- </if>
- <if test="couponOrderStatus != null and 0 != couponOrderStatus ">
- AND co.coupon_order_status = #{couponOrderStatus}
- </if>
- <if test=" null != couponIds">
- and co.coupon_id in
- <foreach collection="couponIds" index="index" item="couponIdItem" open="(" separator="," close=")">
- #{couponIdItem}
- </foreach>
- </if>
- <if test=" null != sortColumns"> order by ${sortColumns} </if>
- </select>
-
- <select id="findCardListOfCUser" parameterType="com.iformall.domain.vo.WxCardCVo" resultMap="BaseResultMap">
- select
- co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.expired_time,co.coupon_order_status,co.create_date,co.update_date
- from wx_coupon_order co
- where co.coupon_type = 100
- <if test=" null != tenantId and '' != tenantId">
- and co.`tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and co.`parent_tenant_id` = #{parentTenantId}
- </if>
-
- <if test="cUserId != null">
- and co.c_user_id = #{cUserId}
- </if>
- <if test="ownerId != null">
- and co.owner_id = #{ownerId}
- </if>
- <if test="couponOrderStatus != null">
- and co.coupon_order_status = #{couponOrderStatus}
- </if>
- <if test=" null != statusS ">
- and co.coupon_order_status in
- <foreach collection="statusS" index="index" item="sItem" open="(" separator="," close=")">
- #{sItem}
- </foreach>
- </if>
- <if test=" null != sortColumns"> order by ${sortColumns} </if>
- </select>
-
- <select id="findCardDetailOfCUser" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- select
- co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.b_merchant_id,co.b_tenant_id,co.order_id,co.expired_time,co.coupon_order_status,
- co.create_date,co.update_date,co.coupon_price
- from wx_coupon_order co where co.id = #{id} and co.tenant_id = #{tenantId}
- </select>
-
- <update id="cardDefer" parameterType="map">
- update wx_coupon_order set coupon_order_status = 4,update_date = now(), expired_time= #{expireTime} where coupon_id = #{couponId} and tenant_id = #{tenantId} and coupon_order_status in (4, 5)
- </update>
-
- <select id="cardDeferCouponOrderId" parameterType="java.util.HashMap" resultType="java.lang.Long">
- select id from wx_coupon_order where coupon_id = #{couponId} and tenant_id = #{tenantId} and coupon_order_status in (4, 5)
- </select>
-
-
- <select id="findWriteOffCount" parameterType="com.iformall.domain.po.WxCouponOrder" resultType="java.lang.Integer">
- select count(1)
- from wx_coupon_order co
- where co.`tenant_id` = #{tenantId}
- <if test=" null != parentTenantId and '' != parentTenantId">
- and co.`parent_tenant_id` = #{parentTenantId}
- </if>
- <if test=" null != couponType ">
- and co.`coupon_type` = #{couponType}
- </if>
- <if test=" null != couponOrderStatus ">
- and co.`coupon_order_status` = #{couponOrderStatus}
- </if>
- <if test=" null != sendMerchantId ">
- and co.`send_merchant_id` = #{sendMerchantId}
- </if>
- <if test=" null != startTime ">
- AND co.update_date >= #{startTime}
- </if>
- <if test=" null != endTime ">
- AND co.update_date <= #{endTime}
- </if>
- <if test=" null != bMerchantId">
- AND co.b_merchant_id = #{bMerchantId}
- </if>
- </select>
-
- <select id="findMerchantUserTradeList" parameterType="map" resultType="map">
- select count(co.b_merchant_id) AS consumeCountP,count(DISTINCT co.b_merchant_id) AS consumeCount,sum(co.coupon_price) AS tradeAmt, co.b_merchant_id as bMerchantId from
- wx_coupon_order co
- WHERE co.coupon_order_status = 1 and co.b_merchant_id is not null and co.b_merchant_id > 0
- <if test=" null != tenantId and '' != tenantId">
- and co.`tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and co.`parent_tenant_id` = #{parentTenantId}
- </if>
- <if test="starttime != null">
- and co.create_date >= #{starttime}
- </if>
- <if test="endtime != null">
- and co.create_date <= #{endtime}
- </if>
- <if test=" null != bMerchantId">
- AND co.b_merchant_id = #{bMerchantId}
- </if>
- <if test=" null != bMerchantIdList">
- and co.b_merchant_id in
- <foreach collection="bMerchantIdList" index="index" item="bMerchantIdItem" open="(" separator="," close=")">
- #{bMerchantIdItem}
- </foreach>
- </if>
- group by co.b_merchant_id
- </select>
-
- <select id="findUserTradeList" parameterType="com.iformall.domain.po.WxCouponOrder" resultMap="BaseResultMap">
- select co.create_date,co.coupon_id,co.c_user_id
- from wx_coupon_order co
- WHERE co.coupon_order_status=1
- <if test=" null != tenantId and '' != tenantId">
- and co.`tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and co.`parent_tenant_id` = #{parentTenantId}
- </if>
- <if test="startTime != null">
- and co.create_date >= #{startTime}
- </if>
- <if test="endTime != null">
- and co.create_date <= #{endTime}
- </if>
- <if test=" null != bUserIdList">
- and co.b_user_id in
- <foreach collection="bUserIdList" index="index" item="bUserIdItem" open="(" separator="," close=")">
- #{bUserIdItem}
- </foreach>
- </if>
- <if test=" null != sortColumns">order by ${sortColumns}</if>
- <if test=" null == sortColumns">order by co.create_date desc</if>
- </select>
-
- <select id="findVerifiedUserIds" parameterType="java.util.HashMap" resultType="java.lang.Long">
- select distinct c_user_id from wx_coupon_order
- where `tenant_id` = #{tenantId}
- and coupon_order_status = 1
- and update_date >= #{verifiedStartTime}
- and update_date <= #{verifiedEndTime}
- </select>
-
- </mapper>
|