|
@@ -3,46 +3,50 @@
|
|
|
<mapper namespace="com.fjhx.account.mapper.account.AccountRunningWaterMapper">
|
|
|
<!--这段代码正常是不需要跨库查询的。但是一开始封装包的时候分装的不合理,pom里面包是不能互相引用的。account包继承sale包会出现依赖冲突,目前不好改动,只能跨库查询-->
|
|
|
<select id="getPage" resultType="com.fjhx.account.entity.account.vo.AccountRunningWaterVo">
|
|
|
- SELECT arw.*,
|
|
|
- (SELECT IF
|
|
|
- (t1.type = 20, GROUP_CONCAT(c.`code`), GROUP_CONCAT(t4.`code`)) contractCodes
|
|
|
- FROM account_payment t1
|
|
|
- LEFT JOIN account_request_funds t2 ON t1.business_id = t2.id
|
|
|
- LEFT JOIN account_request_funds_detail t3 ON t2.id = t3.account_request_funds_id
|
|
|
- LEFT JOIN `bytesailing_sale`.contract t4 ON t3.contract_id = t4.id
|
|
|
- --采购付款来源
|
|
|
- LEFT JOIN bytesailing_purchase.pay pa ON t1.business_id = pa.id
|
|
|
- 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.id = arw.business_id
|
|
|
- ) AS contractCodes
|
|
|
- , (
|
|
|
- SELECT
|
|
|
- IF
|
|
|
- ( t1.type = 20, GROUP_CONCAT( c.id ), GROUP_CONCAT( t4.id ) ) contractIds
|
|
|
- FROM
|
|
|
- account_payment t1
|
|
|
- LEFT JOIN account_request_funds t2
|
|
|
- ON t1.business_id = t2.id
|
|
|
- LEFT JOIN account_request_funds_detail t3 ON t2.id = t3.account_request_funds_id
|
|
|
- LEFT JOIN `bytesailing_sale`.contract t4 ON t3.contract_id = t4.id
|
|
|
- --采购付款来源
|
|
|
- LEFT JOIN bytesailing_purchase.pay pa ON t1.business_id = pa.id
|
|
|
- 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.id = arw.business_id
|
|
|
- ) AS contractIds
|
|
|
- , am.alias accountManagementName
|
|
|
- , am.corporation_id
|
|
|
- FROM
|
|
|
- account_running_water arw
|
|
|
- LEFT JOIN account_management am
|
|
|
- ON arw.account_management_id = am.id
|
|
|
+ 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),
|
|
|
+ (SELECT IF
|
|
|
+ (t1.type = 20, GROUP_CONCAT(c.`code`), GROUP_CONCAT(t4.`code`)) contractCodes
|
|
|
+ FROM account_payment t1
|
|
|
+ LEFT JOIN account_request_funds t2 ON t1.business_id = t2.id
|
|
|
+ LEFT JOIN account_request_funds_detail t3 ON t2.id = t3.account_request_funds_id
|
|
|
+ LEFT JOIN `bytesailing_sale`.contract t4 ON t3.contract_id = t4.id
|
|
|
+ --采购付款来源
|
|
|
+ LEFT JOIN bytesailing_purchase.pay pa ON t1.business_id = pa.id
|
|
|
+ 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.id = arw.business_id ) )AS contractCodes
|
|
|
+
|
|
|
+ , if(arw.type = 40, (select GROUP_CONCAT(trd.contract_id)
|
|
|
+ from tax_refund_details trd
|
|
|
+ where trd.account_running_water_id = arw.id), (SELECT IF
|
|
|
+ (t1.type = 20,
|
|
|
+ GROUP_CONCAT(c.id),
|
|
|
+ GROUP_CONCAT(t4.id)) contractIds
|
|
|
+ FROM account_payment t1
|
|
|
+ LEFT JOIN account_request_funds t2
|
|
|
+ ON t1.business_id = t2.id
|
|
|
+ LEFT JOIN account_request_funds_detail t3 ON t2.id = t3.account_request_funds_id
|
|
|
+ LEFT JOIN `bytesailing_sale`.contract t4
|
|
|
+ ON t3.contract_id = t4.id
|
|
|
+ --采购付款来源
|
|
|
+ LEFT JOIN bytesailing_purchase.pay pa ON t1.business_id = pa.id
|
|
|
+ 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.id = arw.business_id )) AS contractIds
|
|
|
+ , am.alias accountManagementName
|
|
|
+ , am.corporation_id
|
|
|
+ FROM account_running_water arw
|
|
|
+ LEFT JOIN account_management am
|
|
|
+ ON arw.account_management_id = am.id
|
|
|
${ew.customSqlSegment}
|
|
|
</select>
|
|
|
<select id="getDetail" resultType="com.fjhx.account.entity.account.vo.AccountRunningWaterVo">
|