From a12f6472da6118fa6e70211c3a86063239b97528 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期二, 17 一月 2023 16:24:06 +0800 Subject: [PATCH] update 优化 实体类中校验注解的提示信息 --- ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java | 161 +++++++++++++++++++---------------------------------- 1 files changed, 58 insertions(+), 103 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java index 1f1fcf4..a751c74 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java @@ -1,123 +1,78 @@ package com.ruoyi.system.domain; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.Size; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.annotation.Excel.ColumnType; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ruoyi.common.annotation.ExcelDictFormat; +import com.ruoyi.common.convert.ExcelDictConvert; import com.ruoyi.common.core.domain.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; /** * 宀椾綅琛� sys_post - * - * @author ruoyi + * + * @author Lion Li */ -public class SysPost extends BaseEntity -{ - private static final long serialVersionUID = 1L; - /** 宀椾綅搴忓彿 */ - @Excel(name = "宀椾綅搴忓彿", cellType = ColumnType.NUMERIC) +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("sys_post") +@ExcelIgnoreUnannotated +public class SysPost extends BaseEntity { + + /** + * 宀椾綅搴忓彿 + */ + @ExcelProperty(value = "宀椾綅搴忓彿") + @TableId(value = "post_id") private Long postId; - /** 宀椾綅缂栫爜 */ - @Excel(name = "宀椾綅缂栫爜") + /** + * 宀椾綅缂栫爜 + */ + @ExcelProperty(value = "宀椾綅缂栫爜") + @NotBlank(message = "宀椾綅缂栫爜涓嶈兘涓虹┖") + @Size(min = 0, max = 64, message = "宀椾綅缂栫爜闀垮害涓嶈兘瓒呰繃{max}涓瓧绗�") private String postCode; - /** 宀椾綅鍚嶇О */ - @Excel(name = "宀椾綅鍚嶇О") + /** + * 宀椾綅鍚嶇О + */ + @ExcelProperty(value = "宀椾綅鍚嶇О") + @NotBlank(message = "宀椾綅鍚嶇О涓嶈兘涓虹┖") + @Size(min = 0, max = 50, message = "宀椾綅鍚嶇О闀垮害涓嶈兘瓒呰繃{max}涓瓧绗�") private String postName; - /** 宀椾綅鎺掑簭 */ - @Excel(name = "宀椾綅鎺掑簭") - private String postSort; + /** + * 宀椾綅鎺掑簭 + */ + @ExcelProperty(value = "宀椾綅鎺掑簭") + @NotNull(message = "鏄剧ず椤哄簭涓嶈兘涓虹┖") + private Integer postSort; - /** 鐘舵�侊紙0姝e父 1鍋滅敤锛� */ - @Excel(name = "鐘舵��", readConverterExp = "0=姝e父,1=鍋滅敤") + /** + * 鐘舵�侊紙0姝e父 1鍋滅敤锛� + */ + @ExcelProperty(value = "鐘舵��", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "sys_normal_disable") private String status; - /** 鐢ㄦ埛鏄惁瀛樺湪姝ゅ矖浣嶆爣璇� 榛樿涓嶅瓨鍦� */ + /** + * 澶囨敞 + */ + private String remark; + + /** + * 鐢ㄦ埛鏄惁瀛樺湪姝ゅ矖浣嶆爣璇� 榛樿涓嶅瓨鍦� + */ + @TableField(exist = false) private boolean flag = false; - public Long getPostId() - { - return postId; - } - - public void setPostId(Long postId) - { - this.postId = postId; - } - - @NotBlank(message = "宀椾綅缂栫爜涓嶈兘涓虹┖") - @Size(min = 0, max = 64, message = "宀椾綅缂栫爜闀垮害涓嶈兘瓒呰繃64涓瓧绗�") - public String getPostCode() - { - return postCode; - } - - public void setPostCode(String postCode) - { - this.postCode = postCode; - } - - @NotBlank(message = "宀椾綅鍚嶇О涓嶈兘涓虹┖") - @Size(min = 0, max = 50, message = "宀椾綅鍚嶇О闀垮害涓嶈兘瓒呰繃50涓瓧绗�") - public String getPostName() - { - return postName; - } - - public void setPostName(String postName) - { - this.postName = postName; - } - - @NotBlank(message = "鏄剧ず椤哄簭涓嶈兘涓虹┖") - public String getPostSort() - { - return postSort; - } - - public void setPostSort(String postSort) - { - this.postSort = postSort; - } - - public String getStatus() - { - return status; - } - - public void setStatus(String status) - { - this.status = status; - } - - public boolean isFlag() - { - return flag; - } - - public void setFlag(boolean flag) - { - this.flag = flag; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("postId", getPostId()) - .append("postCode", getPostCode()) - .append("postName", getPostName()) - .append("postSort", getPostSort()) - .append("status", getStatus()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .append("remark", getRemark()) - .toString(); - } } -- Gitblit v1.9.3