Browse Source

优化结清申请

master
fanzongzhe 7 months ago
parent
commit
8bf2c984d7
  1. 140
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loansettleapply/LoanSettleApplyMapper.xml

140
anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loansettleapply/LoanSettleApplyMapper.xml

@ -282,62 +282,94 @@ FROM (
p.policyOrOther ASC) a
WHERE a.money > 0
</select>
<!-- <select id="selNoReturnJrMoneyByBusVinSidAndKeyDesc"-->
<!-- resultType="com.yxt.anrui.riskcenter.api.loansettleapply.PlanNoReturnMoney">-->
<!-- SELECT * FROM-->
<!-- (SELECT-->
<!-- a.*,-->
<!-- (-->
<!-- SELECT-->
<!-- IFNULL( fjj.reveivableMoney, 0 ) - IFNULL( fjj.m, 0 )-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- (-->
<!-- SELECT-->
<!-- IFNULL( SUM( subscriptionMoney ), 0 )-->
<!-- FROM-->
<!-- anrui_fin.fin_selected_receivables_detailed AS s-->
<!-- WHERE-->
<!-- s.auditState = '3'-->
<!-- AND s.receivablesSid = fj.sid-->
<!-- ) AS m,-->
<!-- fj.*-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- j.busSid,-->
<!-- j.sid,-->
<!-- IFNULL( j.reveivableMoney, 0 ) reveivableMoney-->
<!-- FROM-->
<!-- anrui_fin.fin_uncollected_receivables_detailed_jr AS j-->
<!-- WHERE-->
<!-- j.payCostTitleKey = #{key}-->
<!-- ) AS fj-->
<!-- ) AS fjj-->
<!-- WHERE-->
<!-- fjj.busSid = a.sid-->
<!-- ) AS money,-->
<!-- (SELECT-->
<!-- j.sid-->
<!-- FROM-->
<!-- anrui_fin.fin_uncollected_receivables_detailed_jr AS j-->
<!-- WHERE-->
<!-- j.payCostTitleKey = #{key} and j.busSid = a.sid) jrSid-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- p.sid,-->
<!-- p.period,-->
<!-- p.bankName-->
<!-- FROM-->
<!-- loan_repayment_plan_details p-->
<!-- WHERE-->
<!-- p.busVinSid = #{busVinSid}-->
<!-- ORDER BY-->
<!-- p.period DESC,-->
<!-- p.policyOrOther ASC-->
<!-- ) a) b-->
<!-- WHERE b.money > 0-->
<!-- </select>-->
<select id="selNoReturnJrMoneyByBusVinSidAndKeyDesc"
resultType="com.yxt.anrui.riskcenter.api.loansettleapply.PlanNoReturnMoney">
SELECT * FROM
(SELECT
a.*,
(
SELECT
IFNULL( fjj.reveivableMoney, 0 ) - IFNULL( fjj.m, 0 )
FROM
(
SELECT
(
SELECT
IFNULL( SUM( subscriptionMoney ), 0 )
FROM
anrui_fin.fin_selected_receivables_detailed AS s
WHERE
s.auditState = '3'
AND s.receivablesSid = fj.sid
) AS m,
fj.*
FROM
(
SELECT
j.busSid,
j.sid,
IFNULL( j.reveivableMoney, 0 ) reveivableMoney
FROM
anrui_fin.fin_uncollected_receivables_detailed_jr AS j
WHERE
j.payCostTitleKey = #{key}
) AS fj
) AS fjj
WHERE
fjj.busSid = a.sid
) AS money,
(SELECT
j.sid
FROM
anrui_fin.fin_uncollected_receivables_detailed_jr AS j
WHERE
j.payCostTitleKey = #{key} and j.busSid = a.sid) jrSid
FROM
(
SELECT
p.sid,
p.period,
p.bankName
FROM
loan_repayment_plan_details p
WHERE
p.busVinSid = #{busVinSid}
ORDER BY
p.period DESC,
p.policyOrOther ASC
) a) b
SELECT * FROM (
SELECT
a.jrSid,
a.sid,
(a.currentReceivableMoney - a.m) money
FROM
(SELECT
p.sid,
jr.sid jrSid,
(
SELECT
IFNULL( SUM( subscriptionMoney ), 0 )
FROM
anrui_fin.fin_selected_receivables_detailed AS s
WHERE
s.auditState = '3'
AND s.receivablesSid = jr.sid
) AS m,
IFNULL(jr.currentReceivableMoney,0) currentReceivableMoney
FROM
anrui_fin.fin_uncollected_receivables_detailed_jr AS jr
LEFT JOIN loan_repayment_plan_details AS p ON jr.busSid = p.sid
WHERE
p.busVinSid = #{busVinSid}
AND jr.payCostTitleKey = #{key}
ORDER BY
p.period DESC,
p.policyOrOther ASC) a ) b
WHERE b.money > 0
</select>
<select id="selectNoReturnMoneyByType"

Loading…
Cancel
Save