['node', 'serial_number'], ]; } /** * @notes 获取质量检测模板列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2023/12/21 15:41 */ public function lists(): array { return QualityDetectionTemp::where($this->searchWhere) ->field(['id', 'org_id', 'dept_id', 'node', 'serial_number', 'standard_duration', 'remark', 'file', 'add_user', 'update_user']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($item){ $item['node_text'] = $item->node_text; $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/21 15:41 */ public function count(): int { return QualityDetectionTemp::where($this->searchWhere)->count(); } }