update
This commit is contained in:
parent
6c86550745
commit
4a45ea83ef
@ -106,14 +106,14 @@ class DeptController extends BaseAdminController
|
|||||||
if(empty($params['org_id'])){
|
if(empty($params['org_id'])){
|
||||||
return $this->fail('参数错误');
|
return $this->fail('参数错误');
|
||||||
}
|
}
|
||||||
$data = Dept::field('id,name,mobile,status')->where('org_id',$params['org_id'])->select()->toArray();
|
$data = Dept::field('id,name,mobile,status')->where('org_id',$params['org_id'])->where('status',0)->select()->toArray();
|
||||||
return $this->success('请求成功',$data);
|
return $this->success('请求成功',$data);
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取所有部门
|
//获取所有部门
|
||||||
public function getAllDept(): \think\response\Json
|
public function getAllDept(): \think\response\Json
|
||||||
{
|
{
|
||||||
$data = Dept::field('id,name,org_id')->select()->each(function($item){
|
$data = Dept::field('id,name,org_id')->where('status',0)->select()->each(function($item){
|
||||||
$org = Orgs::field('name')->where('id',$item['org_id'])->findOrEmpty();
|
$org = Orgs::field('name')->where('id',$item['org_id'])->findOrEmpty();
|
||||||
$item['org_name'] = $org->isEmpty() ? '' : $org['name'];
|
$item['org_name'] = $org->isEmpty() ? '' : $org['name'];
|
||||||
$item['admin_num'] = Admin::where('dept_id',$item['id'])->count();
|
$item['admin_num'] = Admin::where('dept_id',$item['id'])->count();
|
||||||
|
@ -107,14 +107,14 @@ class JobsController extends BaseAdminController
|
|||||||
if(empty($params['dept_id'])){
|
if(empty($params['dept_id'])){
|
||||||
return $this->fail('参数错误');
|
return $this->fail('参数错误');
|
||||||
}
|
}
|
||||||
$data = Jobs::field('id,name,status,sort,create_time')->where('dept_id',$params['dept_id'])->select()->toArray();
|
$data = Jobs::field('id,name,status,sort,create_time')->where('dept_id',$params['dept_id'])->where('status',0)->select()->toArray();
|
||||||
return $this->success('请求成功',$data);
|
return $this->success('请求成功',$data);
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取所有岗位
|
//获取所有岗位
|
||||||
public function getAllJobs(): \think\response\Json
|
public function getAllJobs(): \think\response\Json
|
||||||
{
|
{
|
||||||
$data = Jobs::field('id,name')->select()->each(function($item){
|
$data = Jobs::field('id,name')->where('status',0)->select()->each(function($item){
|
||||||
$item['admin_num'] = Admin::where('job_id',$item['id'])->count();
|
$item['admin_num'] = Admin::where('job_id',$item['id'])->count();
|
||||||
return $item;
|
return $item;
|
||||||
})->toArray();
|
})->toArray();
|
||||||
|
@ -108,7 +108,7 @@ class OrgsController extends BaseAdminController
|
|||||||
//获取所有组织
|
//获取所有组织
|
||||||
public function getAll(): \think\response\Json
|
public function getAll(): \think\response\Json
|
||||||
{
|
{
|
||||||
$data = Orgs::field('id,name,status,create_time')->select();
|
$data = Orgs::field('id,name,status,create_time')->where('status',0)->select();
|
||||||
return $this->success('请求成功',$data->toArray());
|
return $this->success('请求成功',$data->toArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user