Commit e6ad8fea authored by 陈宏杰's avatar 陈宏杰

2000-01-01问题

parent c7f3daef
......@@ -1013,8 +1013,8 @@
group by a.loan_application_history_id,a.term_no) f on a.loan_application_history_id=f.loan_application_history_id and a.term_no=f.term_no
left join xyqb.repayment_record g on a.id=g.repayment_plan_id
left join (
select a.loan_application_history_id,a.term_no,if(TO_DAYS(IFNULL(a.repayment_received_at,NOW()))!=TO_DAYS(date(DATE_sub(a.deadline,INTERVAL 1 second))),a.deadline,a.repayment_received_at)
,sum(if(a.repayment_status !=3 or (a.repayment_status =3 and if(TO_DAYS(IFNULL(a.repayment_received_at,NOW()))!=TO_DAYS(date(DATE_sub(a.deadline,INTERVAL 1 second))),a.deadline,a.repayment_received_at) < g.repayment_received_at),if(b.loan_paid_at>='2018-01-01',g.principal,h.principle),0)) dkye
select a.loan_application_history_id,a.term_no
,sum(if(a.repayment_status !=3 or (a.repayment_status =3 and if(TO_DAYS(IFNULL(a.repayment_received_at,NOW()))!=TO_DAYS(date(DATE_sub(a.deadline,INTERVAL 1 second))),a.deadline,a.repayment_received_at) <= g.repayment_received_at) or (a.repayment_status =3 and DATE_FORMAT(g.repayment_received_at,'%Y-%m-%d') = '2000-01-01'),if(b.loan_paid_at>='2018-01-01',g.principal,h.principle),0)) dkye
from xyqb.repayment_plan a
left join xyqb.loan_application_manifest_history b
on a.loan_application_history_id=b.loan_application_history_id and b.loan_paid_at >= #{startTime,jdbcType=VARCHAR} and b.loan_paid_at < #{endTime,jdbcType=VARCHAR}
......
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