Prechádzať zdrojové kódy

中台 律师对账

qxy 3 mesiacov pred
rodič
commit
7a6f1fc3f1

+ 7 - 7
alien-entity/src/main/resources/mapper/LawFirmMapper.xml

@@ -73,7 +73,6 @@
                     COALESCE(SUM(lco.order_amount), 0) as total_amount
                 FROM lawyer_consultation_order lco
                 INNER JOIN lawyer_user lu ON lco.lawyer_user_id = lu.id
-                AND lu.delete_flag = 0
                 LEFT JOIN law_firm lf ON lf.id = lu.firm_id
                     AND lf.delete_flag = 0
                     <if test="startDate != null">
@@ -93,7 +92,6 @@
                     COALESCE(SUM(lco.order_amount), 0) as total_amount
                 FROM lawyer_consultation_order lco
                 INNER JOIN lawyer_user lu ON lco.lawyer_user_id = lu.id
-                AND lu.delete_flag = 0
                 LEFT JOIN law_firm lf ON lf.id = lu.firm_id
                 AND lf.delete_flag = 0
                 WHERE
@@ -138,13 +136,13 @@
         LEFT JOIN lawyer_consultation_order lco ON lco.lawyer_user_id = lu.id
             AND lco.delete_flag = 0
             AND lco.order_status = 3
+        WHERE lf.delete_flag = 0
             <if test="startDate != null">
                 AND lco.order_time &gt;= CONCAT(#{startDate}, ' 00:00:00')
             </if>
             <if test="endDate != null">
                 AND lco.order_time &lt;= CONCAT(#{endDate}, ' 23:59:59')
             </if>
-        WHERE lf.delete_flag = 0
         <if test="firmName != null and firmName != ''">
             AND lf.firm_name LIKE CONCAT('%', #{firmName}, '%')
         </if>
@@ -201,16 +199,18 @@
         LEFT JOIN lawyer_consultation_order lco ON lco.lawyer_user_id = lu.id
             AND lco.delete_flag = 0
             AND lco.order_status = 3
+        <where>
+            1=1
             <if test="startDate != null">
                 AND lco.order_time &gt;= CONCAT(#{startDate}, ' 00:00:00')
             </if>
             <if test="endDate != null">
                 AND lco.order_time &lt;= CONCAT(#{endDate}, ' 23:59:59')
             </if>
-        WHERE lu.delete_flag = 0
-        <if test="lawyerName != null and lawyerName != ''">
-            AND lu.name LIKE CONCAT('%', #{lawyerName}, '%')
-        </if>
+            <if test="lawyerName != null and lawyerName != ''">
+                AND lu.name LIKE CONCAT('%', #{lawyerName}, '%')
+            </if>
+        </where>
         GROUP BY lu.id, lu.name, lu.head_img, lu.lawyer_certificate_no, lf.id, lf.firm_name
         ORDER BY COALESCE(SUM(lco.order_amount), 0) DESC
     </select>