Browse Source

产品调整

hanzhengyi 1 year ago
parent
commit
8ca596e283

+ 5 - 1
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/DmpProductInfoServiceImpl.java

@@ -12,6 +12,8 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.datascope.annotation.DataScope;
+import com.ruoyi.common.datascope.context.DeptContextHolder;
 import com.usky.common.core.bean.CommonPage;
 import com.usky.common.core.exception.BusinessException;
 import com.usky.common.mybatis.core.AbstractCrudService;
@@ -133,6 +135,7 @@ public class DmpProductInfoServiceImpl extends AbstractCrudService<DmpProductInf
 
 
     @Override
+    @DataScope(deptAlias = "d")
     public CommonPage<DmpProductInfo> page(DmpProductInfoRequest piRequest) {
         IPage<DmpProductInfo> page = new Page<>(piRequest.getCurrent(), piRequest.getSize());
         LambdaQueryWrapper<DmpProductInfo> lambdaQuery = Wrappers.lambdaQuery();
@@ -141,7 +144,8 @@ public class DmpProductInfoServiceImpl extends AbstractCrudService<DmpProductInf
                 .eq(StringUtils.isNotBlank(piRequest.getDeviceModel()),DmpProductInfo::getDeviceModel,piRequest.getDeviceModel())
                 .eq(null != piRequest.getId(),DmpProductInfo::getId,piRequest.getId())
                 .eq(DmpProductInfo::getTenantId,SecurityUtils.getTenantId())
-                .eq(DmpProductInfo::getDeleteFlag,0);
+                .eq(DmpProductInfo::getDeleteFlag,0)
+                .last(DeptContextHolder.getDeptSql());
         List<DmpProductInfo> records = this.list(lambdaQuery);
         List<Integer> productIds = records.stream().map(DmpProductInfo::getId).collect(Collectors.toList());
         List<Integer> deviceTypes = records.stream().map(DmpProductInfo::getDeviceType).collect(Collectors.toList());