['name', 'user'], ]; } /** * @notes 获取检查性质列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2023/12/20 15:56 */ public function lists(): array { return QualityCheckNature::where($this->searchWhere) ->field(['id', 'org_id', 'dept_id', 'name', 'user', 'illustrate', 'date']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($item){ $org = Orgs::field('name')->where('id',$item['org_id'])->findOrEmpty(); $dept = Dept::field('name')->where('id',$item['dept_id'])->findOrEmpty(); $item['org_name'] = $org['name']; $item['dept_name'] = $dept['name']; return $item; }) ->toArray(); } /** * @notes 获取检查性质数量 * @return int * @author likeadmin * @date 2023/12/20 15:56 */ public function count(): int { return QualityCheckNature::where($this->searchWhere)->count(); } }