save(['is_delete' => 1]); } /** * [category] * 关联分类 * * @Author: Yeshihao * @DateTime: 2024/11/26 14:38 * @return \think\model\relation\BelongsTo */ public function category() { return $this->belongsTo(CertificateCategory::class, 'certificate_category_id', 'id'); } /** * [file] * 关联文件 * * @Author: Yeshihao * @DateTime: 2024/11/26 14:48 * @return \think\model\relation\BelongsTo */ public function file() { return $this->belongsTo('UploadFile', 'file_id', 'file_id'); } /** * [getCertificateList] * * @Author: Yeshihao * @DateTime: 2024/11/27 10:43 * @param array $where * @param string $field * @return bool|\PDOStatement|string|\think\Collection * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ public static function getCertificateList($where = [], $field = '*') { $model = new static; !empty($where) && $model->where($where); return $model->field($field)->where('is_delete', '=', 0)->select(); } /** * [handlerSearch] * * @Author: Yeshihao * @DateTime: 2024/12/2 15:53 * @param Query $query * @param array $param * @return Query */ public function handlerSearch(Query $query, array $param) { //所属分类 if (!empty($param['certificate_category_id'])) { $query->where('certificate_category_id', $param['certificate_category_id']); } //资质名称 if (!empty($param['name'])) { $query->where('name', "like", "%{$param['name']}%"); } return $query; } }