Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
baihang-report
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
data-spider
baihang-report
Commits
97e512b4
Commit
97e512b4
authored
Nov 10, 2019
by
haoyanhui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
还款和逾期sql优化
parent
806c1250
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
21 deletions
+26
-21
RepaymentLoanInfoMapper.xml
...ntgroup/report/mapper/baihang/RepaymentLoanInfoMapper.xml
+26
-21
No files found.
src/main/resources/cn/quantgroup/report/mapper/baihang/RepaymentLoanInfoMapper.xml
View file @
97e512b4
...
@@ -360,17 +360,19 @@
...
@@ -360,17 +360,19 @@
end as loanStatus
end as loanStatus
,if(f.yqze>0,'overdue','normal') termStatus
,if(f.yqze>0,'overdue','normal') termStatus
from (
from (
select a.*,if(c.term_no is null,a.term_no,c.term_no) next_term
select -- a.*,
,if(c.deadline is null,a.deadline,c.deadline) next_deadline
a.id,a.user_id,a.loan_application_history_id,a.term_no,a.deadline,a.required_repayment,a.repayment_status,a.repaid_at,a.created_at,
,b.loan_paid_at
if(c.term_no is null,a.term_no,c.term_no) next_term
from xyqb_i_repayment_plan a
,if(c.deadline is null,a.deadline,c.deadline) next_deadline
left join xyqb_i_loan_application_manifest_history b
,b.loan_paid_at
on a.loan_application_history_id=b.loan_application_history_id and b.loan_paid_at
<
#{endTime,jdbcType=VARCHAR}
from xyqb_i_repayment_plan a
left join xyqb_i_repayment_plan c on a.loan_application_history_id=c.loan_application_history_id
left join xyqb_i_loan_application_manifest_history b
and a.term_no=c.term_no-1
on a.loan_application_history_id=b.loan_application_history_id and b.loan_paid_at
<
#{endTime,jdbcType=VARCHAR}
where a.repaid_at>= #{startTime,jdbcType=VARCHAR} and a.repaid_at
<
#{endTime,jdbcType=VARCHAR} and a.repayment_status=3
left join xyqb_i_repayment_plan c on a.loan_application_history_id=c.loan_application_history_id
and b.funding_corp_id in (420,520,580,650,670,810,240,640,700)
and a.term_no=c.term_no-1
and b.contract_term not in (2,3)
where a.repaid_at>= #{startTime,jdbcType=VARCHAR} and a.repaid_at
<
#{endTime,jdbcType=VARCHAR} and a.repayment_status=3
and b.funding_corp_id in (420,520,580,650,670,810,240,640,700)
and b.contract_term not in (2,3)
) a
) a
left join xyqb_user_i_user_detail b on a.user_id=b.user_id
left join xyqb_user_i_user_detail b on a.user_id=b.user_id
left join xyqb_i_loan_account_ext c on a.loan_application_history_id=c.loan_id
left join xyqb_i_loan_account_ext c on a.loan_application_history_id=c.loan_id
...
@@ -467,16 +469,19 @@
...
@@ -467,16 +469,19 @@
when f.yqze=0 and f.dkye>0 then '1'
when f.yqze=0 and f.dkye>0 then '1'
end as loanStatus
end as loanStatus
,'overdue' termStatus
,'overdue' termStatus
from (select a.*
from (
from xyqb_i_repayment_plan a
select -- a.*
left join xyqb_i_loan_application_manifest_history b
a.id,a.user_id,a.loan_application_history_id,a.term_no,a.deadline,a.required_repayment,a.repayment_status,a.repaid_at,a.repayment_received_at
on a.loan_application_history_id=b.loan_application_history_id and b.loan_paid_at
<
#{endTime,jdbcType=VARCHAR}
from xyqb_i_repayment_plan a
where (a.repayment_status !=3 or (a.repayment_status =3 and a.repaid_at>= #{endTime,jdbcType=VARCHAR})) and
left join xyqb_i_loan_application_manifest_history b
if(b.contract_term>a.term_no,DATEDIFF( #{endTime,jdbcType=VARCHAR},a.deadline)=0,DATEDIFF( #{endTime,jdbcType=VARCHAR},a.deadline)>=0)
on a.loan_application_history_id=b.loan_application_history_id and b.loan_paid_at
<
#{endTime,jdbcType=VARCHAR}
and floor(DATEDIFF( #{endTime,jdbcType=VARCHAR},a.deadline)/30)=DATEDIFF( #{endTime,jdbcType=VARCHAR},a.deadline)/30
where (a.repayment_status !=3 or (a.repayment_status =3 and a.repaid_at>= #{endTime,jdbcType=VARCHAR})) and
and b.funding_corp_id in (420,520,580,650,670,810,240,640,700)
if(b.contract_term>a.term_no,DATEDIFF( #{endTime,jdbcType=VARCHAR},a.deadline)=0,DATEDIFF( #{endTime,jdbcType=VARCHAR},a.deadline)>=0)
and b.transaction_status in (2,5)
and floor(DATEDIFF( #{endTime,jdbcType=VARCHAR},a.deadline)/30)=DATEDIFF( #{endTime,jdbcType=VARCHAR},a.deadline)/30
and b.contract_term not in (2,3)) a
and b.funding_corp_id in (420,520,580,650,670,810,240,640,700)
and b.transaction_status in (2,5)
and b.contract_term not in (2,3)
) a
left join xyqb_user_i_user_detail b on a.user_id=b.user_id
left join xyqb_user_i_user_detail b on a.user_id=b.user_id
left join xyqb_i_loan_account_ext c on a.loan_application_history_id=c.loan_id
left join xyqb_i_loan_account_ext c on a.loan_application_history_id=c.loan_id
left join xyqb_i_apply_quota_record d on c.order_no=d.order_no
left join xyqb_i_apply_quota_record d on c.order_no=d.order_no
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment