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