left join sys_client_upay_profile scup on scup.client_id = c.client_id
inner join sys_client_config cc on cc.client_id = c.client_id
inner join sys_org o
on o.org_id=c.org_id
@ -328,21 +337,59 @@
<iftest="create_end_time!=null">
AND c.create_time <= #{create_end_time}
</if>
<iftest="approving">
and ((c.approve_result=4 and c.open_status is null) or (c.approve_result=3 and c.open_status is null) or
c.open_status=1 or c.open_status=2 or c.open_status=4)
</if>
<iftest="card_approving and approving">
OR c.client_id IN (
SELECT client_id FROM sys_client_upay_profile scup
WHERE ((scup.upay_approve_result=4 and scup.upay_open_status is null) or scup.upay_open_status=1 or scup.upay_open_status=2 or scup.upay_open_status=4)
)
<iftest="cross_approving_flag">
<iftest="approving">
and ((c.approve_result=4 and c.open_status is null) or (c.approve_result=3 and c.open_status is null) or
c.open_status=1 or c.open_status=2 or c.open_status=4)
</if>
<iftest="temp_mch_id!=null">
and locate(c.sub_merchant_id,#{temp_mch_id})>0 and cc.skip_clearing=0 and
and ((c.source=1 or c.source=2) and c.approve_result=2 or c.open_status=10)
</if>
<iftest="greenChannelBdTodo">
and ((c.source=1 or c.source=2) and c.approve_result=2 and (c.open_status is null or c.open_status=3))
</if>
<iftest="pass">
and c.open_status = 5 AND c.approve_result = 1 AND c.approve_time IS NOT NULL
</if>
<iftest="completed_contract">
and c.open_status IS NULL AND c.approve_result IS NULL AND c.source != 4
</if>
<iftest="apply_to_back">
AND c.approve_result = 5 AND c.approve_time is NOT NULL
</if>
<iftest="bd_upload_material">
AND c.open_status = 3 AND c.approve_result != 5
</if>
</if>
<iftest="card_approving">
<iftest="card_approving_flag">
AND c.client_id IN (
SELECT client_id FROM sys_client_upay_profile scup
WHERE ((scup.upay_approve_result=4 and scup.upay_open_status is null) or scup.upay_open_status=1 or scup.upay_open_status=2 or scup.upay_open_status=4)
WHERE 1=1
<iftest="approving">
and ((scup.upay_approve_result=4 and scup.upay_open_status is null) or scup.upay_open_status=1 or scup.upay_open_status=2 or scup.upay_open_status=4)
</if>
<iftest="quickPass">
and c.source=4
</if>
<iftest="apply_to_back">
AND scup.upay_approve_result = 5 AND scup.upay_approve_time is NOT NULL
</if>
<iftest="completed_contract">
AND scup.upay_open_status IS NULL AND scup.upay_approve_result IS NULL AND c.source != 4
</if>
<iftest="pass">
AND scup.upay_open_status = 5 AND scup.upay_approve_result = 1 AND scup.upay_approve_time IS NOT NULL
</if>
<iftest="bd_upload_material">
AND scup.upay_open_status = 3 AND scup.upay_approve_result != 5
</if>
)
</if>
<iftest="state!=null">
@ -351,31 +398,7 @@
<iftest="merchant_id!=null">
and c.merchant_id=#{merchant_id}
</if>
<iftest="temp_mch_id!=null">
and locate(c.sub_merchant_id,#{temp_mch_id})>0 and cc.skip_clearing=0 and