params['keyword'])) { $where[] = ['a.name', 'like', '%'.$this->params['keyword'].'%']; } if (!empty($this->params['goods_category_id'])) { $where[] = ['b.goods_category_id', '=', $this->params['goods_category_id']]; } else { $where[] = ['b.goods_category_id', '=', 0]; } return $where; } /** * @notes 获取列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2024/10/18 09:58 */ public function lists(): array { $lists = FaultCode::alias("a") ->with(['firstType']) ->leftJoin('fault_type b', 'a.type_id = b.id') ->where($this->queryWhere()) ->field('a.id,a.name,a.price,b.id as pre_id ,b.name as pre_name, b.pid') ->limit($this->limitOffset, $this->limitLength) ->select() ->toArray(); return $lists; } /** * @notes 获取数量 * @return int * @author likeadmin * @date 2024/10/18 09:58 */ public function count(): int { return FaultCode::alias("a") ->leftJoin('fault_type b', 'a.type_id = b.id') ->where($this->queryWhere()) ->count(); } }