Commit 0c9dd349812b10090a965c00d4f2fe64466cdcbb

Authored by YunaiV
1 parent 9b111996

【功能修复】IOT:多个 ProductCategoryMapper 的名字冲突

yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/product/IotProductCategoryServiceImpl.java
@@ -29,7 +29,7 @@ import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.PRODUCT_CATEG @@ -29,7 +29,7 @@ import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.PRODUCT_CATEG
29 public class IotProductCategoryServiceImpl implements IotProductCategoryService { 29 public class IotProductCategoryServiceImpl implements IotProductCategoryService {
30 30
31 @Resource 31 @Resource
32 - private IotProductCategoryMapper productCategoryMapper; 32 + private IotProductCategoryMapper iotProductCategoryMapper;
33 33
34 @Resource 34 @Resource
35 private IotProductService productService; 35 private IotProductService productService;
@@ -40,7 +40,7 @@ public class IotProductCategoryServiceImpl implements IotProductCategoryService @@ -40,7 +40,7 @@ public class IotProductCategoryServiceImpl implements IotProductCategoryService
40 public Long createProductCategory(IotProductCategorySaveReqVO createReqVO) { 40 public Long createProductCategory(IotProductCategorySaveReqVO createReqVO) {
41 // 插入 41 // 插入
42 IotProductCategoryDO productCategory = BeanUtils.toBean(createReqVO, IotProductCategoryDO.class); 42 IotProductCategoryDO productCategory = BeanUtils.toBean(createReqVO, IotProductCategoryDO.class);
43 - productCategoryMapper.insert(productCategory); 43 + iotProductCategoryMapper.insert(productCategory);
44 // 返回 44 // 返回
45 return productCategory.getId(); 45 return productCategory.getId();
46 } 46 }
@@ -51,7 +51,7 @@ public class IotProductCategoryServiceImpl implements IotProductCategoryService @@ -51,7 +51,7 @@ public class IotProductCategoryServiceImpl implements IotProductCategoryService
51 validateProductCategoryExists(updateReqVO.getId()); 51 validateProductCategoryExists(updateReqVO.getId());
52 // 更新 52 // 更新
53 IotProductCategoryDO updateObj = BeanUtils.toBean(updateReqVO, IotProductCategoryDO.class); 53 IotProductCategoryDO updateObj = BeanUtils.toBean(updateReqVO, IotProductCategoryDO.class);
54 - productCategoryMapper.updateById(updateObj); 54 + iotProductCategoryMapper.updateById(updateObj);
55 } 55 }
56 56
57 @Override 57 @Override
@@ -59,18 +59,18 @@ public class IotProductCategoryServiceImpl implements IotProductCategoryService @@ -59,18 +59,18 @@ public class IotProductCategoryServiceImpl implements IotProductCategoryService
59 // 校验存在 59 // 校验存在
60 validateProductCategoryExists(id); 60 validateProductCategoryExists(id);
61 // 删除 61 // 删除
62 - productCategoryMapper.deleteById(id); 62 + iotProductCategoryMapper.deleteById(id);
63 } 63 }
64 64
65 private void validateProductCategoryExists(Long id) { 65 private void validateProductCategoryExists(Long id) {
66 - if (productCategoryMapper.selectById(id) == null) { 66 + if (iotProductCategoryMapper.selectById(id) == null) {
67 throw exception(PRODUCT_CATEGORY_NOT_EXISTS); 67 throw exception(PRODUCT_CATEGORY_NOT_EXISTS);
68 } 68 }
69 } 69 }
70 70
71 @Override 71 @Override
72 public IotProductCategoryDO getProductCategory(Long id) { 72 public IotProductCategoryDO getProductCategory(Long id) {
73 - return productCategoryMapper.selectById(id); 73 + return iotProductCategoryMapper.selectById(id);
74 } 74 }
75 75
76 @Override 76 @Override
@@ -78,28 +78,28 @@ public class IotProductCategoryServiceImpl implements IotProductCategoryService @@ -78,28 +78,28 @@ public class IotProductCategoryServiceImpl implements IotProductCategoryService
78 if (CollUtil.isEmpty(ids)) { 78 if (CollUtil.isEmpty(ids)) {
79 return CollUtil.newArrayList(); 79 return CollUtil.newArrayList();
80 } 80 }
81 - return productCategoryMapper.selectBatchIds(ids); 81 + return iotProductCategoryMapper.selectBatchIds(ids);
82 } 82 }
83 83
84 @Override 84 @Override
85 public PageResult<IotProductCategoryDO> getProductCategoryPage(IotProductCategoryPageReqVO pageReqVO) { 85 public PageResult<IotProductCategoryDO> getProductCategoryPage(IotProductCategoryPageReqVO pageReqVO) {
86 - return productCategoryMapper.selectPage(pageReqVO); 86 + return iotProductCategoryMapper.selectPage(pageReqVO);
87 } 87 }
88 88
89 @Override 89 @Override
90 public List<IotProductCategoryDO> getProductCategoryListByStatus(Integer status) { 90 public List<IotProductCategoryDO> getProductCategoryListByStatus(Integer status) {
91 - return productCategoryMapper.selectListByStatus(status); 91 + return iotProductCategoryMapper.selectListByStatus(status);
92 } 92 }
93 93
94 @Override 94 @Override
95 public Long getProductCategoryCount(LocalDateTime createTime) { 95 public Long getProductCategoryCount(LocalDateTime createTime) {
96 - return productCategoryMapper.selectCountByCreateTime(createTime); 96 + return iotProductCategoryMapper.selectCountByCreateTime(createTime);
97 } 97 }
98 98
99 @Override 99 @Override
100 public Map<String, Integer> getProductCategoryDeviceCountMap() { 100 public Map<String, Integer> getProductCategoryDeviceCountMap() {
101 // 1. 获取所有数据 101 // 1. 获取所有数据
102 - List<IotProductCategoryDO> categoryList = productCategoryMapper.selectList(); 102 + List<IotProductCategoryDO> categoryList = iotProductCategoryMapper.selectList();
103 List<IotProductDO> productList = productService.getProductList(); 103 List<IotProductDO> productList = productService.getProductList();
104 // TODO @super:不要 list 查询,返回内存,而是查询一个 Map<productId, count> 104 // TODO @super:不要 list 查询,返回内存,而是查询一个 Map<productId, count>
105 Map<Long, Integer> deviceCountMapByProductId = deviceService.getDeviceCountMapByProductId(); 105 Map<Long, Integer> deviceCountMapByProductId = deviceService.getDeviceCountMapByProductId();