ccjgmwz преди 3 години
родител
ревизия
3f3f115c30
променени са 1 файла, в които са добавени 38 реда и са изтрити 26 реда
  1. 38 26
      winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/PaymentManagementMapper.xml

+ 38 - 26
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/PaymentManagementMapper.xml

@@ -5,71 +5,80 @@
     <!-- 获得付款管理总数 -->
     <select id="getCountByCondition" parameterType="Map" resultType="java.lang.Integer">
         SELECT
-        COUNT(id)
-        FROM payment_management
-        WHERE delete_flag = '0'
+        count(a.id)
+        FROM payment_management a
+        left join quality_inspection_management q on q.relation_id = a.relation_id and q.comp_id = a.comp_id and q.delete_flag = 0
+        left join weighing_management w on w.relation_id = a.relation_id and w.comp_id = a.comp_id and w.delete_flag = 0
+        left join common_company c on c.comp_id = a.comp_id and c.delete_flag = 0
+        left join identity_authentication_info i on i.customer_name = a.customer_name
+        and i.customer_phone = a.customer_phone and i.customer_type_flag = 1 and i.delete_flag = 0 and i.cover = 0
+        left join common_company_identity cci on  cci.com_id = a.comp_id  and cci.delete_flag = 0
+        WHERE a.delete_flag = '0'
+        and cci.identity_id = i.id
         <if test="searchType != null and searchType != ''">
+            <if test="searchType == 1">
+                AND a.status='待结算'  and a.approve_status is not null
+            </if>
             <if test="searchType == 2">
-                AND status='待结算'  and( approve_status= ''
-                or approve_status is null)
+                AND a.status='待结算'  and( a.approve_status= ''
+                or a.approve_status is null)
             </if>
             <if test="searchType == 3">
-                AND actual_collectionment-amount_ed_collectionable>0
+                AND a.actual_collectionment-a.amount_ed_collectionable>0
             </if>
             <if test="searchType == 4">
-                AND actual_collectionment-amount_ed_collectionable=0
+                AND a.actual_collectionment-a.amount_ed_collectionable=0
             </if>
             <if test="searchType == 5">
-                AND amount_ing_payable-amount_ed_payable>0
+                AND a.amount_ing_payable-a.amount_ed_payable>0
             </if>
             <if test="searchType == 6">
-                AND amount_ed_payable=amount_ing_payable
+                AND a.amount_ed_payable=a.amount_ing_payable
             </if>
             <if test="searchType == 7">
-                AND (status='已通过'
-                or status='部分付款')
+                AND (a.status='已通过'
+                or a.status='部分付款')
             </if>
         </if>
-        <if test="warehouseName != null and warehouseName != ''">
-            AND warehouse_name= #{warehouseName}
-        </if>
         <if test="managementType != null and managementType != ''">
-            AND management_type = #{managementType}
+            AND a.management_type = #{managementType}
         </if>
         <if test="customerPhone != null and customerPhone != ''">
-            AND customer_phone = #{customerPhone}
+            AND a.customer_phone = #{customerPhone}
+        </if>
+        <if test="warehouseName != null and warehouseName != ''">
+            AND a.warehouse_name= #{warehouseName}
         </if>
         <if test="searchKeyWord != null and searchKeyWord != ''">
-            AND (lower(payment_no) like lower(CONCAT('%',#{searchKeyWord},'%'))
-            OR lower( customer_name) like lower(CONCAT('%',#{searchKeyWord},'%'))
-            OR lower( car_no) like lower(CONCAT('%',#{searchKeyWord},'%')))
+            AND (lower(a.payment_no) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower( a.customer_name) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower( a.car_no) like lower(CONCAT('%',#{searchKeyWord},'%')))
         </if>
         <if test="startDate != null">
-            AND (DATE_FORMAT(create_date,"%Y%m%d") &gt;=
+            AND (DATE_FORMAT(a.create_date,"%Y%m%d") &gt;=
             DATE_FORMAT(#{startDate},"%Y%m%d"))
         </if>
         <if test="endDate != null">
-            AND (DATE_FORMAT(create_date,"%Y%m%d") &lt;=
+            AND (DATE_FORMAT(a.create_date,"%Y%m%d") &lt;=
             DATE_FORMAT(#{endDate},"%Y%m%d"))
         </if>
         <if test="businessKeys != null and businessKeys.size > 0">
             and(
             <foreach collection="businessKeys" item="businessValue" open="(" close=")" separator="or">
-                id = #{businessValue}
+                a.id = #{businessValue}
             </foreach>
             )
         </if>
         <if test="contractNo != null and contractNo != ''and contractNo != '全部合同'">
-            AND contract_no = #{contractNo}
+            AND a.contract_no = #{contractNo}
         </if>
-
         <if test="compId != null and compId != ''">
-            AND comp_id = #{compId}
+            AND a.comp_id = #{compId}
         </if>
         <if test="statusSet != null and statusSet.size > 0">
             or (
             <foreach collection="statusSet" item="statusId" separator="or" open="(" close=")">
-                status_flag =
+                a.status_flag =
                 <if test="statusId != null">
                     #{statusId}
                 </if>
@@ -137,6 +146,9 @@
         WHERE a.delete_flag = '0'
         and cci.identity_id = i.id
         <if test="searchType != null and searchType != ''">
+            <if test="searchType == 1">
+                AND a.status='待结算'  and a.approve_status is not null
+            </if>
             <if test="searchType == 2">
                 AND a.status='待结算'  and( a.approve_status= ''
                 or a.approve_status is null)