|
@@ -159,14 +159,14 @@ class VerifyApi {
|
|
|
$count = Talent::alias("ti")
|
|
|
->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
|
|
|
->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
|
|
|
- ->leftJoin("(select mainId,last_state,new_state,state,createTime from new_talent_checklog where createTime in (select max(createTime) 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("(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")
|
|
|
//->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)
|
|
|
->whereRaw("find_in_set(:companyId,companyIds)", ["companyId" => $companyId])->count();
|
|
|
$list = Talent::alias("ti")
|
|
|
->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
|
|
|
->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
|
|
|
- ->leftJoin("(select mainId,last_state,new_state,state,createTime from new_talent_checklog where createTime in (select max(createTime) 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("(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")
|
|
|
//->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)
|
|
|
->whereRaw("find_in_set(:companyId,companyIds)", ["companyId" => $companyId])
|
|
@@ -352,13 +352,13 @@ class VerifyApi {
|
|
|
$count = Talent::alias("ti")
|
|
|
->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
|
|
|
->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
|
|
|
- ->leftJoin("(select mainId,last_state,new_state,state,createTime from new_talent_checklog where createTime in (select max(createTime) 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("(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")
|
|
|
//->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)")
|
|
|
->whereRaw($whereRaw)->where($where)->count();
|
|
|
$list = Talent::alias("ti")
|
|
|
->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
|
|
|
->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
|
|
|
- ->leftJoin("(select mainId,last_state,new_state,state,createTime from new_talent_checklog where createTime in (select max(createTime) 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("(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")
|
|
|
//->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)")
|
|
|
->whereRaw($whereRaw)
|
|
|
->where($where)
|
|
@@ -414,12 +414,12 @@ class VerifyApi {
|
|
|
}
|
|
|
$count = Talent::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 createTime in (select max(createTime) 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("(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")
|
|
|
//->leftJoin("(select mainId,last_state,new_state,state,createTime,row_number() over (partition by mainId order by createTime desc) as rowIndex from `new_talent_checklog` where `type`=1 and `step` is null and active=1 and typeFileId is null) tl", "tl.mainId=ti.id and tl.rowIndex=1")
|
|
|
->where($where)->count();
|
|
|
$list = Talent::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 createTime in (select max(createTime) 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("(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")
|
|
|
//->leftJoin("(select mainId,last_state,new_state,state,createTime,row_number() over (partition by mainId order by createTime desc) as rowIndex from `new_talent_checklog` where `type`=1 and `step` is null and active=1 and typeFileId is null) tl", "tl.mainId=ti.id and tl.rowIndex=1")
|
|
|
->where($where)->limit($offset, $limit)->order("ti.createTime " . $order)->field("ti.*,tl.last_state as 'lastState',tl.state as 'realState',e.name as enterprise_name,e.type as enterprise_type,enterpriseTag")->select()->toArray();
|
|
|
}
|
|
@@ -530,7 +530,7 @@ class VerifyApi {
|
|
|
->field($fields)
|
|
|
->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
|
|
|
->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
|
|
|
- ->leftJoin("(select description,mainId,last_state,new_state,state,createTime from new_talent_checklog where createTime in (select max(createTime) 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("(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)")
|
|
|
->whereRaw($where)
|
|
|
->select()->toArray();
|