package com.whdc.model.entity; import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.extension.activerecord.Model; import com.fasterxml.jackson.annotation.JsonFormat; import com.whdc.model.group.Insert; import com.whdc.model.group.Update; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiParam; import lombok.Data; import lombok.experimental.Accessors; import org.apache.commons.lang3.StringUtils; import javax.validation.constraints.Max; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import java.math.BigDecimal; import java.util.Date; import java.util.Locale; import static com.whdc.model.MyConstant.DEL; import static com.whdc.model.MyConstant.REC; /** *

* *

* * @author xusan * @date 2023-03-19 */ @Data @ApiModel(description = "正常范围规则表") @Accessors(chain = true) @TableName("SHZH_IOT.E_RULE") public class ERule extends Model { private static final long serialVersionUID = 1L; /** * 主键自增 */ @ApiParam(value = "主键自增", required = true) @ApiModelProperty(value = "主键自增", required = true, dataType = "Integer") @TableId(value = "ID", type = IdType.AUTO) @NotNull(message = "主键不能为空", groups = {Update.class}) private Integer id; /** * 规则名称 */ @ApiParam(value = "规则名称", required = true, example = "") @ApiModelProperty(value = "规则名称", required = true, dataType = "String") @TableField(value = "NAME", updateStrategy = FieldStrategy.NOT_EMPTY) @NotEmpty(message = "规则名称不能为空", groups = {Insert.class,Update.class}) @Max(50) private String name; /** * 测站类型 */ @ApiParam(value = "规则类型", required = true, example = "") @ApiModelProperty(value = "规则类型", required = true, dataType = "String") @TableField(value = "ITEM", updateStrategy = FieldStrategy.IGNORED) @NotEmpty(message = "规则类型不能为空", groups = {Insert.class,Update.class}) @Max(50) private String item; public void setItem(String item) { if (StringUtils.isNotBlank(item)){ item = item.toUpperCase(Locale.ROOT); } this.item = item; } /** * 最小值 */ @ApiParam(value = "最小值", required = false, example = "") @ApiModelProperty(value = "最小值", required = false, dataType = "Numeric") @TableField(value = "MIN", updateStrategy = FieldStrategy.IGNORED) @Max(50) private BigDecimal min; /** * 最大值 */ @ApiParam(value = "最大值", required = false, example = "") @ApiModelProperty(value = "最大值", required = false, dataType = "Numeric") @TableField(value = "MAX", updateStrategy = FieldStrategy.IGNORED) @Max(50) private BigDecimal max; /** * 最大值 */ @ApiParam(value = "两条数据之间的最大差值", required = false, example = "") @ApiModelProperty(value = "两条数据之间的最大差值", required = false, dataType = "Numeric") @TableField(value = "DIFF_MAX", updateStrategy = FieldStrategy.IGNORED) private BigDecimal diffMax; /** * 最大值 */ @ApiParam(value = "时间段, 单位 s", required = false, example = "") @ApiModelProperty(value = "时间段, 单位 s", required = false, dataType = "Numeric") @TableField(value = "DURATION", updateStrategy = FieldStrategy.IGNORED) @Max(10) private Integer duration; /** * 接收超出时间,单位: s ,指接收时间超前范围 */ @ApiParam(value = "接收超前时间,单位: s ,指接收时间超前范围", required = false, example = "") @ApiModelProperty(value = "接收超前时间,单位: s ,指接收时间超前范围", required = false, dataType = "Numeric") @TableField(value = "LEADING_TIME", updateStrategy = FieldStrategy.IGNORED) @Max(10) private Integer leadingTime; /** * 接收滞后时间,单位: s ,指接收时间滞后范围 */ @ApiParam(value = "接收滞后时间,单位: s ,指接收时间滞后范围", required = false, example = "") @ApiModelProperty(value = "接收滞后时间,单位: s ,指接收时间滞后范围", required = false, dataType = "Numeric") @TableField(value = "LAG_TIME", updateStrategy = FieldStrategy.IGNORED) @Max(10) private Integer lagTime; /** * 创建时间 */ @ApiParam(value = "创建时间", required = false) @ApiModelProperty(value = "创建时间", required = false, dataType = "Date") @TableField(value = "CREATETIME", updateStrategy = FieldStrategy.NOT_EMPTY) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date createtime; /** * 1: 未删除 0: 删除 */ @ApiParam(value = "1: 未删除 0: 删除", required = false, example = "1") @ApiModelProperty(value = "1: 未删除 0: 删除", required = false, dataType = "String", example = "1") @TableField(value = "DEL", fill = FieldFill.INSERT, updateStrategy = FieldStrategy.NOT_EMPTY) @TableLogic(value = REC,delval = DEL) @Max(2) private String del; }