|
@@ -96,11 +96,16 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
wrapper.keyword(dto,
|
|
|
new SqlField("pi", ProductInfo::getName),
|
|
|
new SqlField("pi", ProductInfo::getCode),
|
|
|
- new SqlField("pi", ProductInfo::getCustomCode)
|
|
|
+ new SqlField("pi", ProductInfo::getCustomCode),
|
|
|
+ new SqlField("pi", ProductInfo::getSpec),
|
|
|
+ //材质面料过滤
|
|
|
+ new SqlField("json_unquote(pi.victoriatourist_json -> '$.materialQuality')")
|
|
|
);
|
|
|
//计算并根据生命周期过滤
|
|
|
wrapper.eq("IF(DATEDIFF(now(),pi.create_time)> json_unquote( victoriatourist_json -> '$.growUpDay' ),3,IF( DATEDIFF(now(),pi.create_time)> json_unquote( victoriatourist_json -> '$.newProductsDay' ), 2, 1 ))", dto.getLifeCycle());
|
|
|
+ //过滤组合产品
|
|
|
wrapper.eq("json_unquote( victoriatourist_json -> '$.combination' )", dto.getCombination());
|
|
|
+
|
|
|
Page<ProductInfoVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
|
|
|
List<ProductInfoVo> records = page.getRecords();
|
|
@@ -137,55 +142,8 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
|
|
|
@Override
|
|
|
public Page<ProductInfoVo> getPageByWdly(ProductInfoSelectDto dto) {
|
|
|
-
|
|
|
-
|
|
|
- IWrapper<ProductInfo> wrapper = getWrapper();
|
|
|
- wrapper.orderByDesc("pi", ProductInfo::getId);
|
|
|
- wrapper.eq("pi", ProductInfo::getType, dto.getType());
|
|
|
- wrapper.eq("pi", ProductInfo::getDefinition, dto.getDefinition());
|
|
|
-
|
|
|
- if (dto.getProductClassifyId() != null) {
|
|
|
- List<Long> childId = productClassifyService.getChildIdList(dto.getProductClassifyId());
|
|
|
- wrapper.in("pi", ProductInfo::getProductClassifyId, childId);
|
|
|
- }
|
|
|
-
|
|
|
- wrapper.keyword(dto,
|
|
|
- new SqlField("pi", ProductInfo::getName),
|
|
|
- new SqlField("pi", ProductInfo::getCustomCode)
|
|
|
- );
|
|
|
- // 计算并根据生命周期过滤
|
|
|
- wrapper.eq("IF(DATEDIFF(now(),pi.create_time)> json_unquote( victoriatourist_json -> '$.growUpDay' ),3,IF( DATEDIFF(now(),pi.create_time)> json_unquote( victoriatourist_json -> '$.newProductsDay' ), 2, 1 ))", dto.getLifeCycle());
|
|
|
- wrapper.eq("json_unquote( victoriatourist_json -> '$.combination' )", dto.getCombination());
|
|
|
- Page<ProductInfoVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
-
|
|
|
+ Page<ProductInfoVo> page = getPage(dto);
|
|
|
List<ProductInfoVo> records = page.getRecords();
|
|
|
-
|
|
|
- if (records.size() == 0) {
|
|
|
- return page;
|
|
|
- }
|
|
|
-
|
|
|
- List<ProductClassify> productClassifyList = productClassifyService.list();
|
|
|
- Map<Long, ProductClassify> productClassifyMap = productClassifyList.stream().collect(Collectors.toMap(BaseIdPo::getId, Function.identity()));
|
|
|
-
|
|
|
- for (ProductInfoVo record : records) {
|
|
|
- Long productClassifyId = record.getProductClassifyId();
|
|
|
- ProductClassify productClassify = productClassifyMap.get(productClassifyId);
|
|
|
- if (productClassify == null) {
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- record.setClassifyName(productClassify.getName());
|
|
|
-
|
|
|
- List<String> classifyNameGroup = new ArrayList<>();
|
|
|
-
|
|
|
- while (productClassify != null) {
|
|
|
- classifyNameGroup.add(0, productClassify.getName());
|
|
|
- productClassify = productClassifyMap.get(productClassify.getParentId());
|
|
|
- }
|
|
|
- record.setClassifyNameGroup(classifyNameGroup);
|
|
|
-
|
|
|
- }
|
|
|
-//--------------------------------------------------
|
|
|
//赋值维多利亚扩展部门名称
|
|
|
List<Long> ids = new ArrayList<>();
|
|
|
for (ProductInfoVo record : records) {
|