Browse Source

导出优化

sugangqiang 2 năm trước cách đây
mục cha
commit
f691b9c2a4
1 tập tin đã thay đổi với 14 bổ sung12 xóa
  1. 14 12
      app/common/api/VerifyApi.php

+ 14 - 12
app/common/api/VerifyApi.php

@@ -408,13 +408,13 @@ class VerifyApi {
                     }
                     break;
                 case 6:
-                    $where[] = ["ti.checkState", ">=", TalentState::REVERIFY_PASS];
+                    $where[] = ["tl.state", ">=", TalentState::REVERIFY_PASS];
                     if ($params["checkState"]) {
-                        $where[] = ["ti.checkState", "=", $params["checkState"]];
+                        $where[] = ["tl.state", "=", $params["checkState"]];
                     }
                     break;
                 case 7:
-                    $where[] = ["ti.checkState", "=", TalentState::CERTIFICATED];
+                    $where[] = ["tl.state", "=", TalentState::CERTIFICATED];
                     break;
             }
             $count = Talent::alias("ti")
@@ -637,38 +637,39 @@ class VerifyApi {
                             if ($mainIds) {
                                 $where[] = ["ti.id", "in", $mainIds];
                             } else {
-                                $where[] = ["ti.checkState", "=", TalentState::FST_VERIFY_PASS];
+                                $where[] = ["tl.state", "=", TalentState::FST_VERIFY_PASS];
                                 $where[] = ["ti.pass_dept_check", "=", 0];
                             }
                             break;
                         default:
-                            $where[] = ["ti.checkState", "=", TalentState::FST_VERIFY_PASS];
+                            $where[] = ["tl.state", "=", TalentState::FST_VERIFY_PASS];
                             $where[] = ["ti.pass_dept_check", "=", 0];
                             break;
                     }
                     break;
                 case 5:
-                    $whereRaw = sprintf("(ti.checkState in (14,15,16)) or (ti.checkState=12 and ti.pass_dept_check=0) or (ti.checkState=10 and ti.pass_dept_check=1) or (ti.checkState=10 and (tc.companyIds is null or tc.companyIds = ''))");
+                    $whereRaw = sprintf("(tl.state in (14,15,16)) or (tl.state=12 and ti.pass_dept_check=0) or (tl.state=10 and ti.pass_dept_check=1) or (tl.state=10 and (tc.companyIds is null or tc.companyIds = ''))");
                     switch ($params["checkState"]) {
                         case 1:
-                            $where[] = ["ti.checkState", "in", [TalentState::FST_VERIFY_PASS, TalentState::DEPT_VERIFY_PASS]];
+                            $where[] = ["tl.state", "in", [TalentState::FST_VERIFY_PASS, TalentState::DEPT_VERIFY_PASS]];
                             break;
                         case -1:
-                            $where[] = ["ti.checkState", "=", TalentState::REVERIFY_FAIL];
+                            $where[] = ["tl.state", "=", TalentState::REVERIFY_FAIL];
                             break;
                     }
                     break;
                 case 6:
-                    $where[] = ["ti.checkState", ">=", TalentState::REVERIFY_PASS];
+                    $where[] = ["tl.state", ">=", TalentState::REVERIFY_PASS];
                     if ($params["checkState"]) {
-                        $where[] = ["ti.checkState", "=", $params["checkState"]];
+                        $where[] = ["tl.state", "=", $params["checkState"]];
                     }
                     break;
                 case 7:
-                    $where[] = ["ti.checkState", "=", TalentState::CERTIFICATED];
+                    $where[] = ["tl.state", "=", TalentState::CERTIFICATED];
                     break;
             }
         } else {
+            $whereRaw = "tl.state is not null";
             $where[] = ["ti.delete", "=", 0];
         }
         $fields[] = "ti.pass_dept_check";
@@ -705,9 +706,10 @@ class VerifyApi {
                             ->leftJoin("(select description,mainId,last_state,new_state,state,createTime from new_talent_checklog where md5(concat(createTime,mainId,`type`)) in (select md5(concat(max(createTime),mainId,`type`)) from `new_talent_checklog` where `type`=1 and `step` is null and active=1 and typeFileId is null group by mainId,`type`)) tl", "`tl`.`mainId`=ti.id")
                             //->leftJoin("new_talent_checklog tl", "tl.mainId=ti.id and tl.id=(select id from new_talent_checklog where mainId=ti.id and `step` is null and active=1 and typeFileId is null order by createTime desc limit 1)")
                             ->where($where)
+                            ->where($whereRaw)
                             ->select()->toArray();
         }
-        $un_common_location = Db::table("un_common_location")->column('name','code');
+        $un_common_location = Db::table("un_common_location")->column('name', 'code');
         foreach ($list as &$item) {
             $item["card_type"] = $cardTypes[$item["card_type"]];
             $item["industryFieldNew"] = $industry_fields[$item["industryFieldNew"]];