|
@@ -1,12 +1,19 @@
|
|
|
package com.fjhx.xmhjc.service.product.impl;
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.mybatisplus.annotation.TableField;
|
|
|
import com.fjhx.file.utils.ObsFileUtil;
|
|
|
+import com.fjhx.tenant.entity.dict.dto.DictTenantDataSelectDto;
|
|
|
+import com.fjhx.tenant.entity.dict.vo.DictTenantDataVo;
|
|
|
+import com.fjhx.tenant.service.dict.DictTenantDataService;
|
|
|
+import com.fjhx.tenant.utils.DictUtils;
|
|
|
import com.fjhx.xmhjc.entity.product.po.ProductInfo;
|
|
|
import com.fjhx.xmhjc.mapper.product.ProductInfoMapper;
|
|
|
import com.fjhx.xmhjc.service.product.ProductInfoService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.ruoyi.common.core.domain.entity.SysDictData;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.fjhx.xmhjc.entity.product.vo.ProductInfoVo;
|
|
@@ -17,6 +24,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
@@ -32,11 +40,14 @@ import java.util.stream.Collectors;
|
|
|
*/
|
|
|
@Service
|
|
|
public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, ProductInfo> implements ProductInfoService {
|
|
|
+ @Autowired
|
|
|
+ private DictTenantDataService dictTenantDataService;
|
|
|
|
|
|
@Override
|
|
|
public List<ProductInfoVo> getList(ProductInfoSelectDto dto) {
|
|
|
IWrapper<ProductInfo> wrapper = getWrapper();
|
|
|
wrapper.orderByDesc("pi", ProductInfo::getId);
|
|
|
+ wrapper.eq(ObjectUtil.isNotEmpty(dto.getCategoryId()),"category_id", dto.getCategoryId());
|
|
|
List<ProductInfoVo> list = this.baseMapper.getList(wrapper);
|
|
|
return list;
|
|
|
}
|
|
@@ -44,8 +55,17 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
@Override
|
|
|
public Page<ProductInfoVo> getPage(ProductInfoSelectDto dto) {
|
|
|
IWrapper<ProductInfo> wrapper = getWrapper();
|
|
|
- wrapper.orderByDesc("pi", ProductInfo::getId);
|
|
|
+ wrapper.orderByAsc("pi", ProductInfo::getSort);
|
|
|
Page<ProductInfoVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
+ List<ProductInfoVo> records = page.getRecords();
|
|
|
+// DictTenantDataSelectDto dictTenantDataSelectDto = new DictTenantDataSelectDto();
|
|
|
+// dictTenantDataSelectDto.setDictCode("product_content_type");
|
|
|
+// List<DictTenantDataVo> dictList = dictTenantDataService.getList(dictTenantDataSelectDto);
|
|
|
+ records.forEach(item -> {
|
|
|
+ if(StringUtils.isNotBlank(item.getSpec())){
|
|
|
+ List<String> list = Arrays.asList(item.getSpec().split(","));
|
|
|
+ }
|
|
|
+ });
|
|
|
return page;
|
|
|
}
|
|
|
|
|
@@ -92,4 +112,13 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
this.removeById(id);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Page<ProductInfoVo> pageByOpen(Long categoryId, ProductInfoSelectDto dto) {
|
|
|
+ IWrapper<ProductInfo> wrapper = getWrapper();
|
|
|
+ wrapper.orderByAsc("pi", ProductInfo::getSort);
|
|
|
+ wrapper.eq("pi", ProductInfo::getStatus, "1");
|
|
|
+ wrapper.eq("pi", ProductInfo::getCategoryId, categoryId);
|
|
|
+ Page<ProductInfoVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
+ return page;
|
|
|
+ }
|
|
|
}
|