| | |
| | | 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"> |
| | |
| | | </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 |
| | | ) as w |