|
@@ -8,7 +8,6 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
|
|
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -43,7 +42,6 @@ import com.ruoyi.common.utils.wrapper.SqlField;
|
|
|
import com.ruoyi.system.service.ISysDeptService;
|
|
|
import com.ruoyi.system.utils.UserUtil;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
-import org.apache.commons.collections4.ListUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -68,8 +66,10 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
|
|
|
@Autowired
|
|
|
private ProductClassifyService productClassifyService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private ISysDeptService sysDeptService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private CustomerService customerService;
|
|
|
|
|
@@ -82,16 +82,21 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
wrapper.orderByDesc("pi", ProductInfo::getId);
|
|
|
wrapper.eq("pi", ProductInfo::getType, dto.getType());
|
|
|
wrapper.eq("pi", ProductInfo::getDefinition, dto.getDefinition());
|
|
|
- wrapper.eq("pi", ProductInfo::getProductClassifyId, dto.getProductClassifyId());
|
|
|
- wrapper.like("pi",ProductInfo::getName,dto.getName());
|
|
|
- wrapper.like("pi",ProductInfo::getCustomCode,dto.getCustomCode());
|
|
|
- wrapper.like("pi",ProductInfo::getBarCode,dto.getBarCode());
|
|
|
- wrapper.like("json_unquote(standard_json->'$.englishName')",dto.getEnglishName());
|
|
|
- wrapper.like("json_unquote(standard_json->'$.customsCode')",dto.getCustomsCode());
|
|
|
-// wrapper.keyword(dto,
|
|
|
-// new SqlField("pi", ProductInfo::getName),
|
|
|
-// new SqlField("pi", ProductInfo::getCode),
|
|
|
-// new SqlField("pi", ProductInfo::getCustomCode)
|
|
|
+
|
|
|
+ if (dto.getProductClassifyId() != null) {
|
|
|
+ List<Long> childIdList = productClassifyService.getChildIdList(dto.getProductClassifyId());
|
|
|
+ wrapper.in("pi", ProductInfo::getProductClassifyId, childIdList);
|
|
|
+ }
|
|
|
+
|
|
|
+ wrapper.like("pi", ProductInfo::getName, dto.getName());
|
|
|
+ wrapper.like("pi", ProductInfo::getCustomCode, dto.getCustomCode());
|
|
|
+ wrapper.like("pi", ProductInfo::getBarCode, dto.getBarCode());
|
|
|
+ wrapper.like("json_unquote(standard_json->'$.englishName')", dto.getEnglishName());
|
|
|
+ wrapper.like("json_unquote(standard_json->'$.customsCode')", dto.getCustomsCode());
|
|
|
+ // wrapper.keyword(dto,
|
|
|
+ // new SqlField("pi", ProductInfo::getName),
|
|
|
+ // new SqlField("pi", ProductInfo::getCode),
|
|
|
+ // 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());
|
|
@@ -132,16 +137,23 @@ 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());
|
|
|
- wrapper.eq("pi", ProductInfo::getProductClassifyId, dto.getProductClassifyId());
|
|
|
+
|
|
|
+ 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);
|