| | |
| | | SELECT |
| | | c.id, |
| | | c.money, |
| | | c.expirationTime, |
| | | c.endTime as expirationTime, |
| | | c.insertTime, |
| | | c.companyId, |
| | | c.state, |
| | |
| | | </if> |
| | | </select> |
| | | <select id="getDiscountStatic" resultType="map"> |
| | | SELECT IFNULL(SUM(discountMoney),0) money,COUNT(id) number FROM t_order_taxi WHERE activityId=#{activityId} |
| | | SELECT IFNULL(SUM(discountMoney),0) money,COUNT(id) number FROM t_order_private_car WHERE activityId=#{activityId} |
| | | </select> |
| | | <select id="getDiscountStatic1" resultType="map"> |
| | | SELECT IFNULL(SUM(discountMoney),0) money,COUNT(id) number FROM t_order_logistics WHERE activityId=#{activityId} |
| | | </select> |
| | | <select id="getRegStatic" resultType="map"> |
| | | SELECT |
| | |
| | | left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) |
| | | left join t_user_activity c on (b.userActivityId = c.id) |
| | | </if> |
| | | where activityType = #{type} |
| | | where a.activityType = #{type} |
| | | <if test="null != name and '' != name"> |
| | | and c.`name` like CONCAT('%', #{name}, '%') |
| | | </if> |
| | |
| | | sum(aa.receiveMoney) as useMoney |
| | | from ( |
| | | select |
| | | DATE_FORMAT(a.insertTime, '%Y-%m-%d') as time, |
| | | DATE_FORMAT(a.endTime, '%Y-%m-%d') as time, |
| | | a.userId, |
| | | count(a.id) as receive, |
| | | sum(a.money) as receiveMoney |
| | |
| | | and c.`name` like CONCAT('%', #{name}, '%') |
| | | </if> |
| | | <if test="null != start and '' != start and null != end and '' != end"> |
| | | and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} |
| | | and DATE_FORMAT(a.endTime, '%Y-%m-%d') between #{start} and #{end} |
| | | </if> |
| | | <if test="null != companyId"> |
| | | and c.companyId = #{companyId} |
| | | </if> |
| | | GROUP BY DATE_FORMAT(insertTime, '%Y-%m-%d'),userId |
| | | GROUP BY DATE_FORMAT(a.endTime, '%Y-%m-%d'),userId |
| | | ) as aa GROUP BY aa.time |
| | | |
| | | <if test="2 == type"> |
| | |
| | | and b.companyId = #{companyId} |
| | | </if> |
| | | GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d'),userId |
| | | ) as aa GROUP BY aa.time |
| | | |
| | | union all |
| | | |
| | | select |
| | | aa.time, |
| | | 0, |
| | | 0, |
| | | 0, |
| | | count(aa.userId) as usePeople, |
| | | sum(aa.receive) as `use`, |
| | | sum(aa.receiveMoney) as useMoney |
| | | from ( |
| | | select |
| | | DATE_FORMAT(a.endTime, '%Y-%m-%d') as time, |
| | | a.userId, |
| | | count(a.id) as receive, |
| | | sum(a.money) as receiveMoney |
| | | from t_user_coupon_record a |
| | | left join t_sys_coupon_record b on (a.couponActivityId = b.id and a.activityType = 1) |
| | | where a.activityType = 1 and a.state = 2 |
| | | <if test="null != name and '' != name"> |
| | | and b.`name` like CONCAT('%', #{name}, '%') |
| | | </if> |
| | | <if test="null != start and '' != start and null != end and '' != end"> |
| | | and DATE_FORMAT(a.endTime, '%Y-%m-%d') between #{start} and #{end} |
| | | </if> |
| | | <if test="null != companyId"> |
| | | and b.companyId = #{companyId} |
| | | </if> |
| | | GROUP BY DATE_FORMAT(a.endTime, '%Y-%m-%d'),userId |
| | | ) as aa GROUP BY aa.time |
| | | </if> |
| | | ) as da GROUP BY da.time order by da.time desc |
| | |
| | | sum(aa.receiveMoney) as useMoney |
| | | from ( |
| | | select |
| | | DATE_FORMAT(a.insertTime, '%Y-%m-%d') as time, |
| | | DATE_FORMAT(a.endTime, '%Y-%m-%d') as time, |
| | | a.userId, |
| | | count(a.id) as receive, |
| | | sum(a.money) as receiveMoney |
| | |
| | | and c.`name` like CONCAT('%', #{name}, '%') |
| | | </if> |
| | | <if test="null != start and '' != start and null != end and '' != end"> |
| | | and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} |
| | | and DATE_FORMAT(a.endTime, '%Y-%m-%d') between #{start} and #{end} |
| | | </if> |
| | | <if test="null != companyId"> |
| | | and c.companyId = #{companyId} |
| | | </if> |
| | | GROUP BY DATE_FORMAT(insertTime, '%Y-%m-%d'),userId |
| | | GROUP BY DATE_FORMAT(endTime, '%Y-%m-%d'),userId |
| | | ) as aa GROUP BY aa.time |
| | | |
| | | <if test="2 == type"> |
| | |
| | | and b.companyId = #{companyId} |
| | | </if> |
| | | GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d'),userId |
| | | ) as aa GROUP BY aa.time |
| | | |
| | | union all |
| | | |
| | | select |
| | | aa.time, |
| | | 0, |
| | | 0, |
| | | 0, |
| | | count(aa.userId) as usePeople, |
| | | sum(aa.receive) as `use`, |
| | | sum(aa.receiveMoney) as useMoney |
| | | from ( |
| | | select |
| | | DATE_FORMAT(a.endTime, '%Y-%m-%d') as time, |
| | | a.userId, |
| | | count(a.id) as receive, |
| | | sum(a.money) as receiveMoney |
| | | from t_user_coupon_record a |
| | | left join t_sys_coupon_record b on (a.couponActivityId = b.id and a.activityType = 1) |
| | | where a.activityType = 1 and a.state = 2 |
| | | <if test="null != name and '' != name"> |
| | | and b.`name` like CONCAT('%', #{name}, '%') |
| | | </if> |
| | | <if test="null != start and '' != start and null != end and '' != end"> |
| | | and DATE_FORMAT(a.endTime, '%Y-%m-%d') between #{start} and #{end} |
| | | </if> |
| | | <if test="null != companyId"> |
| | | and b.companyId = #{companyId} |
| | | </if> |
| | | GROUP BY DATE_FORMAT(a.endTime, '%Y-%m-%d'),userId |
| | | ) as aa GROUP BY aa.time |
| | | </if> |
| | | ) as da GROUP BY da.time |
| | |
| | | select |
| | | aa.time, |
| | | aa.userId, |
| | | aa.userName, |
| | | aa.phone, |
| | | any_value(aa.userName) as userName, |
| | | any_value(aa.phone) as phone, |
| | | sum(aa.amount) as amount, |
| | | sum(aa.tyNum) as tyNum, |
| | | sum(aa.tyUseNum) as tyUseNum, |
| | |
| | | sum(aa.czcUseMoney) as czcUseMoney, |
| | | sum(aa.kcNum) as kcNum, |
| | | sum(aa.kcUseNum) as kcUseNum, |
| | | sum(aa.kcUseMoney) as kcUseMoney |
| | | sum(aa.kcUseMoney) as kcUseMoney, |
| | | sum(aa.xjNum) as xjNum, |
| | | sum(aa.xjUseNum) as xjUseNum, |
| | | sum(aa.xjUseMoney) as xjUseMoney |
| | | from ( |
| | | select |
| | | DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, |
| | |
| | | 0 as czcUseMoney, |
| | | 0 as kcNum, |
| | | 0 as kcUseNum, |
| | | 0 as kcUseMoney |
| | | 0 as kcUseMoney, |
| | | 0 as xjNum, |
| | | 0 as xjUseNum, |
| | | 0 as xjUseMoney |
| | | from t_user_coupon_record a |
| | | left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) |
| | | left join t_user_activity c on (b.userActivityId = c.id) |
| | |
| | | 0 as czcUseMoney, |
| | | 0 as kcNum, |
| | | 0 as kcUseNum, |
| | | 0 as kcUseMoney |
| | | 0 as kcUseMoney, |
| | | 0 as xjNum, |
| | | 0 as xjUseNum, |
| | | 0 as xjUseMoney |
| | | from t_user_coupon_record a |
| | | left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) |
| | | left join t_user_activity c on (b.userActivityId = c.id) |
| | |
| | | 0 as czcUseMoney, |
| | | 0 as kcNum, |
| | | 0 as kcUseNum, |
| | | 0 as kcUseMoney |
| | | 0 as kcUseMoney, |
| | | 0 as xjNum, |
| | | 0 as xjUseNum, |
| | | 0 as xjUseMoney |
| | | from t_user_coupon_record a |
| | | left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) |
| | | left join t_user_activity c on (b.userActivityId = c.id) |
| | |
| | | 0 as czcUseMoney, |
| | | 0 as kcNum, |
| | | 0 as kcUseNum, |
| | | 0 as kcUseMoney |
| | | 0 as kcUseMoney, |
| | | 0 as xjNum, |
| | | 0 as xjUseNum, |
| | | 0 as xjUseMoney |
| | | from t_user_coupon_record a |
| | | left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) |
| | | left join t_user_activity c on (b.userActivityId = c.id) |
| | |
| | | 0 as czcUseMoney, |
| | | 0 as kcNum, |
| | | 0 as kcUseNum, |
| | | 0 as kcUseMoney |
| | | 0 as kcUseMoney, |
| | | 0 as xjNum, |
| | | 0 as xjUseNum, |
| | | 0 as xjUseMoney |
| | | from t_user_coupon_record a |
| | | left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) |
| | | left join t_user_activity c on (b.userActivityId = c.id) |
| | |
| | | sum(a.money) as czcUseMoney, |
| | | 0 as kcNum, |
| | | 0 as kcUseNum, |
| | | 0 as kcUseMoney |
| | | 0 as kcUseMoney, |
| | | 0 as xjNum, |
| | | 0 as xjUseNum, |
| | | 0 as xjUseMoney |
| | | from t_user_coupon_record a |
| | | left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) |
| | | left join t_user_activity c on (b.userActivityId = c.id) |
| | |
| | | 0 as czcUseMoney, |
| | | count(a.id) as kcNum, |
| | | 0 as kcUseNum, |
| | | 0 as kcUseMoney |
| | | 0 as kcUseMoney, |
| | | 0 as xjNum, |
| | | 0 as xjUseNum, |
| | | 0 as xjUseMoney |
| | | from t_user_coupon_record a |
| | | left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) |
| | | left join t_user_activity c on (b.userActivityId = c.id) |
| | |
| | | 0 as czcUseMoney, |
| | | 0 as kcNum, |
| | | count(a.id) as kcUseNum, |
| | | sum(a.money) as kcUseMoney |
| | | sum(a.money) as kcUseMoney, |
| | | 0 as xjNum, |
| | | 0 as xjUseNum, |
| | | 0 as xjUseMoney |
| | | from t_user_coupon_record a |
| | | left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) |
| | | left join t_user_activity c on (b.userActivityId = c.id) |
| | |
| | | and c.companyId = #{companyId} |
| | | </if> |
| | | GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId |
| | | |
| | | union all |
| | | |
| | | select |
| | | DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, |
| | | a.userId as userId, |
| | | d.nickName as userName, |
| | | d.phone as phone, |
| | | 0 as amount, |
| | | 0 as tyNum, |
| | | 0 as tyUseNum, |
| | | 0 as tyUseMoney, |
| | | 0 as zcNum, |
| | | 0 as zcUseNum, |
| | | 0 as zcUseMoney, |
| | | 0 as czcNum, |
| | | 0 as czcUseNum, |
| | | 0 as czcUseMoney, |
| | | 0 as kcNum, |
| | | 0 as kcUseNum, |
| | | 0 as kcUseMoney, |
| | | count(a.id) as xjNum, |
| | | 0 as xjUseNum, |
| | | 0 as xjUseMoney |
| | | from t_user_coupon_record a |
| | | left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) |
| | | left join t_user_activity c on (b.userActivityId = c.id) |
| | | left join t_user d on (a.userId = d.id) |
| | | left join t_payment_record e on (a.paymentRecordId = e.id) |
| | | where a.activityType = 4 and a.couponUseType = 4 |
| | | <if test="null != name and '' != name"> |
| | | and c.`name` like CONCAT('%', #{name}, '%') |
| | | </if> |
| | | <if test="null != start and '' != start and null != end and '' != end"> |
| | | and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} |
| | | </if> |
| | | <if test="null != companyId"> |
| | | and c.companyId = #{companyId} |
| | | </if> |
| | | GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId |
| | | |
| | | union all |
| | | |
| | | select |
| | | DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, |
| | | a.userId as userId, |
| | | d.nickName as userName, |
| | | d.phone as phone, |
| | | 0 as amount, |
| | | 0 as tyNum, |
| | | 0 as tyUseNum, |
| | | 0 as tyUseMoney, |
| | | 0 as zcNum, |
| | | 0 as zcUseNum, |
| | | 0 as zcUseMoney, |
| | | 0 as czcNum, |
| | | 0 as czcUseNum, |
| | | 0 as czcUseMoney, |
| | | 0 as kcNum, |
| | | 0 as kcUseNum, |
| | | 0 as kcUseMoney, |
| | | 0 as xjNum, |
| | | count(a.id) as xjUseNum, |
| | | sum(a.money) as xjUseMoney |
| | | from t_user_coupon_record a |
| | | left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) |
| | | left join t_user_activity c on (b.userActivityId = c.id) |
| | | left join t_user d on (a.userId = d.id) |
| | | left join t_payment_record e on (a.paymentRecordId = e.id) |
| | | where a.activityType = 4 and a.couponUseType = 4 and a.state = 2 |
| | | <if test="null != name and '' != name"> |
| | | and c.`name` like CONCAT('%', #{name}, '%') |
| | | </if> |
| | | <if test="null != start and '' != start and null != end and '' != end"> |
| | | and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} |
| | | </if> |
| | | <if test="null != companyId"> |
| | | and c.companyId = #{companyId} |
| | | </if> |
| | | GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId |
| | | ) as aa GROUP BY aa.time,aa.userId order by aa.time desc |
| | | <if test="null != offset and null != limit"> |
| | | limit #{offset}, #{limit} |