疯狂的狮子Li
2023-01-13 0fc796b90d3f44b81ef30285edb897223df439f7
ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java
@@ -1,323 +1,206 @@
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.baomidou.mybatisplus.annotation.*;
import com.ruoyi.common.constant.GenConstants;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.utils.StringUtils;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.ArrayUtils;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import java.util.List;
/**
 * 业务表 gen_table
 *
 * @author ruoyi
 *
 * @author Lion Li
 */
public class GenTable extends BaseEntity
{
    private static final long serialVersionUID = 1L;
    /** 编号 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("gen_table")
public class GenTable extends BaseEntity {
    /**
     * 编号
     */
    @TableId(value = "table_id")
    private Long tableId;
    /** 表名称 */
    /**
     * 表名称
     */
    @NotBlank(message = "表名称不能为空")
    private String tableName;
    /** 表描述 */
    /**
     * 表描述
     */
    @NotBlank(message = "表描述不能为空")
    private String tableComment;
    /** 实体类名称(首字母大写) */
    /**
     * 关联父表的表名
     */
    private String subTableName;
    /**
     * 本表关联父表的外键名
     */
    private String subTableFkName;
    /**
     * 实体类名称(首字母大写)
     */
    @NotBlank(message = "实体类名称不能为空")
    private String className;
    /** 使用的模板(crud单表操作 tree树表操作) */
    /**
     * 使用的模板(crud单表操作 tree树表操作 sub主子表操作)
     */
    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;
    /** 生成代码方式(0zip压缩包 1自定义路径) */
    /**
     * 生成代码方式(0zip压缩包 1自定义路径)
     */
    private String genType;
    /** 生成路径(不填默认项目路径) */
    /**
     * 生成路径(不填默认项目路径)
     */
    @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
    private String genPath;
    /** 主键信息 */
    /**
     * 主键信息
     */
    @TableField(exist = false)
    private GenTableColumn pkColumn;
    /** 表列信息 */
    /**
     * 子表信息
     */
    @TableField(exist = false)
    private GenTable subTable;
    /**
     * 表列信息
     */
    @Valid
    @TableField(exist = false)
    private List<GenTableColumn> columns;
    /** 其它生成选项 */
    /**
     * 其它生成选项
     */
    private String options;
    /** 树编码字段 */
    /**
     * 备注
     */
    private String remark;
    /**
     * 树编码字段
     */
    @TableField(exist = false)
    private String treeCode;
    /** 树父编码字段 */
    /**
     * 树父编码字段
     */
    @TableField(exist = false)
    private String treeParentCode;
    /** 树名称字段 */
    /**
     * 树名称字段
     */
    @TableField(exist = false)
    private String treeName;
    /** 上级菜单ID字段 */
    /*
     * 菜单id列表
     */
    @TableField(exist = false)
    private List<Long> menuIds;
    /**
     * 上级菜单ID字段
     */
    @TableField(exist = false)
    private String parentMenuId;
    /** 上级菜单名称字段 */
    /**
     * 上级菜单名称字段
     */
    @TableField(exist = false)
    private String parentMenuName;
    public Long getTableId()
    {
        return tableId;
    public boolean isSub() {
        return isSub(this.tplCategory);
    }
    public void setTableId(Long tableId)
    {
        this.tableId = tableId;
    public static boolean isSub(String tplCategory) {
        return tplCategory != null && StringUtils.equals(GenConstants.TPL_SUB, tplCategory);
    }
    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 String getGenType()
    {
        return genType;
    }
    public void setGenType(String genType)
    {
        this.genType = genType;
    }
    public String getGenPath()
    {
        return genPath;
    }
    public void setGenPath(String genPath)
    {
        this.genPath = genPath;
    }
    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 String getParentMenuId()
    {
        return parentMenuId;
    }
    public void setParentMenuId(String parentMenuId)
    {
        this.parentMenuId = parentMenuId;
    }
    public String getParentMenuName()
    {
        return parentMenuName;
    }
    public void setParentMenuName(String parentMenuName)
    {
        this.parentMenuName = parentMenuName;
    }
    public boolean isTree()
    {
    public boolean isTree() {
        return isTree(this.tplCategory);
    }
    public static boolean isTree(String tplCategory)
    {
    public static boolean isTree(String tplCategory) {
        return tplCategory != null && StringUtils.equals(GenConstants.TPL_TREE, tplCategory);
    }
    public boolean isCrud()
    {
    public boolean isCrud() {
        return isCrud(this.tplCategory);
    }
    public static boolean isCrud(String tplCategory)
    {
    public static boolean isCrud(String tplCategory) {
        return tplCategory != null && StringUtils.equals(GenConstants.TPL_CRUD, tplCategory);
    }
    public boolean isSuperColumn(String javaField)
    {
    public boolean isSuperColumn(String javaField) {
        return isSuperColumn(this.tplCategory, javaField);
    }
    public static boolean isSuperColumn(String tplCategory, String javaField)
    {
        if (isTree(tplCategory))
        {
    public static boolean isSuperColumn(String tplCategory, String javaField) {
        if (isTree(tplCategory)) {
            return StringUtils.equalsAnyIgnoreCase(javaField,
                    ArrayUtils.addAll(GenConstants.TREE_ENTITY, GenConstants.BASE_ENTITY));
                ArrayUtils.addAll(GenConstants.TREE_ENTITY, GenConstants.BASE_ENTITY));
        }
        return StringUtils.equalsAnyIgnoreCase(javaField, GenConstants.BASE_ENTITY);
    }
}
}