|
@@ -4,29 +4,30 @@
|
|
<!--这段代码正常是不需要跨库查询的。但是一开始封装包的时候分装的不合理,pom里面包是不能互相引用的。account包继承sale包会出现依赖冲突,目前不好改动,只能跨库查询-->
|
|
<!--这段代码正常是不需要跨库查询的。但是一开始封装包的时候分装的不合理,pom里面包是不能互相引用的。account包继承sale包会出现依赖冲突,目前不好改动,只能跨库查询-->
|
|
<select id="getPage" resultType="com.fjhx.account.entity.account.vo.AccountRunningWaterVo">
|
|
<select id="getPage" resultType="com.fjhx.account.entity.account.vo.AccountRunningWaterVo">
|
|
SELECT arw.*,
|
|
SELECT arw.*,
|
|
- IF
|
|
|
|
- (
|
|
|
|
- arw.type = 40,
|
|
|
|
- (SELECT GROUP_CONCAT(c.`code`)
|
|
|
|
- FROM tax_refund_details trd
|
|
|
|
- LEFT JOIN bytesailing_sale.contract c ON c.id = trd.contract_id
|
|
|
|
- WHERE trd.account_running_water_id = arw.id),
|
|
|
|
- IF
|
|
|
|
- (
|
|
|
|
- arw.type = 30, (SELECT GROUP_CONCAT(clc.contract_code)
|
|
|
|
- FROM bytesailing_sale.claim cl
|
|
|
|
- LEFT JOIN bytesailing_sale.claim_contract clc ON clc.claim_id = cl.id
|
|
|
|
- WHERE cl.business_id = arw.id),
|
|
|
|
- (SELECT IF
|
|
|
|
- (
|
|
|
|
- t1.type = 20,
|
|
|
|
- (SELECT GROUP_CONCAT(c.`code`)
|
|
|
|
- FROM bytesailing_purchase.pay pa
|
|
|
|
- LEFT JOIN bytesailing_purchase.pay_detail pad ON pad.pay_id = pa.id
|
|
|
|
- LEFT JOIN bytesailing_purchase.purchase p ON pad.purchase_id = p.id
|
|
|
|
- LEFT JOIN bytesailing_sale.contract c ON p.data_resource_id = c.id
|
|
|
|
- WHERE
|
|
|
|
- t1.business_id = pa.id ),(
|
|
|
|
|
|
+ if(arw.type = 60, (select c.`code` from bytesailing_sale.contract c where c.id = arw.business_id),
|
|
|
|
+ IF
|
|
|
|
+ (
|
|
|
|
+ arw.type = 40,
|
|
|
|
+ (SELECT GROUP_CONCAT(c.`code`)
|
|
|
|
+ FROM tax_refund_details trd
|
|
|
|
+ LEFT JOIN bytesailing_sale.contract c ON c.id = trd.contract_id
|
|
|
|
+ WHERE trd.account_running_water_id = arw.id),
|
|
|
|
+ IF
|
|
|
|
+ (
|
|
|
|
+ arw.type = 30, (SELECT GROUP_CONCAT(clc.contract_code)
|
|
|
|
+ FROM bytesailing_sale.claim cl
|
|
|
|
+ LEFT JOIN bytesailing_sale.claim_contract clc ON clc.claim_id = cl.id
|
|
|
|
+ WHERE cl.business_id = arw.id),
|
|
|
|
+ (SELECT IF
|
|
|
|
+ (
|
|
|
|
+ t1.type = 20,
|
|
|
|
+ (SELECT GROUP_CONCAT(c.`code`)
|
|
|
|
+ FROM bytesailing_purchase.pay pa
|
|
|
|
+ LEFT JOIN bytesailing_purchase.pay_detail pad ON pad.pay_id = pa.id
|
|
|
|
+ LEFT JOIN bytesailing_purchase.purchase p ON pad.purchase_id = p.id
|
|
|
|
+ LEFT JOIN bytesailing_sale.contract c ON p.data_resource_id = c.id
|
|
|
|
+ WHERE
|
|
|
|
+ t1.business_id = pa.id ),(
|
|
SELECT
|
|
SELECT
|
|
GROUP_CONCAT( t4.`code` )
|
|
GROUP_CONCAT( t4.`code` )
|
|
FROM
|
|
FROM
|
|
@@ -37,33 +38,35 @@
|
|
t1.business_id = t2.id
|
|
t1.business_id = t2.id
|
|
)
|
|
)
|
|
) contractCodes
|
|
) contractCodes
|
|
- FROM account_payment t1
|
|
|
|
- WHERE t1.id = arw.business_id)
|
|
|
|
- )
|
|
|
|
|
|
+ FROM account_payment t1
|
|
|
|
+ WHERE t1.id = arw.business_id)
|
|
|
|
+ )
|
|
|
|
+ )
|
|
) AS contractCodes,
|
|
) AS contractCodes,
|
|
- IF
|
|
|
|
- (
|
|
|
|
- arw.type = 40,
|
|
|
|
- (SELECT GROUP_CONCAT(c.`id`)
|
|
|
|
- FROM tax_refund_details trd
|
|
|
|
- LEFT JOIN bytesailing_sale.contract c ON c.id = trd.contract_id
|
|
|
|
- WHERE trd.account_running_water_id = arw.id),
|
|
|
|
- IF
|
|
|
|
- (
|
|
|
|
- arw.type = 30, (SELECT GROUP_CONCAT(clc.contract_id)
|
|
|
|
- FROM bytesailing_sale.claim cl
|
|
|
|
- LEFT JOIN bytesailing_sale.claim_contract clc ON clc.claim_id = cl.id
|
|
|
|
- WHERE cl.business_id = arw.id),
|
|
|
|
- (SELECT IF
|
|
|
|
- (
|
|
|
|
- t1.type = 20,
|
|
|
|
- (SELECT GROUP_CONCAT(c.`id`)
|
|
|
|
- FROM bytesailing_purchase.pay pa
|
|
|
|
- LEFT JOIN bytesailing_purchase.pay_detail pad ON pad.pay_id = pa.id
|
|
|
|
- LEFT JOIN bytesailing_purchase.purchase p ON pad.purchase_id = p.id
|
|
|
|
- LEFT JOIN bytesailing_sale.contract c ON p.data_resource_id = c.id
|
|
|
|
- WHERE
|
|
|
|
- t1.business_id = pa.id ),(
|
|
|
|
|
|
+ if(arw.type = 60, (select c.`id` from bytesailing_sale.contract c where c.id = arw.business_id),
|
|
|
|
+ IF
|
|
|
|
+ (
|
|
|
|
+ arw.type = 40,
|
|
|
|
+ (SELECT GROUP_CONCAT(c.`id`)
|
|
|
|
+ FROM tax_refund_details trd
|
|
|
|
+ LEFT JOIN bytesailing_sale.contract c ON c.id = trd.contract_id
|
|
|
|
+ WHERE trd.account_running_water_id = arw.id),
|
|
|
|
+ IF
|
|
|
|
+ (
|
|
|
|
+ arw.type = 30, (SELECT GROUP_CONCAT(clc.contract_id)
|
|
|
|
+ FROM bytesailing_sale.claim cl
|
|
|
|
+ LEFT JOIN bytesailing_sale.claim_contract clc ON clc.claim_id = cl.id
|
|
|
|
+ WHERE cl.business_id = arw.id),
|
|
|
|
+ (SELECT IF
|
|
|
|
+ (
|
|
|
|
+ t1.type = 20,
|
|
|
|
+ (SELECT GROUP_CONCAT(c.`id`)
|
|
|
|
+ FROM bytesailing_purchase.pay pa
|
|
|
|
+ LEFT JOIN bytesailing_purchase.pay_detail pad ON pad.pay_id = pa.id
|
|
|
|
+ LEFT JOIN bytesailing_purchase.purchase p ON pad.purchase_id = p.id
|
|
|
|
+ LEFT JOIN bytesailing_sale.contract c ON p.data_resource_id = c.id
|
|
|
|
+ WHERE
|
|
|
|
+ t1.business_id = pa.id ),(
|
|
SELECT
|
|
SELECT
|
|
GROUP_CONCAT( t4.`id` )
|
|
GROUP_CONCAT( t4.`id` )
|
|
FROM
|
|
FROM
|
|
@@ -74,9 +77,10 @@
|
|
t1.business_id = t2.id
|
|
t1.business_id = t2.id
|
|
)
|
|
)
|
|
) contractCodes
|
|
) contractCodes
|
|
- FROM account_payment t1
|
|
|
|
- WHERE t1.id = arw.business_id)
|
|
|
|
- )
|
|
|
|
|
|
+ FROM account_payment t1
|
|
|
|
+ WHERE t1.id = arw.business_id)
|
|
|
|
+ )
|
|
|
|
+ )
|
|
) AS contractIds,
|
|
) AS contractIds,
|
|
am.alias accountManagementName,
|
|
am.alias accountManagementName,
|
|
am.corporation_id
|
|
am.corporation_id
|
|
@@ -140,4 +144,11 @@
|
|
LIMIT #{size}
|
|
LIMIT #{size}
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
+ <!-- 要切换到sale库才能执行 -->
|
|
|
|
+ <update id="exchangeSettlementByContractId">
|
|
|
|
+ update contract
|
|
|
|
+ set is_exchange_settlement = #{status}
|
|
|
|
+ where id = #{contractId}
|
|
|
|
+ </update>
|
|
|
|
+
|
|
</mapper>
|
|
</mapper>
|