增加产品查询条件、删除服务tag

master
wangrunpu 2 months ago
parent bb6340c22c
commit 932094a487

@ -152,7 +152,7 @@ logging:
# 芋道配置项,设置当前项目所有自定义的配置
yudao:
env: # 多环境的配置项
tag: ${HOSTNAME}
tag:
security:
mock-enable: true
access-log: # 访问日志的配置项

@ -143,8 +143,9 @@ public class IotProductController {
@GetMapping("/simple-list")
@Operation(summary = "获取产品的精简信息列表", description = "主要用于前端的下拉选项")
public CommonResult<List<IotProductRespVO>> getProductSimpleList() {
List<IotProductDO> list = productService.getProductList();
public CommonResult<List<IotProductRespVO>> getProductSimpleList(@Valid IotProductPageReqVO pageReqVO) {
// pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<IotProductDO> list = productService.getProductList(pageReqVO);
return success(convertList(list, product -> // 只返回 id、name 字段
new IotProductRespVO().setId(product.getId()).setName(product.getName()).setStatus(product.getStatus())
.setDeviceType(product.getDeviceType()).setLocationType(product.getLocationType())));

@ -14,4 +14,7 @@ public class IotProductPageReqVO extends PageParam {
@Schema(description = "产品标识")
private String productKey;
@Schema(description = "产品发布状态")
private String status;
}

@ -23,6 +23,7 @@ public interface IotProductMapper extends BaseMapperX<IotProductDO> {
return selectPage(reqVO, new LambdaQueryWrapperX<IotProductDO>()
.likeIfPresent(IotProductDO::getName, reqVO.getName())
.likeIfPresent(IotProductDO::getProductKey, reqVO.getProductKey())
.likeIfPresent(IotProductDO::getStatus, reqVO.getStatus())
.orderByDesc(IotProductDO::getId));
}

@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.iot.controller.admin.product.vo.category.IotProductCategoryPageReqVO;
import cn.iocoder.yudao.module.iot.controller.admin.product.vo.category.IotProductCategorySaveReqVO;
import cn.iocoder.yudao.module.iot.controller.admin.product.vo.product.IotProductPageReqVO;
import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductCategoryDO;
import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO;
import cn.iocoder.yudao.module.iot.dal.mysql.product.IotProductCategoryMapper;
@ -102,7 +103,7 @@ public class IotProductCategoryServiceImpl implements IotProductCategoryService
public Map<String, Integer> getProductCategoryDeviceCountMap() {
// 1. 获取所有数据
List<IotProductCategoryDO> categories = iotProductCategoryMapper.selectList();
List<IotProductDO> products = productService.getProductList();
List<IotProductDO> products = productService.getProductList(new IotProductPageReqVO());
Map<Long, Integer> deviceCountMapByProductId = deviceService.getDeviceCountMapByProductId();
// 2. 统计每个分类下的设备数量

@ -103,7 +103,7 @@ public interface IotProductService {
*
* @return
*/
List<IotProductDO> getProductList();
List<IotProductDO> getProductList(IotProductPageReqVO pageReqVO);
/**
*

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.iot.service.product;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.iot.controller.admin.product.vo.product.IotProductPageReqVO;
import cn.iocoder.yudao.module.iot.controller.admin.product.vo.product.IotProductSaveReqVO;
@ -153,8 +154,12 @@ public class IotProductServiceImpl implements IotProductService {
}
@Override
public List<IotProductDO> getProductList() {
return productMapper.selectList();
public List<IotProductDO> getProductList(IotProductPageReqVO pageReqVO) {
return productMapper.selectList(new LambdaQueryWrapperX<IotProductDO>()
.likeIfPresent(IotProductDO::getName, pageReqVO.getName())
.likeIfPresent(IotProductDO::getProductKey, pageReqVO.getProductKey())
.likeIfPresent(IotProductDO::getStatus, pageReqVO.getStatus())
.orderByDesc(IotProductDO::getId));
}
@Override

@ -177,7 +177,7 @@ wx:
# 芋道配置项,设置当前项目所有自定义的配置
yudao:
env: # 多环境的配置项
tag: ${HOSTNAME}
tag:
captcha:
enable: false # 本地环境,暂时关闭图片验证码,方便登录等接口的测试
security:

Loading…
Cancel
Save