diff --git a/app/adminapi/lists/dept/JobsLists.php b/app/adminapi/lists/dept/JobsLists.php index f368d651a..8cd3fa9ec 100755 --- a/app/adminapi/lists/dept/JobsLists.php +++ b/app/adminapi/lists/dept/JobsLists.php @@ -18,6 +18,7 @@ use app\adminapi\lists\BaseAdminDataLists; use app\common\lists\ListsSearchInterface; use app\common\model\dept\Dept; use app\common\model\dept\Jobs; +use app\common\model\dept\Orgs; /** * 岗位列表 @@ -60,7 +61,9 @@ class JobsLists extends BaseAdminDataLists implements ListsSearchInterface ->limit($this->limitOffset, $this->limitLength) ->order(['sort' => 'desc', 'id' => 'desc']) ->select()->each(function($item){ - $dept = Dept::where('id',$item['dept_id'])->findOrEmpty(); + $dept = Dept::field('name,org_id')->where('id',$item['dept_id'])->findOrEmpty(); + $org = Orgs::field('name')->where('id',$dept['org_id'])->findOrEmpty(); + $item['org_name'] = $org->isEmpty() ? '' : $org['name']; $item['dept_name'] = $dept->isEmpty() ? '' : $dept['name']; return $item; })