|
@@ -21,68 +21,80 @@ class Resign extends Base
|
|
|
public function list(){
|
|
|
$page = isset($this->post['page']) && $this->post['page'] !=="" ? intval($this->post['page']):"1";
|
|
|
$size = isset($this->post['size']) && $this->post['size'] !=="" ? intval($this->post['size']):"10";
|
|
|
- $where =[['is_del',"=",0]];
|
|
|
+ $where =[['p.is_del',"=",0]];
|
|
|
$bkcode = isset($this->post['bk_code']) && $this->post['bk_code']!="" ? trim($this->post['bk_code']):"";
|
|
|
if($bkcode!=""){
|
|
|
- //$where['bk_code'] = $bk_code;
|
|
|
- $where[]=['bk_code',"like","%{$bkcode}%"];
|
|
|
+ //$where['p.bk_code'] = $bk_code;
|
|
|
+ $where[]=['p.bk_code',"like","%{$bkcode}%"];
|
|
|
}
|
|
|
$good_code = isset($this->post['good_code']) && $this->post['good_code']!="" ? trim($this->post['good_code']):"";
|
|
|
if($good_code!=""){
|
|
|
- // $where['good_code'] = $good_code;
|
|
|
- $where[]=['good_code',"like","%{$good_code}%"];
|
|
|
+ // $where['p.good_code'] = $good_code;
|
|
|
+ $where[]=['p.good_code',"like","%{$good_code}%"];
|
|
|
}
|
|
|
|
|
|
$good_type_code = isset($this->post['good_type_code']) && $this->post['good_type_code']!="" ? trim($this->post['good_type_code']):"";
|
|
|
if($good_type_code!=""){
|
|
|
- // $where['good_type_code'] = $good_type_code;
|
|
|
- $where[]=['good_type_code',"like","%{$good_type_code}%"];
|
|
|
+ // $where['p.good_type_code'] = $good_type_code;
|
|
|
+ $where[]=['p.good_type_code',"like","%{$good_type_code}%"];
|
|
|
}
|
|
|
$wsm_code = isset($this->post['wsm_code']) && $this->post['wsm_code']!="" ? trim($this->post['wsm_code']):"";
|
|
|
if($wsm_code!=""){
|
|
|
- //$where['wsm_code'] = $wsm_code;
|
|
|
- $where[]=['wsm_code',"=",$wsm_code];
|
|
|
+ //$where['p.wsm_code'] = $wsm_code;
|
|
|
+ $where[]=['p.wsm_code',"=",$wsm_code];
|
|
|
}
|
|
|
$good_name = isset($this->post['good_name']) && $this->post['good_name']!="" ? trim($this->post['good_name']):"";
|
|
|
if($good_name!=""){
|
|
|
- // $where['good_name'] = Db::raw(" like '%{$good_name}%'");
|
|
|
- $where[]=['good_name',"like","%{$good_name}%"];
|
|
|
+ // $where['p.good_name'] = Db::raw(" like '%{$good_name}%'");
|
|
|
+ $where[]=['p.good_name',"like","%{$good_name}%"];
|
|
|
}
|
|
|
|
|
|
$apply_name = isset($this->post['apply_name']) && $this->post['apply_name']!="" ? trim($this->post['apply_name']):"";
|
|
|
if($apply_name!=""){
|
|
|
- // $where['apply_name'] =Db::Raw("like '%{$apply_name}%'");
|
|
|
- $where[]=['apply_name',"like","%{$apply_name}%"];
|
|
|
+ // $where['p.apply_name'] =Db::Raw("like '%{$apply_name}%'");
|
|
|
+ $where[]=['p.apply_name',"like","%{$apply_name}%"];
|
|
|
}
|
|
|
$status = isset($this->post['status']) && $this->post['status']!=="" ? intval($this->post['status']):"";
|
|
|
if($status!==""){
|
|
|
- // $where['status'] = $status;
|
|
|
- $where[]=['status',"=",$status];
|
|
|
+ // $where['p.status'] = $status;
|
|
|
+ $where[]=['p.status',"=",$status];
|
|
|
}
|
|
|
|
|
|
$start = isset($this->post['start']) && $this->post['start']!=="" ? $this->post['start']:"";
|
|
|
if($start!==""){
|
|
|
- //$where['addtime'] = Db::Raw(">= '{$start}'");
|
|
|
- $where[]=['addtime',">=",$start];
|
|
|
+ //$where['p.addtime'] = Db::Raw(">= '{$start}'");
|
|
|
+ $where[]=['p.addtime',">=",$start];
|
|
|
}
|
|
|
$end = isset($this->post['end']) && $this->post['end']!=="" ? $this->post['end']:"";
|
|
|
if($end!==""){
|
|
|
- // $where['addtime'] = Db::Raw("<= '{$end}'");
|
|
|
- $where[]=['addtime',"<=",$end];
|
|
|
+ // $where['p.addtime'] = Db::Raw("<= '{$end}'");
|
|
|
+ $where[]=['p.addtime',"<=",$end];
|
|
|
}
|
|
|
$role=$this->checkRole();
|
|
|
$condition='';
|
|
|
if(!empty($role['write']) && $this->uid!=""){
|
|
|
// $where[]=["a.apply_id","in",$role['write']];
|
|
|
- $condition .="cgderid = {$this->uid} or apply_id in (".implode(',',$role['write']).")";
|
|
|
+ $condition .="p.cgderid = {$this->uid} or p.apply_id in (".implode(',',$role['write']).")";
|
|
|
}
|
|
|
+
|
|
|
+ $company_name = isset($this->post['company_name']) && $this->post['company_name'] !== "" ? trim($this->post['company_name']) : "";
|
|
|
+ if ($company_name !== "") $where[] = ["p.apply_id", 'in', get_company_item_user_by_name($company_name)];
|
|
|
+
|
|
|
// if(!empty($role['platform']) ){
|
|
|
-// $where[]=["platform_id","in",$role['platform']];
|
|
|
+// $where[]=["p.platform_id","in",$role['platform']];
|
|
|
// }
|
|
|
- $count=Db::name("purchease")->where($where)->where($condition)->count();
|
|
|
+ $count=Db::name("purchease")->alias('p')->leftJoin("depart_user u", "u.uid=p.apply_id AND u.is_del=0")->where($where)->where($condition)->count();
|
|
|
$total = ceil($count/$size);
|
|
|
$page = $page >= $total ? $total : $page;
|
|
|
- $list = Db::name("purchease")->where($where)->where($condition)->page($page,$size)->order("addtime desc")->select();
|
|
|
+ $list = Db::name("purchease")
|
|
|
+ ->alias('p')
|
|
|
+ ->field('p.*,u.itemid')
|
|
|
+ ->leftJoin("depart_user u", "u.uid=p.apply_id AND u.is_del=0")
|
|
|
+ ->where($where)
|
|
|
+ ->where($condition)
|
|
|
+ ->page($page,$size)
|
|
|
+ ->order("p.addtime desc")
|
|
|
+ ->cursor();
|
|
|
$data=[];
|
|
|
foreach ($list as $value){
|
|
|
$value['wsm_name']="";
|
|
@@ -100,6 +112,7 @@ class Resign extends Base
|
|
|
$file= basename($value['file_url']);
|
|
|
$value['file_name'] =substr($file,0,strripos($file,"_"));
|
|
|
}
|
|
|
+ $value['company_name'] = implode('/', array_column(GetPart($value['itemid']), 'name'));
|
|
|
$data[]=$value;
|
|
|
}
|
|
|
return app_show(0,"获取成功",["list"=>$data,"count"=>$count]);
|