Commit 233afd7a59b6e62bde41d331a5d36d7fc24eab08

Authored by YunaiV
1 parent 3535fda9

feat:【IoT 物联网】商品新增时,productKey 不在跨租户校验,因为只需要保证 productKey + deviceName 跨租户唯一即可

yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/product/IotProductServiceImpl.java
@@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollUtil; @@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollUtil;
4 import cn.iocoder.yudao.framework.common.pojo.PageResult; 4 import cn.iocoder.yudao.framework.common.pojo.PageResult;
5 import cn.iocoder.yudao.framework.common.util.object.BeanUtils; 5 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
6 import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore; 6 import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
7 -import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;  
8 import cn.iocoder.yudao.module.iot.controller.admin.product.vo.product.IotProductPageReqVO; 7 import cn.iocoder.yudao.module.iot.controller.admin.product.vo.product.IotProductPageReqVO;
9 import cn.iocoder.yudao.module.iot.controller.admin.product.vo.product.IotProductSaveReqVO; 8 import cn.iocoder.yudao.module.iot.controller.admin.product.vo.product.IotProductSaveReqVO;
10 import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO; 9 import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO;
@@ -47,12 +46,9 @@ public class IotProductServiceImpl implements IotProductService { @@ -47,12 +46,9 @@ public class IotProductServiceImpl implements IotProductService {
47 @Override 46 @Override
48 public Long createProduct(IotProductSaveReqVO createReqVO) { 47 public Long createProduct(IotProductSaveReqVO createReqVO) {
49 // 1. 校验 ProductKey 48 // 1. 校验 ProductKey
50 - TenantUtils.executeIgnore(() -> {  
51 - // 为什么忽略租户?避免多个租户之间,productKey 重复,导致 TDengine 设备属性表重复  
52 - if (productMapper.selectByProductKey(createReqVO.getProductKey()) != null) {  
53 - throw exception(PRODUCT_KEY_EXISTS);  
54 - }  
55 - }); 49 + if (productMapper.selectByProductKey(createReqVO.getProductKey()) != null) {
  50 + throw exception(PRODUCT_KEY_EXISTS);
  51 + }
56 52
57 // 2. 插入 53 // 2. 插入
58 IotProductDO product = BeanUtils.toBean(createReqVO, IotProductDO.class) 54 IotProductDO product = BeanUtils.toBean(createReqVO, IotProductDO.class)