FengChaoYu 8 місяців тому
батько
коміт
dbcd857c2b

+ 2 - 27
mall-server-api/src/main/resources/mapper/CommonMapper.xml

@@ -1183,19 +1183,7 @@
             ${ex.selected}
         FROM
             settle_daily_remaine_buckle a
-            JOIN (
-                SELECT
-                    u.id_card,
-                    wb.worker_number,
-                    u.nick_name
-                FROM
-                    user u, websit_user wb
-                WHERE
-                    u.company_wechat_id = wb.company_wechat_id
-                    AND u.user_id = wb.user_id
-                    AND u.apply_type = 'WORKER'
-                    AND wb.examine_status = 'OK'
-            ) aa ON a.worker_number = aa.worker_number
+            JOIN user aa on a.worker_number = aa.worker_number AND aa.apply_type = 'WORKER'
             JOIN settle_daily_bank_account b ON aa.id_card = b.idcard
         ${ex.query}
         GROUP BY a.company_wechat_id, a.idcard
@@ -1231,20 +1219,7 @@
         FROM
             settle_daily_import_summary_item  a
             LEFT JOIN settle_daily_reduce_cost sdrc  on a.dispatch_order_no = sdrc.dispatch_order_no
-            LEFT JOIN (
-                SELECT
-                    u.id_card,
-                    wb.worker_number,
-                    u.nick_name
-                FROM
-                    user u, websit_user wb
-                WHERE
-                    u.company_wechat_id = wb.company_wechat_id
-                    AND u.user_id = wb.user_id
-                    AND u.apply_type = 'WORKER'
-                    AND wb.examine_status = 'OK'
-                GROUP BY wb.worker_number
-            ) aa on a.worker_number = aa.worker_number
+            LEFT JOIN user aa on a.worker_number = aa.worker_number AND aa.apply_type = 'WORKER'
             LEFT JOIN settle_daily_bank_account b ON aa.id_card = b.idcard
             LEFT JOIN settle_daily_issue_summary_record c ON c.id  = a.issue_salary_id
         ${ex.query}

+ 4 - 52
mall-server-api/src/main/resources/mapper/DailyMapper.xml

@@ -128,19 +128,7 @@
     <select id="queryIssueSalaryMonthBankCardInfo"
             resultType="com.gree.mall.manager.bean.settle.repair.DailyWokerBankCardMonthBean">
         SELECT * FROM settle_daily_issue_summary_month_record a
-        JOIN (
-            SELECT
-                u.id_card,
-                wb.worker_number,
-                u.nick_name
-            FROM
-                user u, websit_user wb
-            WHERE
-                u.company_wechat_id = wb.company_wechat_id
-                AND u.user_id = wb.user_id
-                AND u.apply_type = 'WORKER'
-                AND wb.examine_status = 'OK'
-        ) aa ON a.service_number = aa.worker_number
+        JOIN user aa on a.service_number = aa.worker_number AND aa.apply_type = 'WORKER'
         JOIN settle_daily_bank_account b ON aa.id_card = b.idcard
         WHERE
         a.company_wechat_id = #{companyWechatId}
@@ -158,19 +146,7 @@
 
     <select id="queryIssueSalaryAndBankCardInfo" resultType="com.gree.mall.manager.bean.settle.repair.DailyWorkerBankCardBean">
         select  a.*,b.* from  settle_daily_issue_summary_record a
-        JOIN (
-            SELECT
-                u.id_card,
-                wb.worker_number,
-                u.nick_name
-            FROM
-                user u, websit_user wb
-            WHERE
-                u.company_wechat_id = wb.company_wechat_id
-                AND u.user_id = wb.user_id
-                AND u.apply_type = 'WORKER'
-                AND wb.examine_status = 'OK'
-        ) aa ON a.service_number = aa.worker_number
+        JOIN user aa on a.service_number = aa.worker_number AND aa.apply_type = 'WORKER'
         join settle_daily_bank_account b  on  aa.id_card = b.idcard
         where
             a.company_wechat_id = #{companyWechatId}
@@ -289,19 +265,7 @@
         select
         a.*,b.bank_account ,b.bank_account_name,deposit_bank,c.issue_time ,c.issue_by,c.status as issueStatus
         from settle_daily_import_summary_item a
-        left JOIN (
-            SELECT
-                u.id_card,
-                wb.worker_number,
-                u.nick_name
-            FROM
-                user u, websit_user wb
-            WHERE
-                u.company_wechat_id = wb.company_wechat_id
-                AND u.user_id = wb.user_id
-                AND u.apply_type = 'WORKER'
-                AND wb.examine_status = 'OK'
-        ) aa ON a.worker_number = aa.worker_number
+        left JOIN user aa on a.worker_number = aa.worker_number AND aa.apply_type = 'WORKER'
         left join settle_daily_bank_account b on aa.id_card = b.idcard AND a.websit_number = b.websit_id
         left join settle_daily_issue_summary_record c  on c.id  = a.issue_salary_id
 
@@ -489,19 +453,7 @@
         settle_daily_import_summary_item a
         left join
         settle_daily_issue_summary_record b on a.issue_salary_id =b.id
-        left join (
-            SELECT
-                u.id_card,
-                wb.worker_number,
-                u.nick_name
-            FROM
-                user u, websit_user wb
-            WHERE
-                u.company_wechat_id = wb.company_wechat_id
-                AND u.user_id = wb.user_id
-                AND u.apply_type = 'WORKER'
-                AND wb.examine_status = 'OK'
-        ) aa on a.worker_number = aa.worker_number
+        left join user aa on a.worker_number = aa.worker_number AND aa.apply_type = 'WORKER'
         left join settle_daily_bank_account c  on  aa.id_card = c.idcard
         <where>
             <if test="companyWechatIds != null and companyWechatIds.size > 0">