|
@@ -16,6 +16,7 @@
|
|
|
FROM (SELECT t1.*,
|
|
|
c.name customerName,
|
|
|
us.nick_name salesmanName,
|
|
|
+ us.user_id salesmanId,
|
|
|
(SELECT IFNULL(SUM(IFNULL(cc.money_cny, IFNULL(cc.money, 0) * IFNULL(arw.rate, 1))), 0)
|
|
|
FROM claim_contract cc
|
|
|
left join claim c on cc.claim_id = c.id
|
|
@@ -30,32 +31,31 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="getHeadStatistic" resultType="java.util.Map">
|
|
|
- SELECT
|
|
|
- IFNULL( SUM( t1.amountCNY ), 0 ) AS sumAmount,
|
|
|
- IFNULL( SUM( sumClaimMoney ), 0 ) AS sumClaimMoney,
|
|
|
- count( 1 ) AS `count`,
|
|
|
- GROUP_CONCAT( DISTINCT t1.buy_corporation_id ) AS customerList
|
|
|
- FROM
|
|
|
- (SELECT t1.*,
|
|
|
- IFNULL(t1.amount, 0) * IFNULL(t1.rate, 0) AS amountCNY,
|
|
|
- CASE
|
|
|
- WHEN ( IFNULL( t1.amount, 0 ) * IFNULL( t1.rate, 0 ) - t1.sumClaimMoney ) <= 0 THEN
|
|
|
- 20
|
|
|
- WHEN t1.sumClaimMoney = 0 THEN
|
|
|
- 0
|
|
|
- ELSE 10
|
|
|
- END AS refundStatusNew
|
|
|
- FROM (SELECT t1.*,
|
|
|
- (SELECT IFNULL(SUM(IFNULL(cc.money, 0) * IFNULL(arw.rate, 1)), 0)
|
|
|
- FROM claim_contract cc
|
|
|
- left join claim c on cc.claim_id = c.id
|
|
|
- LEFT JOIN bytesailing_account.account_running_water arw on c.business_id = arw.id
|
|
|
- WHERE cc.contract_id = t1.id) AS sumClaimMoney,
|
|
|
- c.name customerName,
|
|
|
- us.nick_name salesmanName
|
|
|
- FROM contract t1
|
|
|
- left join bytesailing_customer.customer c on t1.buy_corporation_id = c.id
|
|
|
- left join bytesailing_base.sys_user us on c.user_id = us.user_id) t1) t1
|
|
|
+ SELECT IFNULL(SUM(t1.amountCNY), 0) AS sumAmount,
|
|
|
+ IFNULL(SUM(sumClaimMoney), 0) AS sumClaimMoney,
|
|
|
+ count(1) AS `count`,
|
|
|
+ IFNULL(GROUP_CONCAT(DISTINCT t1.buy_corporation_id ), "") AS customerList
|
|
|
+ FROM (SELECT t1.*,
|
|
|
+ IFNULL(t1.amount, 0) * IFNULL(t1.rate, 0) AS amountCNY,
|
|
|
+ CASE
|
|
|
+ WHEN (IFNULL(t1.amount, 0) * IFNULL(t1.rate, 0) - t1.sumClaimMoney) <= 0 THEN
|
|
|
+ 20
|
|
|
+ WHEN t1.sumClaimMoney = 0 THEN
|
|
|
+ 0
|
|
|
+ ELSE 10
|
|
|
+ END AS refundStatusNew
|
|
|
+ FROM (SELECT t1.*,
|
|
|
+ (SELECT IFNULL(SUM(IFNULL(cc.money, 0) * IFNULL(arw.rate, 1)), 0)
|
|
|
+ FROM claim_contract cc
|
|
|
+ left join claim c on cc.claim_id = c.id
|
|
|
+ LEFT JOIN bytesailing_account.account_running_water arw on c.business_id = arw.id
|
|
|
+ WHERE cc.contract_id = t1.id) AS sumClaimMoney,
|
|
|
+ c.name customerName,
|
|
|
+ us.nick_name salesmanName,
|
|
|
+ us.user_id salesmanId
|
|
|
+ FROM contract t1
|
|
|
+ left join bytesailing_customer.customer c on t1.buy_corporation_id = c.id
|
|
|
+ left join bytesailing_base.sys_user us on c.user_id = us.user_id) t1) t1
|
|
|
${ew.customSqlSegment}
|
|
|
</select>
|
|
|
|