Forráskód Böngészése

新增林业供应商查询商品,生产地,品牌

赵冬冬 4 éve
szülő
commit
26dbc179b2

+ 4 - 0
forest-admin/admin-server/src/main/java/com/hwrj/cloud/admin/dto/PmsProductQueryParam.java

@@ -1,5 +1,6 @@
 package com.hwrj.cloud.admin.dto;
 
+import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
@@ -10,6 +11,7 @@ import lombok.EqualsAndHashCode;
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
+@ApiModel
 public class PmsProductQueryParam {
     @ApiModelProperty("上架状态")
     private Integer publishStatus;
@@ -23,6 +25,8 @@ public class PmsProductQueryParam {
     private Long productCategoryId;
     @ApiModelProperty("商品品牌编号")
     private Long brandId;
+    @ApiModelProperty("供应商")
+    private Long compId;
 
 
 }

+ 23 - 14
forest-admin/admin-server/src/main/java/com/hwrj/cloud/admin/service/impl/PmsProductServiceImpl.java

@@ -78,6 +78,7 @@ public class PmsProductServiceImpl implements PmsProductService {
     private PmsProductVertifyRecordDao productVertifyRecordDao;
     @Autowired
     private CmsPrefrenceAreaService prefrenceAreaService;
+
     @Override
     public int create(PmsProductParam productParam) {
         int count;
@@ -160,16 +161,18 @@ public class PmsProductServiceImpl implements PmsProductService {
         updateInfo.setPrefrenceAreaProductRelationList(relationInputs);
         return updateInfo;
     }
-    public void check(PmsProductParam productParam){
+
+    public void check(PmsProductParam productParam) {
         long compId = CurrUserUtil.getCompId();
-        if(StringUtils.isEmpty(compId)){
+        if (StringUtils.isEmpty(compId)) {
             throw new RuntimeException("没有绑定供应商无法修改!");
         }
-        Long  productcompId = productParam.getCompId();
-        if(!productcompId.equals(compId)){
+        Long productcompId = productParam.getCompId();
+        if (!productcompId.equals(compId)) {
             throw new RuntimeException("你不能修改别的供应商数据!");
         }
     }
+
     @Override
     @Transactional
     public int update(Long id, PmsProductParam productParam) {
@@ -263,8 +266,12 @@ public class PmsProductServiceImpl implements PmsProductService {
         PmsProductExample.Criteria criteria = productExample.createCriteria();
         productExample.setOrderByClause("create_time desc");
         criteria.andDeleteStatusEqualTo(0);
-        if(!StringUtils.isEmpty(compId)){
+        if (!StringUtils.isEmpty(compId)) {
             criteria.andCompIdEqualTo(compId);
+        } else {
+            if (!StringUtils.isEmpty(productQueryParam.getCompId())) {
+                criteria.andCompIdEqualTo(productQueryParam.getCompId());
+            }
         }
         if (productQueryParam.getPublishStatus() != null) {
             criteria.andPublishStatusEqualTo(productQueryParam.getPublishStatus());
@@ -341,9 +348,9 @@ public class PmsProductServiceImpl implements PmsProductService {
 
     @Override
     public int updateDeleteStatus(List<Long> ids, Integer deleteStatus) {
-        if(deleteStatus.intValue() == 1){
-            long i =  pmsProductDao.check(ids);
-            if(i>0){
+        if (deleteStatus.intValue() == 1) {
+            long i = pmsProductDao.check(ids);
+            if (i > 0) {
                 throw new GlobalException("你删除的商品产生预购订单,无法删除!");
             }
         }
@@ -381,7 +388,6 @@ public class PmsProductServiceImpl implements PmsProductService {
     }
 
 
-
     /**
      * 建立和插入关系表操作
      *
@@ -405,6 +411,7 @@ public class PmsProductServiceImpl implements PmsProductService {
             throw new RuntimeException(e.getMessage());
         }
     }
+
     @Autowired
     private PmsProductExcelDao productExcelDao;
 
@@ -413,12 +420,14 @@ public class PmsProductServiceImpl implements PmsProductService {
         PageHelper.startPage(bigDataListParam.getPageNum(), bigDataListParam.getPageSize());
         return productExcelDao.bigDataList(bigDataListParam);
     }
+
     @Override
-    public BigDataListInfoVo bigDatainfo(Long id){
+    public BigDataListInfoVo bigDatainfo(Long id) {
         return productExcelDao.bigDatainfo(id);
     }
+
     @Override
-    public List<SelectVo> bigDataType(){
+    public List<SelectVo> bigDataType() {
         return productExcelDao.bigDataType();
     }
 
@@ -429,16 +438,16 @@ public class PmsProductServiceImpl implements PmsProductService {
 
     @Override
     public int verify(Long id) {
-        int count = 0 ;
+        int count = 0;
         PmsProduct pmsProduct = productMapper.selectByPrimaryKey(id);
-        if(!StringUtils.isEmpty(pmsProduct)){
+        if (!StringUtils.isEmpty(pmsProduct)) {
             PmsProduct product = new PmsProduct();
             product.setVerifyStatus(1);
             PmsProductExample example = new PmsProductExample();
             example.createCriteria().andIdEqualTo(id);
             List<PmsProductVertifyRecord> list = new ArrayList<>();
             return count = productMapper.updateByExampleSelective(product, example);
-        }else{
+        } else {
             throw new GlobalException("商品不存在无法审核!");
         }
     }