['check_date', 'modify_term'], '%like%' => ['check_nature', 'check_user', 'check_company', 'modify_company', 'modify_user', 'resp_user'], ]; } /** * @notes 获取安全整改列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2023/12/19 16:40 */ public function lists(): array { return SafetyModify::where($this->searchWhere) ->field(['id', 'org_id', 'dept_id', 'project_id', 'check_nature', 'check_date', 'check_user', 'check_company', 'check_item', 'check_result', 'modify_term', 'modify_company', 'modify_user', 'safety_hazard', 'resp_user']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($item){ $project = Project::field('name,project_code')->where('id',$item['project_id'])->findOrEmpty(); $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']; $item['project_name'] = $project['name']; $item['project_code'] = $project['project_code']; return $item; }) ->toArray(); } /** * @notes 获取安全整改数量 * @return int * @author likeadmin * @date 2023/12/19 16:40 */ public function count(): int { return SafetyModify::where($this->searchWhere)->count(); } }