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

This commit is contained in:
YunaiV 2025-03-23 09:00:33 +08:00
parent 9b11199665
commit 0c9dd34981
1 changed files with 11 additions and 11 deletions

View File

@ -29,7 +29,7 @@ import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.PRODUCT_CATEG
public class IotProductCategoryServiceImpl implements IotProductCategoryService { public class IotProductCategoryServiceImpl implements IotProductCategoryService {
@Resource @Resource
private IotProductCategoryMapper productCategoryMapper; private IotProductCategoryMapper iotProductCategoryMapper;
@Resource @Resource
private IotProductService productService; private IotProductService productService;
@ -40,7 +40,7 @@ public class IotProductCategoryServiceImpl implements IotProductCategoryService
public Long createProductCategory(IotProductCategorySaveReqVO createReqVO) { public Long createProductCategory(IotProductCategorySaveReqVO createReqVO) {
// 插入 // 插入
IotProductCategoryDO productCategory = BeanUtils.toBean(createReqVO, IotProductCategoryDO.class); IotProductCategoryDO productCategory = BeanUtils.toBean(createReqVO, IotProductCategoryDO.class);
productCategoryMapper.insert(productCategory); iotProductCategoryMapper.insert(productCategory);
// 返回 // 返回
return productCategory.getId(); return productCategory.getId();
} }
@ -51,7 +51,7 @@ public class IotProductCategoryServiceImpl implements IotProductCategoryService
validateProductCategoryExists(updateReqVO.getId()); validateProductCategoryExists(updateReqVO.getId());
// 更新 // 更新
IotProductCategoryDO updateObj = BeanUtils.toBean(updateReqVO, IotProductCategoryDO.class); IotProductCategoryDO updateObj = BeanUtils.toBean(updateReqVO, IotProductCategoryDO.class);
productCategoryMapper.updateById(updateObj); iotProductCategoryMapper.updateById(updateObj);
} }
@Override @Override
@ -59,18 +59,18 @@ public class IotProductCategoryServiceImpl implements IotProductCategoryService
// 校验存在 // 校验存在
validateProductCategoryExists(id); validateProductCategoryExists(id);
// 删除 // 删除
productCategoryMapper.deleteById(id); iotProductCategoryMapper.deleteById(id);
} }
private void validateProductCategoryExists(Long id) { private void validateProductCategoryExists(Long id) {
if (productCategoryMapper.selectById(id) == null) { if (iotProductCategoryMapper.selectById(id) == null) {
throw exception(PRODUCT_CATEGORY_NOT_EXISTS); throw exception(PRODUCT_CATEGORY_NOT_EXISTS);
} }
} }
@Override @Override
public IotProductCategoryDO getProductCategory(Long id) { public IotProductCategoryDO getProductCategory(Long id) {
return productCategoryMapper.selectById(id); return iotProductCategoryMapper.selectById(id);
} }
@Override @Override
@ -78,28 +78,28 @@ public class IotProductCategoryServiceImpl implements IotProductCategoryService
if (CollUtil.isEmpty(ids)) { if (CollUtil.isEmpty(ids)) {
return CollUtil.newArrayList(); return CollUtil.newArrayList();
} }
return productCategoryMapper.selectBatchIds(ids); return iotProductCategoryMapper.selectBatchIds(ids);
} }
@Override @Override
public PageResult<IotProductCategoryDO> getProductCategoryPage(IotProductCategoryPageReqVO pageReqVO) { public PageResult<IotProductCategoryDO> getProductCategoryPage(IotProductCategoryPageReqVO pageReqVO) {
return productCategoryMapper.selectPage(pageReqVO); return iotProductCategoryMapper.selectPage(pageReqVO);
} }
@Override @Override
public List<IotProductCategoryDO> getProductCategoryListByStatus(Integer status) { public List<IotProductCategoryDO> getProductCategoryListByStatus(Integer status) {
return productCategoryMapper.selectListByStatus(status); return iotProductCategoryMapper.selectListByStatus(status);
} }
@Override @Override
public Long getProductCategoryCount(LocalDateTime createTime) { public Long getProductCategoryCount(LocalDateTime createTime) {
return productCategoryMapper.selectCountByCreateTime(createTime); return iotProductCategoryMapper.selectCountByCreateTime(createTime);
} }
@Override @Override
public Map<String, Integer> getProductCategoryDeviceCountMap() { public Map<String, Integer> getProductCategoryDeviceCountMap() {
// 1. 获取所有数据 // 1. 获取所有数据
List<IotProductCategoryDO> categoryList = productCategoryMapper.selectList(); List<IotProductCategoryDO> categoryList = iotProductCategoryMapper.selectList();
List<IotProductDO> productList = productService.getProductList(); List<IotProductDO> productList = productService.getProductList();
// TODO @super不要 list 查询返回内存而是查询一个 Map<productId, count> // TODO @super不要 list 查询返回内存而是查询一个 Map<productId, count>
Map<Long, Integer> deviceCountMapByProductId = deviceService.getDeviceCountMapByProductId(); Map<Long, Integer> deviceCountMapByProductId = deviceService.getDeviceCountMapByProductId();