迁移搜索服务
This commit is contained in:
@@ -56,10 +56,10 @@ public interface ProductSpuRpc {
|
||||
/**
|
||||
* 顺序获得商品 SPU 编号数组
|
||||
*
|
||||
* @param limit 数量
|
||||
* @param lastSpuId 最后一个商品 SPU 编号
|
||||
* @param limit 数量
|
||||
* @return 商品 SPU 编号数组
|
||||
*/
|
||||
CommonResult<List<Integer>> listProductSpuIds(Integer limit, Integer lastSpuId);
|
||||
CommonResult<List<Integer>> listProductSpuIds(Integer lastSpuId, Integer limit);
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface ProductSpuMapper extends BaseMapper<ProductSpuDO> {
|
||||
|
||||
@@ -25,4 +27,9 @@ public interface ProductSpuMapper extends BaseMapper<ProductSpuDO> {
|
||||
return selectPage(new Page<>(pageBO.getPageNo(), pageBO.getPageSize()), query);
|
||||
}
|
||||
|
||||
default List<ProductSpuDO> selectListByIdGt(Integer id, Integer limit) {
|
||||
return selectList(new QueryWrapperX<ProductSpuDO>().gtIfPresent("id", id)
|
||||
.orderByAsc("id").last("LIMIT " + limit));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -165,12 +165,12 @@ public class ProductSpuManager {
|
||||
/**
|
||||
* 顺序获得商品 SPU 编号数组
|
||||
*
|
||||
* @param limit 数量
|
||||
* @param lastSpuId 最后一个商品 SPU 编号
|
||||
* @param limit 数量
|
||||
* @return 商品 SPU 编号数组
|
||||
*/
|
||||
public List<Integer> listProductSpuIds(Integer limit, Integer lastSpuId) {
|
||||
return productAttrService.listProductSpuIds(limit, lastSpuId);
|
||||
public List<Integer> listProductSpuIds(Integer lastSpuId, Integer limit) {
|
||||
return productSpuService.listProductSpuIds(lastSpuId, limit);
|
||||
}
|
||||
|
||||
private List<ProductAttrKeyValueBO> checkProductAttr(List<ProductSkuCreateOrUpdateBO> skuBOs) {
|
||||
|
||||
@@ -50,8 +50,8 @@ public class ProductSpuRpcImpl implements ProductSpuRpc {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<Integer>> listProductSpuIds(Integer limit, Integer lastSpuId) {
|
||||
return success(productSpuManager.listProductSpuIds(limit, lastSpuId));
|
||||
public CommonResult<List<Integer>> listProductSpuIds(Integer lastSpuId, Integer limit) {
|
||||
return success(productSpuManager.listProductSpuIds(lastSpuId, limit));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -208,18 +208,4 @@ public class ProductAttrService {
|
||||
return ProductAttrConvert.INSTANCE.convertList03(productAttrValueDOs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 顺序获得商品 SPU 编号数组
|
||||
*
|
||||
* 一般情况下,该接口我们用于提供顺序的 SPU 编号数组,以便调用方进一步根据自己需要获取商品信息
|
||||
* 例如说,搜索服务会不断获取商品编号,重建该商品编号的索引
|
||||
*
|
||||
* @param limit 数量
|
||||
* @param lastSpuId 最后一个商品 SPU 编号
|
||||
* @return 商品 SPU 编号数组
|
||||
*/
|
||||
public List<Integer> listProductSpuIds(Integer limit, Integer lastSpuId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cn.iocoder.mall.productservice.service.spu;
|
||||
|
||||
import cn.iocoder.common.framework.exception.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.common.framework.util.CollectionUtils;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.productservice.convert.spu.ProductSpuConvert;
|
||||
import cn.iocoder.mall.productservice.dal.mysql.dataobject.spu.ProductSpuDO;
|
||||
@@ -91,4 +92,18 @@ public class ProductSpuService {
|
||||
return ProductSpuConvert.INSTANCE.convertPage(productSpuDOPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 顺序获得商品 SPU 编号数组
|
||||
*
|
||||
* 一般情况下,该接口我们用于提供顺序的 SPU 编号数组,以便调用方进一步根据自己需要获取商品信息
|
||||
* 例如说,搜索服务会不断获取商品编号,重建该商品编号的索引
|
||||
*
|
||||
* @param lastSpuId 最后一个商品 SPU 编号
|
||||
* @param limit 数量
|
||||
* @return 商品 SPU 编号数组
|
||||
*/
|
||||
public List<Integer> listProductSpuIds(Integer lastSpuId, Integer limit) {
|
||||
return CollectionUtils.convertList(productSpuMapper.selectListByIdGt(lastSpuId, limit), ProductSpuDO::getId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user