Przeglądaj źródła

Merge branch 'test' into dev

caozj 1 rok temu
rodzic
commit
9ce972cb80

+ 11 - 11
hx-sale/src/main/resources/mapper/contract/ContractMapper.xml

@@ -243,19 +243,19 @@
     <select id="getCustomerMoney" resultType="com.fjhx.sale.entity.contract.vo.ContractVo">
         SELECT
             t1.sell_corporation_id AS sellCorporationId,
-            IFNULL( SUM( t2.amount ), 0 ) AS sumAmount,
-            IFNULL( SUM( t2.quantity ), 0 ) AS sumQuantity,
-        (
-            SELECT
-                IFNULL( SUM( IFNULL( cc.money, 0 ) * IFNULL( cc.rate, 1 )), 0 )
-            FROM
-                claim_contract cc
-            WHERE
-                FIND_IN_SET( cc.contract_id, GROUP_CONCAT( t1.id ) )
-        ) AS sumClaimMoney
+            IFNULL( SUM( t2.amount * t1.rate ), 0 ) AS sumAmount,
+            IFNULL( count(1) ,0 ) AS sumQuantity,
+            (
+                SELECT
+                    IFNULL( SUM( IFNULL( cc.money, 0 ) * IFNULL( cc.rate, 1 )), 0 )
+                FROM
+                    claim_contract cc
+                WHERE
+                    FIND_IN_SET( cc.contract_id, GROUP_CONCAT( t1.id ) )
+            ) AS sumClaimMoney
         FROM
             contract t1
-        LEFT JOIN contract_product t2 ON t1.id = t2.contract_id
+                LEFT JOIN contract_product t2 ON t1.id = t2.contract_id
         WHERE
             t1.is_show != 1
             AND t1.is_change = 0