1.校验修改
This commit is contained in:
@@ -229,6 +229,11 @@ public interface PatternRegex {
|
||||
*/
|
||||
String POSITIVE = "^[0-9].*$";
|
||||
|
||||
/**
|
||||
* 大于0的数字(整数以及小数)
|
||||
*/
|
||||
String POSITIVEALL_NUM = "^(?:[1-9]\\d*(\\.\\d+)?)$";
|
||||
|
||||
/**
|
||||
* 资源名称
|
||||
*/
|
||||
|
||||
@@ -6,10 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 线路信息表
|
||||
@@ -68,7 +65,7 @@ public class LineParam {
|
||||
*/
|
||||
@ApiModelProperty(name = "devCapacity",value = "设备容量",required = true)
|
||||
@NotNull(message = "设备容量不可为空")
|
||||
@Min(value = 1,message = "设备容量格式有误")
|
||||
@Pattern(regexp=PatternRegex.POSITIVEALL_NUM,message = "设备容量格式有误")
|
||||
private Float devCapacity;
|
||||
|
||||
/**
|
||||
@@ -76,7 +73,7 @@ public class LineParam {
|
||||
*/
|
||||
@ApiModelProperty(name = "shortCapacity",value = "短路容量",required = true)
|
||||
@NotNull(message = "短路容量不可为空")
|
||||
@Min(value = 1,message = "设备容量格式有误")
|
||||
@Pattern(regexp=PatternRegex.POSITIVEALL_NUM,message = "短路容量格式有误")
|
||||
private Float shortCapacity;
|
||||
|
||||
/**
|
||||
@@ -84,7 +81,7 @@ public class LineParam {
|
||||
*/
|
||||
@ApiModelProperty(name = "dealCapacity",value = "协议容量",required = true)
|
||||
@NotNull(message = "协议容量不可为空")
|
||||
@Min(value = 1,message = "设备容量格式有误")
|
||||
@Pattern(regexp=PatternRegex.POSITIVEALL_NUM,message = "协议容量格式有误")
|
||||
private Float dealCapacity;
|
||||
|
||||
/**
|
||||
@@ -92,7 +89,7 @@ public class LineParam {
|
||||
*/
|
||||
@ApiModelProperty(name = "standardCapacity",value = "基准容量新增时候可为空",required = true)
|
||||
@NotNull(message = "基准容量不可为空")
|
||||
@Min(value = 1,message = "设备容量格式有误")
|
||||
@Pattern(regexp=PatternRegex.POSITIVEALL_NUM,message = "基准容量格式有误")
|
||||
private Float standardCapacity;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user