JSK
This commit is contained in:
parent
9bb7a65709
commit
0fcd6e8ae6
|
|
@ -210,13 +210,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
sum(case when oi.mealtime_type = 4 then
|
||||
oi.real_amount - oi.refund_amount else 0
|
||||
end) as dinner_consume_count,
|
||||
count(distinct case when oi.mealtime_type = 5 then
|
||||
count(distinct case when oi.mealtime_type = 5 or oi.mealtime_type = -1 then
|
||||
oi.user_id else null
|
||||
end) as midnight_snack_user_count,
|
||||
count(case when oi.mealtime_type = 5 then
|
||||
count(case when oi.mealtime_type = 5 or oi.mealtime_type = -1 then
|
||||
oi.order_id else null
|
||||
end) as midnight_snack_order_count,
|
||||
sum(case when oi.mealtime_type = 5 then
|
||||
sum(case when oi.mealtime_type = 5 or oi.mealtime_type = -1 then
|
||||
oi.real_amount - oi.refund_amount else 0
|
||||
end) as midnight_snack_consume_count
|
||||
from
|
||||
|
|
@ -250,51 +250,51 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
oi.user_id,
|
||||
su.nick_name,
|
||||
sd.dept_full_name,
|
||||
count(distinct case when oi.mealtime_type = 1 then
|
||||
oi.user_id else null
|
||||
end) as breakfast_user_count,
|
||||
count(case when oi.mealtime_type = 1 then
|
||||
oi.order_id else null
|
||||
end) as breakfast_order_count,
|
||||
sum(case when oi.mealtime_type = 1 then
|
||||
oi.real_amount - oi.refund_amount else 0
|
||||
end) as breakfast_consume_count,
|
||||
count(distinct case when oi.mealtime_type = 2 then
|
||||
oi.user_id else null
|
||||
end) as lunch_user_count,
|
||||
count(case when oi.mealtime_type = 2 then
|
||||
oi.order_id else null
|
||||
end) as lunch_order_count,
|
||||
sum(case when oi.mealtime_type = 2 then
|
||||
oi.real_amount - oi.refund_amount else 0
|
||||
end) as lunch_consume_count,
|
||||
count(distinct case when oi.mealtime_type = 3 then
|
||||
oi.user_id else null
|
||||
end) as afternoon_tea_user_count,
|
||||
count(case when oi.mealtime_type = 3 then
|
||||
oi.order_id else null
|
||||
end) as afternoon_tea_order_count,
|
||||
sum(case when oi.mealtime_type = 3 then
|
||||
oi.real_amount - oi.refund_amount else 0
|
||||
end) as afternoon_tea_consume_count,
|
||||
count(distinct case when oi.mealtime_type = 4 then
|
||||
oi.user_id else null
|
||||
end) as dinner_user_count,
|
||||
count(case when oi.mealtime_type = 4 then
|
||||
oi.order_id else null
|
||||
end) as dinner_order_count,
|
||||
sum(case when oi.mealtime_type = 4 then
|
||||
oi.real_amount - oi.refund_amount else 0
|
||||
end) as dinner_consume_count,
|
||||
count(distinct case when oi.mealtime_type = 5 then
|
||||
oi.user_id else null
|
||||
end) as midnight_snack_user_count,
|
||||
count(case when oi.mealtime_type = 5 then
|
||||
oi.order_id else null
|
||||
end) as midnight_snack_order_count,
|
||||
sum(case when oi.mealtime_type = 5 then
|
||||
oi.real_amount - oi.refund_amount else 0
|
||||
end) as midnight_snack_consume_count
|
||||
count(distinct case when oi.order_type!=2 and oi.mealtime_type = 1 then
|
||||
oi.user_id else null
|
||||
end) as breakfast_user_count,
|
||||
count(case when oi.order_type!=2 and oi.mealtime_type = 1 then
|
||||
oi.order_id else null
|
||||
end) as breakfast_order_count,
|
||||
sum(case when oi.order_type!=2 and oi.mealtime_type = 1 then
|
||||
oi.real_amount - oi.refund_amount else 0
|
||||
end) as breakfast_consume_count,
|
||||
count(distinct case when oi.order_type!=2 and oi.mealtime_type = 2 then
|
||||
oi.user_id else null
|
||||
end) as lunch_user_count,
|
||||
count(case when oi.order_type!=2 and oi.mealtime_type = 2 then
|
||||
oi.order_id else null
|
||||
end) as lunch_order_count,
|
||||
sum(case when oi.order_type!=2 and oi.mealtime_type = 2 then
|
||||
oi.real_amount - oi.refund_amount else 0
|
||||
end) as lunch_consume_count,
|
||||
count(distinct case when oi.order_type=2 then
|
||||
oi.user_id else null
|
||||
end) as afternoon_tea_user_count,
|
||||
count(case when oi.order_type=2 then
|
||||
oi.order_id else null
|
||||
end) as afternoon_tea_order_count,
|
||||
sum(case when oi.order_type=2 then
|
||||
oi.real_amount - oi.refund_amount else 0
|
||||
end) as afternoon_tea_consume_count,
|
||||
count(distinct case when oi.order_type!=2 and oi.mealtime_type = 4 then
|
||||
oi.user_id else null
|
||||
end) as dinner_user_count,
|
||||
count(case when oi.order_type!=2 and oi.mealtime_type = 4 then
|
||||
oi.order_id else null
|
||||
end) as dinner_order_count,
|
||||
sum(case when oi.order_type!=2 and oi.mealtime_type = 4 then
|
||||
oi.real_amount - oi.refund_amount else 0
|
||||
end) as dinner_consume_count,
|
||||
count(distinct case when oi.order_type!=2 and (oi.mealtime_type = 5 or oi.mealtime_type = -1) then
|
||||
oi.user_id else null
|
||||
end) as midnight_snack_user_count,
|
||||
count(case when oi.order_type!=2 and (oi.mealtime_type = 5 or oi.mealtime_type = -1) then
|
||||
oi.order_id else null
|
||||
end) as midnight_snack_order_count,
|
||||
sum(case when oi.order_type!=2 and (oi.mealtime_type = 5 or oi.mealtime_type = -1) then
|
||||
oi.real_amount - oi.refund_amount else 0
|
||||
end) as midnight_snack_consume_count
|
||||
from
|
||||
order_info oi
|
||||
left join sys_user su on
|
||||
|
|
|
|||
Loading…
Reference in New Issue