['g.id', 'g.category_id', 'g.status', 'g.supplier_id', 'g.goods_type'], 'like' => ['g.name', 'g.code', 'gi.bar_code'], 'between_time' => ['g.create_time'], ]; } /** * @notes 获取商品规格价格列表 * @return array * @author * @date 2024/01/01 00:00 */ public function lists(): array { $lists = GoodsItem::alias('gi') ->leftJoin('goods g', 'g.id = gi.goods_id') ->where($this->searchWhere) ->where('g.delete_time', null) ->field([ 'g.id as goods_id', 'g.code as goods_code', 'g.name as goods_name', 'gi.id as item_id', 'gi.spec_value_str', 'gi.sell_price', 'gi.lineation_price', 'gi.cost_price', 'gi.stock', 'gi.weight', 'gi.volume' ]) ->limit($this->limitOffset, $this->limitLength) ->order('g.id desc, gi.id asc') ->select() ->toArray(); return $lists; } /** * @notes 获取数量 * @return int * @author * @date 2024/01/01 00:00 */ public function count(): int { return GoodsItem::alias('gi') ->leftJoin('goods g', 'g.id = gi.goods_id') ->where($this->searchWhere) ->where('g.delete_time', null) ->count(); } /** * @notes 设置导出字段 * @return array * @author * @date 2024/01/01 00:00 */ public function setExcelFields(): array { return [ 'goods_id' => '商品ID', 'goods_code' => '商品编码', 'goods_name' => '商品名称', 'item_id' => '规格ID', 'spec_value_str' => '规格名称', 'sell_price' => '销售价格', 'lineation_price' => '划线价格', 'cost_price' => '成本价格', 'stock' => '库存数量', 'weight' => '重量(kg)', 'volume' => '体积(m³)' ]; } /** * @notes 设置文件名 * @return string * @author * @date 2024/01/01 00:00 */ public function setFileName(): string { return '商品规格价格'; } }