优化校验规则

This commit is contained in:
zhou-hao 2020-04-15 12:45:29 +08:00
parent 7ebba6ec6b
commit db5fa69e03
2 changed files with 7 additions and 1 deletions

View File

@ -20,6 +20,7 @@ import javax.persistence.GeneratedValue;
import javax.persistence.Index;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.sql.JDBCType;
import java.util.Collections;
import java.util.Map;
@ -33,6 +34,7 @@ public class DeviceInstanceEntity extends GenericEntity<String> implements Recor
@Override
@GeneratedValue(generator = Generators.SNOW_FLAKE)
@Pattern(regexp = "^[0-9a-zA-Z_\\-]+$", message = "ID只能由英文下划线和中划线组成",groups = CreateGroup.class)
public String getId() {
return super.getId();
}

View File

@ -15,6 +15,7 @@ import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.sql.JDBCType;
import java.util.Map;
@ -25,6 +26,10 @@ public class DeviceProductEntity extends GenericEntity<String> implements Record
@Override
@GeneratedValue(generator = Generators.SNOW_FLAKE)
@Pattern(
regexp = "^[0-9a-zA-Z_\\-]+$",
message = "ID只能由英文下划线和中划线组成",
groups = CreateGroup.class)
public String getId() {
return super.getId();
}
@ -61,7 +66,6 @@ public class DeviceProductEntity extends GenericEntity<String> implements Record
@Comment("协议元数据")
@Column(name = "metadata")
@ColumnType(jdbcType = JDBCType.CLOB)
@NotBlank(message = "元数据不能为空",groups = CreateGroup.class)
private String metadata;
@Comment("传输协议: MQTT,COAP,UDP")