['type', 'name', 'publish_dep'], ]; } /** * @notes 获取安全规范列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2023/12/19 10:21 */ public function lists(): array { return SafetyStandard::where($this->searchWhere) ->field(['id', 'org_id', 'dept_id', 'type', 'name', 'publish_dep', 'content', '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 10:21 */ public function count(): int { return SafetyStandard::where($this->searchWhere)->count(); } }