From f8ab5663ef7220f8adc0fd8fcbd7d0cf84c6d77d Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期一, 02 八月 2021 12:15:14 +0800
Subject: [PATCH] update 日常字符串校验 统一重构到 StringUtils 便于维护扩展

---
 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java |  324 +++++++++++++++++++++---------------------------------
 1 files changed, 126 insertions(+), 198 deletions(-)

diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java
index 9330f8e..a658559 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java
@@ -1,198 +1,126 @@
-package com.ruoyi.common.core.domain.entity;
-
-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.ruoyi.common.core.domain.BaseEntity;
-
-/**
- * 瑙掕壊琛� sys_role
- * 
- * @author ruoyi
- */
-public class SysRole extends BaseEntity
-{
-    private static final long serialVersionUID = 1L;
-
-    /** 瑙掕壊ID */
-    @Excel(name = "瑙掕壊搴忓彿", cellType = ColumnType.NUMERIC)
-    private Long roleId;
-
-    /** 瑙掕壊鍚嶇О */
-    @Excel(name = "瑙掕壊鍚嶇О")
-    private String roleName;
-
-    /** 瑙掕壊鏉冮檺 */
-    @Excel(name = "瑙掕壊鏉冮檺")
-    private String roleKey;
-
-    /** 瑙掕壊鎺掑簭 */
-    @Excel(name = "瑙掕壊鎺掑簭")
-    private String roleSort;
-
-    /** 鏁版嵁鑼冨洿锛�1锛氭墍鏈夋暟鎹潈闄愶紱2锛氳嚜瀹氫箟鏁版嵁鏉冮檺锛�3锛氭湰閮ㄩ棬鏁版嵁鏉冮檺锛�4锛氭湰閮ㄩ棬鍙婁互涓嬫暟鎹潈闄愶級 */
-    @Excel(name = "鏁版嵁鑼冨洿", readConverterExp = "1=鎵�鏈夋暟鎹潈闄�,2=鑷畾涔夋暟鎹潈闄�,3=鏈儴闂ㄦ暟鎹潈闄�,4=鏈儴闂ㄥ強浠ヤ笅鏁版嵁鏉冮檺")
-    private String dataScope;
-
-    /** 瑙掕壊鐘舵�侊紙0姝e父 1鍋滅敤锛� */
-    @Excel(name = "瑙掕壊鐘舵��", readConverterExp = "0=姝e父,1=鍋滅敤")
-    private String status;
-
-    /** 鍒犻櫎鏍囧織锛�0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛� */
-    private String delFlag;
-
-    /** 鐢ㄦ埛鏄惁瀛樺湪姝よ鑹叉爣璇� 榛樿涓嶅瓨鍦� */
-    private boolean flag = false;
-
-    /** 鑿滃崟缁� */
-    private Long[] menuIds;
-
-    /** 閮ㄩ棬缁勶紙鏁版嵁鏉冮檺锛� */
-    private Long[] deptIds;
-
-    public SysRole()
-    {
-
-    }
-
-    public SysRole(Long roleId)
-    {
-        this.roleId = roleId;
-    }
-
-    public Long getRoleId()
-    {
-        return roleId;
-    }
-
-    public void setRoleId(Long roleId)
-    {
-        this.roleId = roleId;
-    }
-
-    public boolean isAdmin()
-    {
-        return isAdmin(this.roleId);
-    }
-
-    public static boolean isAdmin(Long roleId)
-    {
-        return roleId != null && 1L == roleId;
-    }
-
-    @NotBlank(message = "瑙掕壊鍚嶇О涓嶈兘涓虹┖")
-    @Size(min = 0, max = 30, message = "瑙掕壊鍚嶇О闀垮害涓嶈兘瓒呰繃30涓瓧绗�")
-    public String getRoleName()
-    {
-        return roleName;
-    }
-
-    public void setRoleName(String roleName)
-    {
-        this.roleName = roleName;
-    }
-
-    @NotBlank(message = "鏉冮檺瀛楃涓嶈兘涓虹┖")
-    @Size(min = 0, max = 100, message = "鏉冮檺瀛楃闀垮害涓嶈兘瓒呰繃100涓瓧绗�")
-    public String getRoleKey()
-    {
-        return roleKey;
-    }
-
-    public void setRoleKey(String roleKey)
-    {
-        this.roleKey = roleKey;
-    }
-
-    @NotBlank(message = "鏄剧ず椤哄簭涓嶈兘涓虹┖")
-    public String getRoleSort()
-    {
-        return roleSort;
-    }
-
-    public void setRoleSort(String roleSort)
-    {
-        this.roleSort = roleSort;
-    }
-
-    public String getDataScope()
-    {
-        return dataScope;
-    }
-
-    public void setDataScope(String dataScope)
-    {
-        this.dataScope = dataScope;
-    }
-
-    public String getStatus()
-    {
-        return status;
-    }
-
-    public void setStatus(String status)
-    {
-        this.status = status;
-    }
-
-    public String getDelFlag()
-    {
-        return delFlag;
-    }
-
-    public void setDelFlag(String delFlag)
-    {
-        this.delFlag = delFlag;
-    }
-
-    public boolean isFlag()
-    {
-        return flag;
-    }
-
-    public void setFlag(boolean flag)
-    {
-        this.flag = flag;
-    }
-
-    public Long[] getMenuIds()
-    {
-        return menuIds;
-    }
-
-    public void setMenuIds(Long[] menuIds)
-    {
-        this.menuIds = menuIds;
-    }
-
-    public Long[] getDeptIds()
-    {
-        return deptIds;
-    }
-
-    public void setDeptIds(Long[] deptIds)
-    {
-        this.deptIds = deptIds;
-    }
-    
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("roleId", getRoleId())
-            .append("roleName", getRoleName())
-            .append("roleKey", getRoleKey())
-            .append("roleSort", getRoleSort())
-            .append("dataScope", getDataScope())
-            .append("status", getStatus())
-            .append("delFlag", getDelFlag())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("remark", getRemark())
-            .toString();
-    }
-}
+package com.ruoyi.common.core.domain.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.annotation.Excel.ColumnType;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.Size;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 瑙掕壊琛� sys_role
+ *
+ * @author ruoyi
+ */
+
+@Data
+@NoArgsConstructor
+@Accessors(chain = true)
+@TableName("sys_role")
+public class SysRole implements Serializable
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 瑙掕壊ID */
+    @Excel(name = "瑙掕壊搴忓彿", cellType = ColumnType.NUMERIC)
+    @TableId(value = "role_id",type = IdType.AUTO)
+    private Long roleId;
+
+    /** 瑙掕壊鍚嶇О */
+    @Excel(name = "瑙掕壊鍚嶇О")
+    @NotBlank(message = "瑙掕壊鍚嶇О涓嶈兘涓虹┖")
+    @Size(min = 0, max = 30, message = "瑙掕壊鍚嶇О闀垮害涓嶈兘瓒呰繃30涓瓧绗�")
+    private String roleName;
+
+    /** 瑙掕壊鏉冮檺 */
+    @Excel(name = "瑙掕壊鏉冮檺")
+    @NotBlank(message = "鏉冮檺瀛楃涓嶈兘涓虹┖")
+    @Size(min = 0, max = 100, message = "鏉冮檺瀛楃闀垮害涓嶈兘瓒呰繃100涓瓧绗�")
+    private String roleKey;
+
+    /** 瑙掕壊鎺掑簭 */
+    @Excel(name = "瑙掕壊鎺掑簭")
+    @NotBlank(message = "鏄剧ず椤哄簭涓嶈兘涓虹┖")
+    private String roleSort;
+
+    /** 鏁版嵁鑼冨洿锛�1锛氭墍鏈夋暟鎹潈闄愶紱2锛氳嚜瀹氫箟鏁版嵁鏉冮檺锛�3锛氭湰閮ㄩ棬鏁版嵁鏉冮檺锛�4锛氭湰閮ㄩ棬鍙婁互涓嬫暟鎹潈闄愶紱5锛氫粎鏈汉鏁版嵁鏉冮檺锛� */
+    @Excel(name = "鏁版嵁鑼冨洿", readConverterExp = "1=鎵�鏈夋暟鎹潈闄�,2=鑷畾涔夋暟鎹潈闄�,3=鏈儴闂ㄦ暟鎹潈闄�,4=鏈儴闂ㄥ強浠ヤ笅鏁版嵁鏉冮檺,5=浠呮湰浜烘暟鎹潈闄�")
+    private String dataScope;
+
+    /** 鑿滃崟鏍戦�夋嫨椤规槸鍚﹀叧鑱旀樉绀猴紙 0锛氱埗瀛愪笉浜掔浉鍏宠仈鏄剧ず 1锛氱埗瀛愪簰鐩稿叧鑱旀樉绀猴級 */
+    private boolean menuCheckStrictly;
+
+    /** 閮ㄩ棬鏍戦�夋嫨椤规槸鍚﹀叧鑱旀樉绀猴紙0锛氱埗瀛愪笉浜掔浉鍏宠仈鏄剧ず 1锛氱埗瀛愪簰鐩稿叧鑱旀樉绀� 锛� */
+    private boolean deptCheckStrictly;
+
+    /** 瑙掕壊鐘舵�侊紙0姝e父 1鍋滅敤锛� */
+    @Excel(name = "瑙掕壊鐘舵��", readConverterExp = "0=姝e父,1=鍋滅敤")
+    private String status;
+
+    /** 鍒犻櫎鏍囧織锛�0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛� */
+    @TableLogic
+    private String delFlag;
+
+    /** 鍒涘缓鑰� */
+    @TableField(fill = FieldFill.INSERT)
+    private String createBy;
+
+    /** 鍒涘缓鏃堕棿 */
+    @TableField(fill = FieldFill.INSERT)
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+    /** 鏇存柊鑰� */
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private String updateBy;
+
+    /** 鏇存柊鏃堕棿 */
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+
+    /** 澶囨敞 */
+    private String remark;
+
+    /**
+     * 璇锋眰鍙傛暟
+     */
+    @TableField(exist = false)
+    private Map<String, Object> params = new HashMap<>();
+
+    /** 鐢ㄦ埛鏄惁瀛樺湪姝よ鑹叉爣璇� 榛樿涓嶅瓨鍦� */
+    @TableField(exist = false)
+    private boolean flag = false;
+
+    /** 鑿滃崟缁� */
+    @TableField(exist = false)
+    private Long[] menuIds;
+
+    /** 閮ㄩ棬缁勶紙鏁版嵁鏉冮檺锛� */
+    @TableField(exist = false)
+    private Long[] deptIds;
+
+    public SysRole(Long roleId)
+    {
+        this.roleId = roleId;
+    }
+
+    public boolean isAdmin()
+    {
+        return isAdmin(this.roleId);
+    }
+
+    public static boolean isAdmin(Long roleId)
+    {
+        return roleId != null && 1L == roleId;
+    }
+
+}

--
Gitblit v1.9.3