Commit 1f7f23f1 by jianan

FYC

FYC不正确
parent eb2d934a
......@@ -105,6 +105,7 @@
(select p.id practitionerId,
p.name,
p.mobile_no,
p.customer_id,
sum(case when to_days(t.track_time) = to_days(now()) then COALESCE(t.track_score,0) else 0 end) dayScore,
sum(case when YEARWEEK(date_format(t.track_time,'%Y-%m-%d'),1) = YEARWEEK(now(),1) then COALESCE(t.track_score,0) else 0 end) weekScore,
sum(case when date_format(t.track_time,'%Y-%m')=date_format(now(),'%Y-%m') then COALESCE(t.track_score,0) else 0 end) monthScore
......@@ -128,11 +129,10 @@
and o.payment_status =3
and o.fyc_amount>0
and t.drop_option_code ='S01'
and o.created_at between #{firstDay,jdbcType=TIMESTAMP}
and #{lastDay,jdbcType=TIMESTAMP}
and DATE_FORMAT(o.created_at, '%Y%m' ) = DATE_FORMAT( CURDATE() , '%Y%m' )
group by t.customer_id
) fyc
ON s.practitionerId = fyc.customer_id
ON s.customer_id = fyc.customer_id
ORDER BY dayScore desc, weekScore desc, monthScore desc
</select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment