疯狂的狮子li
2020-07-20 1e79d6f56fbd9a054800f1c62fd95bacda37c6b3
ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,271 @@
package com.ruoyi.generator.domain;
import java.util.List;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import org.apache.commons.lang3.ArrayUtils;
import com.ruoyi.common.constant.GenConstants;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.utils.StringUtils;
/**
 * ä¸šåŠ¡è¡¨ gen_table
 *
 * @author ruoyi
 */
public class GenTable extends BaseEntity
{
    private static final long serialVersionUID = 1L;
    /** ç¼–号 */
    private Long tableId;
    /** è¡¨åç§° */
    @NotBlank(message = "表名称不能为空")
    private String tableName;
    /** è¡¨æè¿° */
    @NotBlank(message = "表描述不能为空")
    private String tableComment;
    /** å®žä½“类名称(首字母大写) */
    @NotBlank(message = "实体类名称不能为空")
    private String className;
    /** ä½¿ç”¨çš„æ¨¡æ¿ï¼ˆcrud单表操作 tree树表操作) */
    private String tplCategory;
    /** ç”ŸæˆåŒ…路径 */
    @NotBlank(message = "生成包路径不能为空")
    private String packageName;
    /** ç”Ÿæˆæ¨¡å—名 */
    @NotBlank(message = "生成模块名不能为空")
    private String moduleName;
    /** ç”Ÿæˆä¸šåŠ¡å */
    @NotBlank(message = "生成业务名不能为空")
    private String businessName;
    /** ç”ŸæˆåŠŸèƒ½å */
    @NotBlank(message = "生成功能名不能为空")
    private String functionName;
    /** ç”Ÿæˆä½œè€… */
    @NotBlank(message = "作者不能为空")
    private String functionAuthor;
    /** ä¸»é”®ä¿¡æ¯ */
    private GenTableColumn pkColumn;
    /** è¡¨åˆ—信息 */
    @Valid
    private List<GenTableColumn> columns;
    /** å…¶å®ƒç”Ÿæˆé€‰é¡¹ */
    private String options;
    /** æ ‘编码字段 */
    private String treeCode;
    /** æ ‘父编码字段 */
    private String treeParentCode;
    /** æ ‘名称字段 */
    private String treeName;
    public Long getTableId()
    {
        return tableId;
    }
    public void setTableId(Long tableId)
    {
        this.tableId = tableId;
    }
    public String getTableName()
    {
        return tableName;
    }
    public void setTableName(String tableName)
    {
        this.tableName = tableName;
    }
    public String getTableComment()
    {
        return tableComment;
    }
    public void setTableComment(String tableComment)
    {
        this.tableComment = tableComment;
    }
    public String getClassName()
    {
        return className;
    }
    public void setClassName(String className)
    {
        this.className = className;
    }
    public String getTplCategory()
    {
        return tplCategory;
    }
    public void setTplCategory(String tplCategory)
    {
        this.tplCategory = tplCategory;
    }
    public String getPackageName()
    {
        return packageName;
    }
    public void setPackageName(String packageName)
    {
        this.packageName = packageName;
    }
    public String getModuleName()
    {
        return moduleName;
    }
    public void setModuleName(String moduleName)
    {
        this.moduleName = moduleName;
    }
    public String getBusinessName()
    {
        return businessName;
    }
    public void setBusinessName(String businessName)
    {
        this.businessName = businessName;
    }
    public String getFunctionName()
    {
        return functionName;
    }
    public void setFunctionName(String functionName)
    {
        this.functionName = functionName;
    }
    public String getFunctionAuthor()
    {
        return functionAuthor;
    }
    public void setFunctionAuthor(String functionAuthor)
    {
        this.functionAuthor = functionAuthor;
    }
    public GenTableColumn getPkColumn()
    {
        return pkColumn;
    }
    public void setPkColumn(GenTableColumn pkColumn)
    {
        this.pkColumn = pkColumn;
    }
    public List<GenTableColumn> getColumns()
    {
        return columns;
    }
    public void setColumns(List<GenTableColumn> columns)
    {
        this.columns = columns;
    }
    public String getOptions()
    {
        return options;
    }
    public void setOptions(String options)
    {
        this.options = options;
    }
    public String getTreeCode()
    {
        return treeCode;
    }
    public void setTreeCode(String treeCode)
    {
        this.treeCode = treeCode;
    }
    public String getTreeParentCode()
    {
        return treeParentCode;
    }
    public void setTreeParentCode(String treeParentCode)
    {
        this.treeParentCode = treeParentCode;
    }
    public String getTreeName()
    {
        return treeName;
    }
    public void setTreeName(String treeName)
    {
        this.treeName = treeName;
    }
    public boolean isTree()
    {
        return isTree(this.tplCategory);
    }
    public static boolean isTree(String tplCategory)
    {
        return tplCategory != null && StringUtils.equals(GenConstants.TPL_TREE, tplCategory);
    }
    public boolean isCrud()
    {
        return isCrud(this.tplCategory);
    }
    public static boolean isCrud(String tplCategory)
    {
        return tplCategory != null && StringUtils.equals(GenConstants.TPL_CRUD, tplCategory);
    }
    public boolean isSuperColumn(String javaField)
    {
        return isSuperColumn(this.tplCategory, javaField);
    }
    public static boolean isSuperColumn(String tplCategory, String javaField)
    {
        if (isTree(tplCategory))
        {
            return StringUtils.equalsAnyIgnoreCase(javaField,
                    ArrayUtils.addAll(GenConstants.TREE_ENTITY, GenConstants.BASE_ENTITY));
        }
        return StringUtils.equalsAnyIgnoreCase(javaField, GenConstants.BASE_ENTITY);
    }
}