['project_name','name', 'happen_time', 'device_accident'], ]; } /** * @notes 获取安全监督列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2023/12/19 15:11 */ public function lists(): array { return SafetySupervise::where($this->searchWhere) ->field(['id', 'org_id', 'dept_id', 'project_name', 'name', 'happen_time', 'device_accident', 'content', 'remark', 'file']) ->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/19 15:11 */ public function count(): int { return SafetySupervise::where($this->searchWhere)->count(); } }