## 后台看板数据会员数据根据支付时间查询
This commit is contained in:
		
							parent
							
								
									2796747e80
								
							
						
					
					
						commit
						131d88fe1b
					
				|  | @ -12,16 +12,14 @@ | ||||||
|                 and cm.pay_status = 1 |                 and cm.pay_status = 1 | ||||||
|                 and cm.category = 0 |                 and cm.category = 0 | ||||||
|                 and cm.customer_type != 1) a |                 and cm.customer_type != 1) a | ||||||
|                  left join ( |                  left join (select count(1) member_today | ||||||
|             select count(1) member_today |                             from cu_member cm | ||||||
|             from cu_member cm |                             where cm.del_flag = 0 | ||||||
|             where cm.del_flag = 0 |                               and cm.pay_status = 1 | ||||||
|               and cm.pay_status = 1 |                               and cm.category = 0 | ||||||
|               and cm.category = 0 |                               and to_char(cm.pay_time, 'yyyy-mm-dd') = | ||||||
|               and to_char(cm.pay_time, 'yyyy-mm-dd') = |                                   to_char(sysdate, 'yyyy-mm-dd') | ||||||
|                   to_char(sysdate, 'yyyy-mm-dd') |                               and cm.customer_type != 1) b on 1 = 1 | ||||||
|               and cm.customer_type != 1 |  | ||||||
|         ) b on 1 = 1 |  | ||||||
|                  left join (select count(1) member_yesterday |                  left join (select count(1) member_yesterday | ||||||
|                             from cu_member cm |                             from cu_member cm | ||||||
|                             where cm.del_flag = 0 |                             where cm.del_flag = 0 | ||||||
|  | @ -29,8 +27,7 @@ | ||||||
|                               and cm.category = 0 |                               and cm.category = 0 | ||||||
|                               and to_char(cm.pay_time, 'yyyy-mm-dd') = |                               and to_char(cm.pay_time, 'yyyy-mm-dd') = | ||||||
|                                   to_char(sysdate - 1, 'yyyy-mm-dd') |                                   to_char(sysdate - 1, 'yyyy-mm-dd') | ||||||
|                               and cm.customer_type != 1 |                               and cm.customer_type != 1) c | ||||||
|         ) c |  | ||||||
|                            on 1 = 1 |                            on 1 = 1 | ||||||
|                  left join (select count(1) member_month |                  left join (select count(1) member_month | ||||||
|                             from cu_member cm |                             from cu_member cm | ||||||
|  | @ -39,8 +36,7 @@ | ||||||
|                               and cm.category = 0 |                               and cm.category = 0 | ||||||
|                               and to_char(cm.pay_time, 'yyyy-mm') = |                               and to_char(cm.pay_time, 'yyyy-mm') = | ||||||
|                                   to_char(sysdate, 'yyyy-mm') |                                   to_char(sysdate, 'yyyy-mm') | ||||||
|                               and cm.customer_type != 1 |                               and cm.customer_type != 1) d on 1 = 1 | ||||||
|         ) d on 1 = 1 |  | ||||||
|     </select> |     </select> | ||||||
| 
 | 
 | ||||||
|     <!-- 会员各等级数据 --> |     <!-- 会员各等级数据 --> | ||||||
|  | @ -51,11 +47,10 @@ | ||||||
|                0                      sort |                0                      sort | ||||||
|         from (select cm.PK_SETTLE_GRADE, count(1) member_total |         from (select cm.PK_SETTLE_GRADE, count(1) member_total | ||||||
|               from cu_member cm |               from cu_member cm | ||||||
|               where cm.del_flag = 0 |               WHERE cm.del_flag = 0 | ||||||
|                 and cm.category = 0 |                 AND cm.category = 0 | ||||||
|                 and to_char(cm.CREATION_TIME, 'yyyy-mm-dd') = |                 AND cm.PAY_TIME IS NOT NULL | ||||||
|                     to_char(sysdate, 'yyyy-mm-dd') |                 AND to_char(cm.PAY_TIME, 'yyyy-mm-dd') = to_char(SYSDATE, 'yyyy-mm-dd') | ||||||
|                 and cm.customer_type != 1 |  | ||||||
|               group by cm.PK_SETTLE_GRADE |               group by cm.PK_SETTLE_GRADE | ||||||
|               order by cm.PK_SETTLE_GRADE) a |               order by cm.PK_SETTLE_GRADE) a | ||||||
|                  right join bd_grade bg |                  right join bd_grade bg | ||||||
|  | @ -68,11 +63,10 @@ | ||||||
|                1                      sort |                1                      sort | ||||||
|         from (select cm.PK_SETTLE_GRADE, count(1) member_total |         from (select cm.PK_SETTLE_GRADE, count(1) member_total | ||||||
|               from cu_member cm |               from cu_member cm | ||||||
|               where cm.del_flag = 0 |               WHERE cm.del_flag = 0 | ||||||
|                 and cm.category = 0 |                 AND cm.category = 0 | ||||||
|                 and to_char(cm.CREATION_TIME, 'yyyy-mm-dd') = |                 AND cm.PAY_TIME IS NOT NULL | ||||||
|                     to_char(sysdate - 1, 'yyyy-mm-dd') |                 AND to_char(cm.PAY_TIME, 'yyyy-mm-dd') = to_char(SYSDATE - 1, 'yyyy-mm-dd') | ||||||
|                 and cm.customer_type != 1 |  | ||||||
|               group by cm.PK_SETTLE_GRADE |               group by cm.PK_SETTLE_GRADE | ||||||
|               order by cm.PK_SETTLE_GRADE) a |               order by cm.PK_SETTLE_GRADE) a | ||||||
|                  right join bd_grade bg |                  right join bd_grade bg | ||||||
|  | @ -85,10 +79,10 @@ | ||||||
|                2                      sort |                2                      sort | ||||||
|         from (select cm.PK_SETTLE_GRADE, count(1) member_total |         from (select cm.PK_SETTLE_GRADE, count(1) member_total | ||||||
|               from cu_member cm |               from cu_member cm | ||||||
|               where cm.del_flag = 0 |               WHERE cm.del_flag = 0 | ||||||
|                 and cm.category = 0 |                 AND cm.category = 0 | ||||||
|                 and to_char(cm.CREATION_TIME, 'yyyy-mm') = to_char(sysdate, 'yyyy-mm') |                 AND cm.PAY_TIME IS NOT NULL | ||||||
|                 and cm.customer_type != 1 |                 AND to_char(cm.PAY_TIME, 'yyyy-mm') = to_char(SYSDATE, 'yyyy-mm') | ||||||
|               group by cm.PK_SETTLE_GRADE |               group by cm.PK_SETTLE_GRADE | ||||||
|               order by cm.PK_SETTLE_GRADE) a |               order by cm.PK_SETTLE_GRADE) a | ||||||
|                  right join bd_grade bg |                  right join bd_grade bg | ||||||
|  | @ -100,48 +94,40 @@ | ||||||
|     <!-- 查询日业绩汇总数据 --> |     <!-- 查询日业绩汇总数据 --> | ||||||
|     <select id="getDayAchieve" resultType="com.hzs.system.board.vo.BoardAchieveVO"> |     <select id="getDayAchieve" resultType="com.hzs.system.board.vo.BoardAchieveVO"> | ||||||
|         select a.*, b.*, 0 sort |         select a.*, b.*, 0 sort | ||||||
|         from ( |         from (select nvl(sum(so.order_achieve), 0) first_achieve, | ||||||
|                  select nvl(sum(so.order_achieve), 0) first_achieve, |                      nvl(sum(so.order_amount), 0)  first_amount | ||||||
|                         nvl(sum(so.order_amount), 0)  first_amount |               from sa_order so | ||||||
|                  from sa_order so |               where so.del_flag = 0 | ||||||
|                  where so.del_flag = 0 |                 and so.order_status = 1 | ||||||
|                    and so.order_status = 1 |                 and so.order_type in (41, 42) | ||||||
|                    and so.order_type in (41, 42) |                 and to_char(so.pay_time, 'yyyy-mm-dd') = | ||||||
|                    and to_char(so.pay_time, 'yyyy-mm-dd') = |                     to_char(sysdate, 'yyyy-mm-dd')) a | ||||||
|                        to_char(sysdate, 'yyyy-mm-dd') |                  left join (select nvl(sum(so.order_achieve), 0) rep_achieve, | ||||||
|              ) a |                                    nvl(sum(so.order_amount), 0)  rep_amount | ||||||
|                  left join ( |                             from sa_order so | ||||||
|             select nvl(sum(so.order_achieve), 0) rep_achieve, |                             where so.del_flag = 0 | ||||||
|                    nvl(sum(so.order_amount), 0)  rep_amount |                               and so.order_status = 1 | ||||||
|             from sa_order so |                               and so.order_type in (43, 44, 47) | ||||||
|             where so.del_flag = 0 |                               and to_char(so.pay_time, 'yyyy-mm-dd') = | ||||||
|               and so.order_status = 1 |                                   to_char(sysdate, 'yyyy-mm-dd')) b on 1 = 1 | ||||||
|               and so.order_type in (43, 44, 47) |  | ||||||
|               and to_char(so.pay_time, 'yyyy-mm-dd') = |  | ||||||
|                   to_char(sysdate, 'yyyy-mm-dd') |  | ||||||
|         ) b on 1 = 1 |  | ||||||
|         union all |         union all | ||||||
|         select a.*, b.*, 1 sort |         select a.*, b.*, 1 sort | ||||||
|         from ( |         from (select nvl(sum(so.order_achieve), 0) first_achieve, | ||||||
|                  select nvl(sum(so.order_achieve), 0) first_achieve, |                      nvl(sum(so.order_amount), 0)  first_amount | ||||||
|                         nvl(sum(so.order_amount), 0)  first_amount |               from sa_order so | ||||||
|                  from sa_order so |               where so.del_flag = 0 | ||||||
|                  where so.del_flag = 0 |                 and so.order_status = 1 | ||||||
|                    and so.order_status = 1 |                 and so.order_type in (41, 42) | ||||||
|                    and so.order_type in (41, 42) |                 and to_char(so.pay_time, 'yyyy-mm-dd') = | ||||||
|                    and to_char(so.pay_time, 'yyyy-mm-dd') = |                     to_char(sysdate - 1, 'yyyy-mm-dd')) a | ||||||
|                        to_char(sysdate - 1, 'yyyy-mm-dd') |                  left join (select nvl(sum(so.order_achieve), 0) rep_achieve, | ||||||
|              ) a |                                    nvl(sum(so.order_amount), 0)  rep_amount | ||||||
|                  left join ( |                             from sa_order so | ||||||
|             select nvl(sum(so.order_achieve), 0) rep_achieve, |                             where so.del_flag = 0 | ||||||
|                    nvl(sum(so.order_amount), 0)  rep_amount |                               and so.order_status = 1 | ||||||
|             from sa_order so |                               and so.order_type in (43, 44, 47) | ||||||
|             where so.del_flag = 0 |                               and to_char(so.pay_time, 'yyyy-mm-dd') = | ||||||
|               and so.order_status = 1 |                                   to_char(sysdate - 1, 'yyyy-mm-dd')) b on 1 = 1 | ||||||
|               and so.order_type in (43, 44, 47) |  | ||||||
|               and to_char(so.pay_time, 'yyyy-mm-dd') = |  | ||||||
|                   to_char(sysdate - 1, 'yyyy-mm-dd') |  | ||||||
|         ) b on 1 = 1 |  | ||||||
|         order by sort |         order by sort | ||||||
|     </select> |     </select> | ||||||
| 
 | 
 | ||||||
|  | @ -154,18 +140,15 @@ | ||||||
|               where so.del_flag = 0 |               where so.del_flag = 0 | ||||||
|                 and so.order_status = 1 |                 and so.order_status = 1 | ||||||
|                 and so.order_type in (41, 42) |                 and so.order_type in (41, 42) | ||||||
|                 and to_char(so.pay_time, 'yyyy-mm') = to_char(sysdate, 'yyyy-mm') |                 and to_char(so.pay_time, 'yyyy-mm') = to_char(sysdate, 'yyyy-mm')) a | ||||||
|              ) a |                  left join (select nvl(sum(so.order_achieve), 0)                            rep_achieve, | ||||||
|                  left join ( |                                    nvl(sum(so.order_amount - nvl(so.CONSUME_AMOUNT, 0)), 0) rep_amount | ||||||
|             select nvl(sum(so.order_achieve), 0)                            rep_achieve, |                             from sa_order so | ||||||
|                    nvl(sum(so.order_amount - nvl(so.CONSUME_AMOUNT, 0)), 0) rep_amount |                             where so.del_flag = 0 | ||||||
|             from sa_order so |                               and so.order_status = 1 | ||||||
|             where so.del_flag = 0 |                               and so.order_type in (43, 44, 47) | ||||||
|               and so.order_status = 1 |                               and to_char(so.pay_time, 'yyyy-mm') = | ||||||
|               and so.order_type in (43, 44, 47) |                                   to_char(sysdate, 'yyyy-mm')) b on 1 = 1 | ||||||
|               and to_char(so.pay_time, 'yyyy-mm') = |  | ||||||
|                   to_char(sysdate, 'yyyy-mm') |  | ||||||
|         ) b on 1 = 1 |  | ||||||
|     </select> |     </select> | ||||||
| 
 | 
 | ||||||
|     <!-- 各币种充值数据 --> |     <!-- 各币种充值数据 --> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue