This commit is contained in:
weiz 2024-05-30 10:24:40 +08:00
parent 6c86550745
commit 4a45ea83ef
3 changed files with 5 additions and 5 deletions

View File

@ -106,14 +106,14 @@ class DeptController extends BaseAdminController
if(empty($params['org_id'])){
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);
}
//获取所有部门
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();
$item['org_name'] = $org->isEmpty() ? '' : $org['name'];
$item['admin_num'] = Admin::where('dept_id',$item['id'])->count();

View File

@ -107,14 +107,14 @@ class JobsController extends BaseAdminController
if(empty($params['dept_id'])){
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);
}
//获取所有岗位
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();
return $item;
})->toArray();

View File

@ -108,7 +108,7 @@ class OrgsController extends BaseAdminController
//获取所有组织
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());
}
}