mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 07:11:52 +08:00
修改:新增产品枚举
This commit is contained in:
parent
f7b62b4bcc
commit
037ab39ac7
@ -1,13 +0,0 @@
|
||||
package cn.iocoder.yudao.module.iot.enums;
|
||||
|
||||
/**
|
||||
* 产品设备类型常量
|
||||
*/
|
||||
public interface ProductDeviceTypeConstants {
|
||||
|
||||
// ========== 产品设备类型 ============
|
||||
String DEVICE = "device"; // 直连设备
|
||||
String GATEWAY = "gateway"; // 网关设备
|
||||
String GATEWAY_SUB = "gateway_sub"; // 网关子设备
|
||||
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
package cn.iocoder.yudao.module.iot.enums;
|
||||
|
||||
/**
|
||||
* 产品传输协议类型常量
|
||||
*/
|
||||
public interface ProductProtocolTypeConstants {
|
||||
|
||||
// ========== 产品传输协议类型 ============
|
||||
String MQTT = "mqtt"; // MQTT
|
||||
String COAP = "coap"; // COAP
|
||||
String HTTP = "http"; // HTTP
|
||||
String HTTPS = "https"; // HTTPS
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.yudao.module.iot.enums;
|
||||
package cn.iocoder.yudao.module.iot.enums.product;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
@ -8,14 +8,14 @@ import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 产品数据格式枚举类
|
||||
* 1. 标准数据格式(JSON)2. 透传/自定义
|
||||
* 数据格式, 0: 标准数据格式(JSON), 1: 透传/自定义
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum ProductDataFormatEnum implements IntArrayValuable {
|
||||
public enum IotDataFormatEnum implements IntArrayValuable {
|
||||
|
||||
JSON(1, "标准数据格式(JSON)"),
|
||||
SCRIPT(2, "透传/自定义");
|
||||
JSON(0, "标准数据格式(JSON)"),
|
||||
CUSTOMIZE(1, "透传/自定义");
|
||||
|
||||
/**
|
||||
* 类型
|
||||
@ -27,7 +27,7 @@ public enum ProductDataFormatEnum implements IntArrayValuable {
|
||||
*/
|
||||
private final String description;
|
||||
|
||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ProductDataFormatEnum::getType).toArray();
|
||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(IotDataFormatEnum::getType).toArray();
|
||||
|
||||
@Override
|
||||
public int[] array() {
|
@ -0,0 +1,40 @@
|
||||
package cn.iocoder.yudao.module.iot.enums.product;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* IOT 联网方式枚举类
|
||||
* 联网方式, 0: Wi-Fi, 1: Cellular, 2: Ethernet, 3: 其他
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum IotNetTypeEnum implements IntArrayValuable {
|
||||
|
||||
WIFI(0, "Wi-Fi"),
|
||||
CELLULAR(1, "Cellular"),
|
||||
ETHERNET(2, "Ethernet"),
|
||||
OTHER(3, "其他");
|
||||
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final Integer type;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private final String description;
|
||||
|
||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(IotNetTypeEnum::getType).toArray();
|
||||
|
||||
@Override
|
||||
public int[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.iot.enums.product;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* IOT 产品设备类型
|
||||
* 设备类型, 0: 直连设备, 1: 网关子设备, 2: 网关设备
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum IotProductDeviceTypeEnum implements IntArrayValuable {
|
||||
|
||||
DIRECT(0, "直连设备"),
|
||||
GATEWAY_CHILD(1, "网关子设备"),
|
||||
GATEWAY(2, "网关设备");
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final Integer type;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private final String description;
|
||||
|
||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(IotProductDeviceTypeEnum::getType).toArray();
|
||||
|
||||
@Override
|
||||
public int[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
}
|
@ -1,19 +1,19 @@
|
||||
package cn.iocoder.yudao.module.iot.enums;
|
||||
package cn.iocoder.yudao.module.iot.enums.product;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 产品状态枚举类
|
||||
* 禁用 启用
|
||||
* IOT 产品状态枚举类
|
||||
* 产品状态, 0: 未发布, 1: 已发布
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum ProductStatusEnum implements IntArrayValuable {
|
||||
public enum IotProductStatusEnum implements IntArrayValuable {
|
||||
|
||||
DISABLE(0, "禁用"),
|
||||
ENABLE(1, "启用");
|
||||
UNPUBLISHED(0, "未发布"),
|
||||
PUBLISHED(1, "已发布");
|
||||
|
||||
/**
|
||||
* 类型
|
@ -0,0 +1,41 @@
|
||||
package cn.iocoder.yudao.module.iot.enums.product;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* IOT 接入网关协议枚举类
|
||||
* 接入网关协议, 0: 自定义, 1: Modbus, 2: OPC UA, 3: ZigBee, 4: BLE
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum IotProtocolTypeEnum implements IntArrayValuable {
|
||||
|
||||
CUSTOM(0, "自定义"),
|
||||
MODBUS(1, "Modbus"),
|
||||
OPC_UA(2, "OPC UA"),
|
||||
ZIGBEE(3, "ZigBee"),
|
||||
BLE(4, "BLE");
|
||||
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final Integer type;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private final String description;
|
||||
|
||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(IotProtocolTypeEnum::getType).toArray();
|
||||
|
||||
@Override
|
||||
public int[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.iot.enums.product;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* IOT 数据校验级别枚举类
|
||||
* 数据校验级别, 0: 弱校验, 1: 免校验
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum IotValidateTypeEnum implements IntArrayValuable {
|
||||
|
||||
WEAK(0, "弱校验"),
|
||||
NONE(1, "免校验");
|
||||
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final Integer type;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private final String description;
|
||||
|
||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(IotValidateTypeEnum::getType).toArray();
|
||||
|
||||
@Override
|
||||
public int[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
package cn.iocoder.yudao.module.iot.controller.admin.product.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||
import cn.iocoder.yudao.module.iot.enums.product.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
@ -20,22 +22,25 @@ public class ProductSaveReqVO {
|
||||
private String name;
|
||||
|
||||
@Schema(description = "设备类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
|
||||
@InEnum(value = IotProductDeviceTypeEnum.class, message = "设备类型必须是 {value}")
|
||||
@NotNull(message = "设备类型不能为空")
|
||||
private Integer deviceType;
|
||||
|
||||
@Schema(description = "联网方式", requiredMode = Schema.RequiredMode.REQUIRED,example = "0")
|
||||
@NotNull(message = "联网方式不能为空")
|
||||
@InEnum(value = IotNetTypeEnum.class, message = "联网方式必须是 {value}")
|
||||
private Integer netType;
|
||||
|
||||
@Schema(description = "接入网关协议", requiredMode = Schema.RequiredMode.REQUIRED,example = "0")
|
||||
@NotNull(message = "接入网关协议不能为空")
|
||||
@InEnum(value = IotProtocolTypeEnum.class, message = "接入网关协议必须是 {value}")
|
||||
private Integer protocolType;
|
||||
|
||||
@Schema(description = "数据格式",requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
|
||||
@InEnum(value = IotDataFormatEnum.class, message = "数据格式必须是 {value}")
|
||||
@NotNull(message = "数据格式不能为空")
|
||||
private Integer dataFormat;
|
||||
|
||||
@Schema(description = "数据校验级别", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
|
||||
@InEnum(value = IotValidateTypeEnum.class, message = "数据校验级别必须是 {value}")
|
||||
@NotNull(message = "数据校验级别不能为空")
|
||||
private Integer validateType;
|
||||
|
||||
|
@ -1,13 +1,11 @@
|
||||
package cn.iocoder.yudao.module.iot.dal.mysql.product;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
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.ProductPageReqVO;
|
||||
import cn.iocoder.yudao.module.iot.dal.dataobject.product.ProductDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.iot.controller.admin.product.vo.*;
|
||||
|
||||
/**
|
||||
* iot 产品 Mapper
|
||||
@ -21,7 +19,7 @@ public interface ProductMapper extends BaseMapperX<ProductDO> {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ProductDO>()
|
||||
.likeIfPresent(ProductDO::getName, reqVO.getName())
|
||||
.betweenIfPresent(ProductDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(ProductDO::getProductKey, reqVO.getProductKey())
|
||||
.likeIfPresent(ProductDO::getProductKey, reqVO.getProductKey())
|
||||
.eqIfPresent(ProductDO::getProtocolId, reqVO.getProtocolId())
|
||||
.eqIfPresent(ProductDO::getCategoryId, reqVO.getCategoryId())
|
||||
.eqIfPresent(ProductDO::getDescription, reqVO.getDescription())
|
||||
|
Loading…
Reference in New Issue
Block a user