【代码重构】IoT:产品放到 product 子目录下
This commit is contained in:
parent
3a2c691af0
commit
9b9fd30c90
|
@ -3,10 +3,9 @@ package cn.iocoder.yudao.module.iot.controller.admin.product;
|
|||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
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.IotProductPageReqVO;
|
||||
import cn.iocoder.yudao.module.iot.controller.admin.product.vo.IotProductRespVO;
|
||||
import cn.iocoder.yudao.module.iot.controller.admin.product.vo.IotProductSaveReqVO;
|
||||
import cn.iocoder.yudao.module.iot.controller.admin.product.vo.IotProductSimpleRespVO;
|
||||
import cn.iocoder.yudao.module.iot.controller.admin.product.vo.product.IotProductPageReqVO;
|
||||
import cn.iocoder.yudao.module.iot.controller.admin.product.vo.product.IotProductRespVO;
|
||||
import cn.iocoder.yudao.module.iot.controller.admin.product.vo.product.IotProductSaveReqVO;
|
||||
import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO;
|
||||
import cn.iocoder.yudao.module.iot.service.product.IotProductService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
@ -21,6 +20,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
||||
|
||||
@Tag(name = "管理后台 - IoT 产品")
|
||||
@RestController
|
||||
|
@ -86,9 +86,10 @@ public class IotProductController {
|
|||
@GetMapping("/simple-list")
|
||||
@Operation(summary = "获得所有产品列表")
|
||||
@PreAuthorize("@ss.hasPermission('iot:product:query')")
|
||||
public CommonResult<List<IotProductSimpleRespVO>> getSimpleProductList() {
|
||||
public CommonResult<List<IotProductRespVO>> getSimpleProductList() {
|
||||
List<IotProductDO> list = productService.getProductList();
|
||||
return success(BeanUtils.toBean(list, IotProductSimpleRespVO.class));
|
||||
return success(convertList(list, product -> // 只返回 id、name 字段
|
||||
new IotProductRespVO().setId(product.getId()).setName(product.getName())));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
package cn.iocoder.yudao.module.iot.controller.admin.product.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - IoT 产品 Response VO")
|
||||
@Data
|
||||
public class IotProductSimpleRespVO {
|
||||
|
||||
@Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "26087")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
|
||||
private String name;
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package cn.iocoder.yudao.module.iot.controller.admin.product.vo;
|
||||
package cn.iocoder.yudao.module.iot.controller.admin.product.vo.product;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
@ -1,4 +1,4 @@
|
|||
package cn.iocoder.yudao.module.iot.controller.admin.product.vo;
|
||||
package cn.iocoder.yudao.module.iot.controller.admin.product.vo.product;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
|
@ -20,34 +20,23 @@ public class IotProductRespVO {
|
|||
@ExcelProperty("产品名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "产品标识", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("产品标识")
|
||||
private String productKey;
|
||||
|
||||
@Schema(description = "接入网关协议", example = "2")
|
||||
@ExcelProperty("接入网关协议")
|
||||
private Integer protocolType;
|
||||
|
||||
@Schema(description = "协议编号(脚本解析 id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "13177")
|
||||
@ExcelProperty("协议编号(脚本解析 id)")
|
||||
private Long protocolId;
|
||||
|
||||
@Schema(description = "产品所属品类标识符", example = "14237")
|
||||
@ExcelProperty("产品所属品类标识符")
|
||||
@Schema(description = "产品分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long categoryId;
|
||||
|
||||
@Schema(description = "产品图标", example = "https://iocoder.cn/1.svg")
|
||||
private String icon;
|
||||
|
||||
@Schema(description = "产品图标", example = "https://iocoder.cn/1.png")
|
||||
private String picUrl;
|
||||
|
||||
@Schema(description = "产品描述", example = "你猜")
|
||||
@ExcelProperty("产品描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "数据校验级别", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("数据校验级别")
|
||||
private Integer validateType;
|
||||
|
||||
@Schema(description = "产品状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("产品状态")
|
||||
private Integer status;
|
||||
|
@ -60,8 +49,24 @@ public class IotProductRespVO {
|
|||
@ExcelProperty("联网方式")
|
||||
private Integer netType;
|
||||
|
||||
@Schema(description = "接入网关协议", example = "2")
|
||||
@ExcelProperty("接入网关协议")
|
||||
private Integer protocolType;
|
||||
|
||||
@Schema(description = "协议编号(脚本解析 id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "13177")
|
||||
@ExcelProperty("协议编号(脚本解析 id)")
|
||||
private Long protocolId;
|
||||
|
||||
@Schema(description = "数据格式")
|
||||
@ExcelProperty("数据格式")
|
||||
private Integer dataFormat;
|
||||
|
||||
@Schema(description = "数据校验级别", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("数据校验级别")
|
||||
private Integer validateType;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package cn.iocoder.yudao.module.iot.controller.admin.product.vo;
|
||||
package cn.iocoder.yudao.module.iot.controller.admin.product.vo.product;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||
import cn.iocoder.yudao.module.iot.enums.product.*;
|
||||
|
@ -14,17 +14,26 @@ public class IotProductSaveReqVO {
|
|||
@Schema(description = "产品编号", requiredMode = Schema.RequiredMode.AUTO, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "产品 Key", requiredMode = Schema.RequiredMode.AUTO, example = "12345abc")
|
||||
private String productKey;
|
||||
|
||||
// TODO 芋艿:品类
|
||||
|
||||
// TODO 芋艿:【待确定】保活时长、产品图标、产品图片
|
||||
|
||||
@Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "温湿度")
|
||||
@NotEmpty(message = "产品名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "产品 Key", requiredMode = Schema.RequiredMode.AUTO, example = "12345abc")
|
||||
private String productKey;
|
||||
|
||||
@Schema(description = "产品分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "产品分类编号不能为空")
|
||||
private Long categoryId;
|
||||
|
||||
@Schema(description = "产品图标", example = "https://iocoder.cn/1.svg")
|
||||
private String icon;
|
||||
|
||||
@Schema(description = "产品图标", example = "https://iocoder.cn/1.png")
|
||||
private String picUrl;
|
||||
|
||||
@Schema(description = "产品描述", example = "描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "设备类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
|
||||
@InEnum(value = IotProductDeviceTypeEnum.class, message = "设备类型必须是 {value}")
|
||||
@NotNull(message = "设备类型不能为空")
|
||||
|
@ -48,7 +57,4 @@ public class IotProductSaveReqVO {
|
|||
@NotNull(message = "数据校验级别不能为空")
|
||||
private Integer validateType;
|
||||
|
||||
@Schema(description = "产品描述", example = "描述")
|
||||
private String description;
|
||||
|
||||
}
|
|
@ -30,17 +30,24 @@ public class IotProductDO extends BaseDO {
|
|||
* 产品名称
|
||||
*/
|
||||
private String name;
|
||||
// TODO @haohao:这个字段,要不改成 identifier,和阿里云更统一些
|
||||
/**
|
||||
* 产品标识
|
||||
*/
|
||||
private String productKey;
|
||||
/**
|
||||
* 产品所属品类编号
|
||||
* 产品分类编号
|
||||
* <p>
|
||||
* TODO 外键:后续加
|
||||
* 关联 {@link IotProductCategoryDO#getId()}
|
||||
*/
|
||||
private Long categoryId;
|
||||
/**
|
||||
* 产品图标
|
||||
*/
|
||||
private String icon;
|
||||
/**
|
||||
* 产品图片
|
||||
*/
|
||||
private String picUrl;
|
||||
/**
|
||||
* 产品描述
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.iot.dal.mysql.product;
|
|||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.iot.controller.admin.product.vo.IotProductPageReqVO;
|
||||
import cn.iocoder.yudao.module.iot.controller.admin.product.vo.product.IotProductPageReqVO;
|
||||
import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package cn.iocoder.yudao.module.iot.service.product;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.iot.controller.admin.product.vo.IotProductPageReqVO;
|
||||
import cn.iocoder.yudao.module.iot.controller.admin.product.vo.IotProductSaveReqVO;
|
||||
import cn.iocoder.yudao.module.iot.controller.admin.product.vo.product.IotProductPageReqVO;
|
||||
import cn.iocoder.yudao.module.iot.controller.admin.product.vo.product.IotProductSaveReqVO;
|
||||
import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.iot.service.product;
|
|||
import cn.hutool.core.util.StrUtil;
|
||||
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.IotProductPageReqVO;
|
||||
import cn.iocoder.yudao.module.iot.controller.admin.product.vo.IotProductSaveReqVO;
|
||||
import cn.iocoder.yudao.module.iot.controller.admin.product.vo.product.IotProductPageReqVO;
|
||||
import cn.iocoder.yudao.module.iot.controller.admin.product.vo.product.IotProductSaveReqVO;
|
||||
import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO;
|
||||
import cn.iocoder.yudao.module.iot.dal.mysql.product.IotProductMapper;
|
||||
import cn.iocoder.yudao.module.iot.enums.product.IotProductStatusEnum;
|
||||
|
@ -14,7 +14,6 @@ import jakarta.annotation.Resource;
|
|||
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.List;
|
||||
|
|
|
@ -44,7 +44,7 @@ public class PayNotifyLogDO extends BaseDO {
|
|||
/**
|
||||
* 支付通知状态
|
||||
*
|
||||
* 外键 {@link PayNotifyStatusEnum}
|
||||
* 枚举 {@link PayNotifyStatusEnum}
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ public class PayNotifyTaskDO extends TenantBaseDO {
|
|||
/**
|
||||
* 通知类型
|
||||
*
|
||||
* 外键 {@link PayNotifyTypeEnum}
|
||||
* 枚举 {@link PayNotifyTypeEnum}
|
||||
*/
|
||||
private Integer type;
|
||||
/**
|
||||
|
@ -73,7 +73,7 @@ public class PayNotifyTaskDO extends TenantBaseDO {
|
|||
/**
|
||||
* 通知状态
|
||||
*
|
||||
* 外键 {@link PayNotifyStatusEnum}
|
||||
* 枚举 {@link PayNotifyStatusEnum}
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue