Pārlūkot izejas kodu

新增判断是否子账号

luyanwen-001 3 gadi atpakaļ
vecāks
revīzija
3a9f8da76a

+ 5 - 1
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/req/QueryListBreweryProductionLineReq.java

@@ -15,8 +15,12 @@ import java.io.Serializable;
 @ApiModel
 public class QueryListBreweryProductionLineReq implements Serializable {
 
-    @NotNull(message = "用户ID")
+    @NotNull(message = "用户ID为空")
     @ApiModelProperty(value = "用户ID")
     private Long userId;
 
+    @NotNull(message = "啤酒厂ID为空")
+    @ApiModelProperty(value = "啤酒厂ID")
+    private Long beerFactoryId;
+
 }

+ 11 - 1
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/service/impl/BreweryProductionLineServiceImpl.java

@@ -7,6 +7,7 @@ import com.abi.qms.platform.dto.req.QueryListBreweryProductionLineReq;
 import com.abi.qms.platform.dto.req.SaveBreweryProductionLineReq;
 import com.abi.qms.platform.dto.res.QueryListBreweryProductionLineRes;
 import com.abi.qms.platform.infrastructure.util.AssertUtil;
+import com.abi.qms.platform.infrastructure.util.UserUtil;
 import com.abi.qms.platform.service.BreweryProductionLineService;
 import com.abi.task.common.api.exception.BusinessException;
 import com.abi.task.common.utils.PojoConverterUtils;
@@ -26,6 +27,9 @@ public class BreweryProductionLineServiceImpl implements BreweryProductionLineSe
     @Autowired
     private BreweryProductionLineMapper breweryProductionLineMapper;
 
+    @Autowired
+    private UserUtil userUtil;
+
     /**
      * 新增接口
      * @author lu
@@ -74,9 +78,15 @@ public class BreweryProductionLineServiceImpl implements BreweryProductionLineSe
      */
     @Override
     public QueryListBreweryProductionLineRes queryListBreweryProductionLine(QueryListBreweryProductionLineReq req) {
+        // 是小程序用户主账号 1-是 0-不是
+        Integer isMainAccount = userUtil.getWholeUser().getIsMainAccount();
         QueryWrapper<BreweryProductionLine> query = new QueryWrapper<>();
-        query.eq("user_id",req.getUserId());
         query.eq("is_delete",0);
+        if (isMainAccount.equals(0)) {
+            query.eq("user_id",req.getUserId());
+        } else {
+            query.eq("beer_factory_id",req.getBeerFactoryId());
+        }
         List<BreweryProductionLine> breweryProductionLines = breweryProductionLineMapper.selectList(query);
         //封装出参
         QueryListBreweryProductionLineRes res = new QueryListBreweryProductionLineRes();