sugangqiang 1 год назад
Родитель
Сommit
848538be3a
1 измененных файлов с 3 добавлено и 5 удалено
  1. 3 5
      app/enterprise/api/TalentApi.php

+ 3 - 5
app/enterprise/api/TalentApi.php

@@ -220,6 +220,7 @@ class TalentApi {
             if ($talentArrange) {
                 $where[] = ["ti.talent_arrange", "=", $talentArrange];
             }
+            $whereRaw = sprintf("tl.state in (%s,%s) or tl.state >= %s", TalentState::FST_SUBMIT, TalentState::BASE_REJECT, TalentState::SCND_SUBMIT);
             switch ($checkState) {
                 case 1:
                     $where[] = ["tl.state", "=", TalentState::FST_SUBMIT];
@@ -230,15 +231,12 @@ class TalentApi {
                 case 3:
                     $where[] = ["tl.state", ">=", TalentState::SCND_SUBMIT];
                     break;
-                default:
-                    $where[] = ["tl.state", "in", [TalentState::FST_SUBMIT, TalentState::BASE_REJECT]];
-                    $where[] = ["tl.state", ">=", TalentState::SCND_SUBMIT];
             }
-            $count = Talent::where($where)->alias("ti")
+            $count = Talent::where($where)->whereRaw($whereRaw)->alias("ti")
                     ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
                     ->leftJoin("(select 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")
                     ->count();
-            $list = Talent::where($where)->alias("ti")
+            $list = Talent::where($where)->whereRaw($whereRaw)->alias("ti")
                             ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
                             ->leftJoin("(select 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")
                             ->field("ti.*,e.name as enterpriseName,e.type")