platformx-business-finance-biz/src/main/resources/mapper/ContractMapper.xml
@@ -338,6 +338,7 @@
                     and c.del_flag = '0'
                     and bc.del_flag = '0'
                     and bc.area_id = b.area_id
                     AND YEAR( c.sign_date ) = #{queryDTO.year}
                     and party_b_id IN
                     <foreach collection="compIds" item="id" open="(" close=")" separator=",">
                        #{id}
@@ -357,6 +358,7 @@
                        and c.del_flag = '0'
                        and bc.del_flag = '0'
                        and bc.area_id = b.area_id
                        AND YEAR( c.sign_date ) = #{queryDTO.year}
                        and party_b_id IN
                        <foreach collection="compIds" item="id" open="(" close=")" separator=",">
                           #{id}
@@ -376,6 +378,7 @@
                        and c.del_flag = '0'
                        and bc.del_flag = '0'
                        and bc.area_id = b.area_id
                        AND YEAR( c.sign_date ) = #{queryDTO.year}
                        and party_b_id IN
                        <foreach collection="compIds" item="id" open="(" close=")" separator=",">
                           #{id}
@@ -395,6 +398,7 @@
                     and c.del_flag = '0'
                     and bc.del_flag = '0'
                     and bc.area_id = b.area_id
                     AND YEAR( c.sign_date ) = #{queryDTO.year}
                     and party_b_id IN
                     <foreach collection="compIds" item="id" open="(" close=")" separator=",">
                        #{id}
@@ -414,6 +418,7 @@
      and c.del_flag = '0'
      and bc.del_flag = '0'
      and bc.area_id = b.area_id
      AND YEAR( c.sign_date ) = #{queryDTO.year}
      and party_b_id IN
      <foreach collection="compIds" item="id" open="(" close=")" separator=",">
         #{id}
@@ -425,7 +430,8 @@
         contract c
            JOIN business_customer b ON c.party_a_id = b.id
      WHERE
         b.area_id IS NOT NULL
      c.del_flag='0'
      AND b.area_id IS NOT NULL
      AND YEAR ( sign_date ) = #{queryDTO.year}
      GROUP BY
         b.area_id
@@ -445,6 +451,7 @@
      where
      c1.del_flag = '0'
      and c1.industry_code = c.industry_code
      AND YEAR( sign_date ) = #{queryDTO.year}
      and party_b_id IN
      <foreach collection="compIds" item="id" open="(" close=")" separator=",">
         #{id}
@@ -462,6 +469,7 @@
      where
      c1.del_flag = '0'
      and c1.industry_code = c.industry_code
      AND YEAR( sign_date ) = #{queryDTO.year}
      and party_b_id IN
      <foreach collection="compIds" item="id" open="(" close=")" separator=",">
         #{id}
@@ -479,6 +487,7 @@
      where
      c1.del_flag = '0'
      and c1.industry_code = c.industry_code
      AND YEAR( sign_date ) = #{queryDTO.year}
      and party_b_id IN
      <foreach collection="compIds" item="id" open="(" close=")" separator=",">
         #{id}
@@ -496,6 +505,7 @@
      where
      c1.del_flag = '0'
      and c1.industry_code = c.industry_code
      AND YEAR( sign_date ) = #{queryDTO.year}
      and party_b_id IN
      <foreach collection="compIds" item="id" open="(" close=")" separator=",">
         #{id}
@@ -513,6 +523,7 @@
      where
            c1.del_flag = '0'
      and c1.industry_code = c.industry_code
      AND YEAR( sign_date ) = #{queryDTO.year}
      and party_b_id IN
      <foreach collection="compIds" item="id" open="(" close=")" separator=",">
         #{id}
@@ -523,7 +534,8 @@
      FROM
      contract c
      where
      c.industry_code  is not null
      c.del_flag='0'
      AND c.industry_code  is not null
      AND YEAR ( sign_date ) = #{queryDTO.year}
      GROUP BY
      c.industry_code
@@ -545,6 +557,7 @@
      and c.del_flag = '0'
      and bc.del_flag = '0'
      and bc.class_id = b.class_id
      AND YEAR( c.sign_date ) = #{queryDTO.year}
      and party_b_id IN
      <foreach collection="compIds" item="id" open="(" close=")" separator=",">
         #{id}
@@ -564,6 +577,7 @@
      and c.del_flag = '0'
      and bc.del_flag = '0'
      and bc.class_id = b.class_id
      AND YEAR( c.sign_date ) = #{queryDTO.year}
      and party_b_id IN
      <foreach collection="compIds" item="id" open="(" close=")" separator=",">
         #{id}
@@ -583,6 +597,7 @@
      and c.del_flag = '0'
      and bc.del_flag = '0'
      and bc.class_id = b.class_id
      AND YEAR( c.sign_date ) = #{queryDTO.year}
      and party_b_id IN
      <foreach collection="compIds" item="id" open="(" close=")" separator=",">
         #{id}
@@ -602,6 +617,7 @@
      and c.del_flag = '0'
      and bc.del_flag = '0'
      and bc.class_id = b.class_id
      AND YEAR( c.sign_date ) = #{queryDTO.year}
      and party_b_id IN
      <foreach collection="compIds" item="id" open="(" close=")" separator=",">
         #{id}
@@ -621,6 +637,7 @@
      and c.del_flag = '0'
      and bc.del_flag = '0'
      and bc.class_id = b.class_id
      AND YEAR( c.sign_date ) = #{queryDTO.year}
      and party_b_id IN
      <foreach collection="compIds" item="id" open="(" close=")" separator=",">
         #{id}
@@ -632,7 +649,8 @@
      contract c
      JOIN business_customer b ON c.party_a_id = b.id
      WHERE
      b.class_id IS NOT NULL
      c.del_flag='0'
      AND b.class_id IS NOT NULL
      AND YEAR ( sign_date ) = #{queryDTO.year}
      GROUP BY
      b.class_id
@@ -655,6 +673,7 @@
      and c.del_flag = '0'
      and bc.del_flag = '0'
      and bc.export_service_attr = b.export_service_attr
      AND YEAR( c.sign_date ) = #{queryDTO.year}
      and party_b_id IN
      <foreach collection="compIds" item="id" open="(" close=")" separator=",">
         #{id}
@@ -674,6 +693,7 @@
      and c.del_flag = '0'
      and bc.del_flag = '0'
      and bc.export_service_attr = b.export_service_attr
      AND YEAR( c.sign_date ) = #{queryDTO.year}
      and party_b_id IN
      <foreach collection="compIds" item="id" open="(" close=")" separator=",">
         #{id}
@@ -693,6 +713,7 @@
      and c.del_flag = '0'
      and bc.del_flag = '0'
      and bc.export_service_attr = b.export_service_attr
      AND YEAR( c.sign_date ) = #{queryDTO.year}
      and party_b_id IN
      <foreach collection="compIds" item="id" open="(" close=")" separator=",">
         #{id}
@@ -712,6 +733,7 @@
      and c.del_flag = '0'
      and bc.del_flag = '0'
      and bc.export_service_attr = b.export_service_attr
      AND YEAR( c.sign_date ) = #{queryDTO.year}
      and party_b_id IN
      <foreach collection="compIds" item="id" open="(" close=")" separator=",">
         #{id}
@@ -731,6 +753,7 @@
      and c.del_flag = '0'
      and bc.del_flag = '0'
      and bc.export_service_attr = b.export_service_attr
      AND YEAR( c.sign_date ) = #{queryDTO.year}
      and party_b_id IN
      <foreach collection="compIds" item="id" open="(" close=")" separator=",">
         #{id}
@@ -742,7 +765,8 @@
      contract c
      JOIN business_customer b ON c.party_a_id = b.id
      WHERE
      b.export_service_attr IS NOT NULL
      c.del_flag='0'
      AND b.export_service_attr IS NOT NULL
      AND YEAR ( sign_date ) = #{queryDTO.year}
      GROUP BY
      b.export_service_attr
@@ -762,6 +786,7 @@
      WHERE
            ct.del_flag = '0'
      and  ct.supply_attribute = c.supply_attribute
      AND YEAR ( sign_date ) = #{queryDTO.year}
      and ct.party_b_id IN
      <foreach collection="compIds" item="id" open="(" close=")" separator=",">
         #{id}
@@ -779,6 +804,7 @@
      WHERE
      ct.del_flag = '0'
      and  ct.supply_attribute = c.supply_attribute
      AND YEAR ( sign_date ) = #{queryDTO.year}
      and ct.party_b_id IN
      <foreach collection="compIds" item="id" open="(" close=")" separator=",">
         #{id}
@@ -796,6 +822,7 @@
      WHERE
      ct.del_flag = '0'
      and  ct.supply_attribute = c.supply_attribute
      AND YEAR ( sign_date ) = #{queryDTO.year}
      and ct.party_b_id IN
      <foreach collection="compIds" item="id" open="(" close=")" separator=",">
         #{id}
@@ -813,6 +840,7 @@
      WHERE
      ct.del_flag = '0'
      and  ct.supply_attribute = c.supply_attribute
      AND YEAR ( sign_date ) = #{queryDTO.year}
      and ct.party_b_id IN
      <foreach collection="compIds" item="id" open="(" close=")" separator=",">
         #{id}
@@ -830,6 +858,7 @@
      WHERE
      ct.del_flag = '0'
      and  ct.supply_attribute = c.supply_attribute
      AND YEAR ( sign_date ) = #{queryDTO.year}
      and ct.party_b_id IN
      <foreach collection="compIds" item="id" open="(" close=")" separator=",">
         #{id}
@@ -885,7 +914,9 @@
            DATE_FORMAT(sign_date, '%Y-%m') AS stat_month,
            SUM(amount) AS total_amount
         FROM contract
         WHERE YEAR(sign_date) = #{queryDTO.year}
         WHERE
            del_flag='0'
            AND YEAR(sign_date) = #{queryDTO.year}
             AND party_b_id = #{compId}
         GROUP BY DATE_FORMAT(sign_date, '%Y-%m')
      ) curr ON m.stat_month = curr.stat_month
@@ -895,7 +926,8 @@
            MONTH(sign_date) AS month_num,
            SUM(amount) AS total_amount
         FROM contract
         WHERE YEAR(sign_date) = YEAR(CURDATE())
         WHERE del_flag='0'
         AND YEAR(sign_date) = YEAR(CURDATE())
           AND party_b_id = #{compId}
         GROUP BY DATE_FORMAT(sign_date, '%Y-%m'), MONTH(sign_date)
      ) prev ON m.month_num = prev.month_num + 1
@@ -904,7 +936,8 @@
            MONTH(sign_date) AS month_num,
            SUM(amount) AS total_amount
         FROM contract
         WHERE YEAR(sign_date) = YEAR(CURDATE()) - 1
         WHERE del_flag='0'
         AND YEAR(sign_date) = YEAR(CURDATE()) - 1
         AND party_b_id = #{compId}
         GROUP BY MONTH(sign_date)
      ) last_year ON m.month_num = last_year.month_num
@@ -927,6 +960,7 @@
      and c.del_flag = '0'
      and bc.del_flag = '0'
      and bc.sales_model = b.sales_model
      AND YEAR( c.sign_date ) = #{queryDTO.year}
      and party_b_id IN
      <foreach collection="compIds" item="id" open="(" close=")" separator=",">
         #{id}
@@ -946,6 +980,7 @@
      and c.del_flag = '0'
      and bc.del_flag = '0'
      and bc.sales_model = b.sales_model
      AND YEAR( c.sign_date ) = #{queryDTO.year}
      and party_b_id IN
      <foreach collection="compIds" item="id" open="(" close=")" separator=",">
         #{id}
@@ -965,6 +1000,7 @@
      and c.del_flag = '0'
      and bc.del_flag = '0'
      and bc.sales_model = b.sales_model
      AND YEAR( c.sign_date ) = #{queryDTO.year}
      and party_b_id IN
      <foreach collection="compIds" item="id" open="(" close=")" separator=",">
         #{id}
@@ -984,6 +1020,7 @@
      and c.del_flag = '0'
      and bc.del_flag = '0'
      and bc.sales_model = b.sales_model
      AND YEAR( c.sign_date ) = #{queryDTO.year}
      and party_b_id IN
      <foreach collection="compIds" item="id" open="(" close=")" separator=",">
         #{id}
@@ -1003,6 +1040,7 @@
      and c.del_flag = '0'
      and bc.del_flag = '0'
      and bc.sales_model = b.sales_model
      AND YEAR( c.sign_date ) = #{queryDTO.year}
      and party_b_id IN
      <foreach collection="compIds" item="id" open="(" close=")" separator=",">
         #{id}
@@ -1014,7 +1052,8 @@
      contract c
      JOIN business_customer b ON c.party_a_id = b.id
      WHERE
      b.sales_model IS NOT NULL
      c.del_flag='0'
      AND b.sales_model IS NOT NULL
      AND YEAR ( sign_date ) = #{queryDTO.year}
      GROUP BY
      b.sales_model