params['spare_status'] = 1; return [ '=' => ['spare_status'], '%like%' => ['spare_name'] ]; } /** * @notes 获取列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2024/09/14 15:08 */ public function lists(): array { //去除清洗的所有分类 $goods_category_id = !empty($this->params['goods_category_id'])?$this->params['goods_category_id']:999999; return SparePart::where($this->searchWhere) ->where('goods_category_id',$goods_category_id) ->field(['id', 'goods_category_id', 'spare_name', 'spare_image', 'spare_number', 'spare_unit', 'company_price', 'original_price', 'offering_price', 'spare_status']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select() ->toArray(); } /** * @notes 获取数量 * @return int * @author likeadmin * @date 2024/09/14 15:08 */ public function count(): int { return SparePart::where($this->searchWhere)->count(); } }