package com.yunfeiyun.agmp.generator.domain;

import java.util.List;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;

import com.yunfeiyun.agmp.common.annotation.Excel;
import com.yunfeiyun.agmp.common.core.domain.BaseEntity;
import com.yunfeiyun.agmp.common.utils.StringUtils;
import org.apache.commons.lang3.ArrayUtils;
import com.yunfeiyun.agmp.common.constant.GenConstants;

/**
 * 业务表 gen_table
 * 
 * @author 杨晓辉
 */
public class GenTable extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 编号 */
    private String tblId;

    /** 表名称 */
    @NotBlank(message = "表名称不能为空")
    private String tblName;

    /** 表描述 */
    @NotBlank(message = "表描述不能为空")
    private String tblComment;

    /** 关联父表的表名 */
    private String tblSubtablename;

    /** 本表关联父表的外键名 */
    private String tblSubtablefkname;

    /** 实体类名称(首字母大写) */
    @NotBlank(message = "实体类名称不能为空")
    private String tblClassname;

    /** 使用的模板（crud单表操作 tree树表操作 sub主子表操作） */
    private String tblTplcategory;

    /** 生成包路径 */
    @NotBlank(message = "生成包路径不能为空")
    private String tblPackagename;

    /** 生成模块名 */
    @NotBlank(message = "生成模块名不能为空")
    private String tblModulename;

    /** 生成业务名 */
    @NotBlank(message = "生成业务名不能为空")
    private String tblBusinessname;

    /** 生成功能名 */
    @NotBlank(message = "生成功能名不能为空")
    private String tblFunctionname;

    /** 生成作者 */
    @NotBlank(message = "作者不能为空")
    private String tblFunctionauthor;

    /** 生成代码方式（0zip压缩包 1自定义路径） */
    private String tblGentype;

    /** 生成路径（不填默认项目路径） */
    private String tblGenpath;

    /** 主键信息 */
    private GenTableColumn pkColumn;

    /** 子表信息 */
    private GenTable subTable;

    /** 表列信息 */
    @Valid
    private List<GenTableColumn> columns;

    /** 其它生成选项 */
    private String options;

    /** 树编码字段 */
    private String treeCode;

    /** 树父编码字段 */
    private String treeParentCode;

    /** 树名称字段 */
    private String treeName;

    /** 上级菜单ID字段 */
    private String parentMenuId;

    /** 上级菜单名称字段 */
    private String parentMenuName;



    /** 表创建者 */
    @Excel(name = "表创建者")
    private String tblCreator;

    /** 表创建时间 */
    @Excel(name = "表创建时间")
    private String tblCreateddate;

    /** 表更新者 */
    @Excel(name = "表更新者")
    private String tblModifier;

    /** 表更新时间 */
    @Excel(name = "表更新时间")
    private String tblModifieddate;

    /** 表备注 */
    @Excel(name = "表备注")
    private String tblRemark;


    public String getTableId()
    {
        return tblId;
    }

    public void setTableId(String tblId)
    {
        this.tblId = tblId;
    }

    public String getTableName()
    {
        return tblName;
    }

    public void setTableName(String tblName)
    {
        this.tblName = tblName;
    }

    public String getTableComment()
    {
        return tblComment;
    }

    public void setTableComment(String tblComment)
    {
        this.tblComment = tblComment;
    }

    public String getSubTableName()
    {
        return tblSubtablename;
    }

    public void setSubTableName(String tblSubtablename)
    {
        this.tblSubtablename = tblSubtablename;
    }

    public String getSubTableFkName()
    {
        return tblSubtablefkname;
    }

    public void setSubTableFkName(String tblSubtablefkname)
    {
        this.tblSubtablefkname = tblSubtablefkname;
    }

    public String getClassName()
    {
        return tblClassname;
    }

    public void setClassName(String tblClassname)
    {
        this.tblClassname = tblClassname;
    }

    public String getTplCategory()
    {
        return tblTplcategory;
    }

    public void setTplCategory(String tblTplcategory)
    {
        this.tblTplcategory = tblTplcategory;
    }

    public String getPackageName()
    {
        return tblPackagename;
    }

    public void setPackageName(String tblPackagename)
    {
        this.tblPackagename = tblPackagename;
    }

    public String getModuleName()
    {
        return tblModulename;
    }

    public void setModuleName(String tblModulename)
    {
        this.tblModulename = tblModulename;
    }

    public String getBusinessName()
    {
        return tblBusinessname;
    }

    public void setBusinessName(String tblBusinessname)
    {
        this.tblBusinessname = tblBusinessname;
    }

    public String getFunctionName()
    {
        return tblFunctionname;
    }

    public void setFunctionName(String tblFunctionname)
    {
        this.tblFunctionname = tblFunctionname;
    }

    public String getFunctionAuthor()
    {
        return tblFunctionauthor;
    }

    public void setFunctionAuthor(String functionAuthor)
    {
        this.tblFunctionauthor = functionAuthor;
    }

    public String getGenType()
    {
        return tblGentype;
    }

    public void setGenType(String tblGentype)
    {
        this.tblGentype = tblGentype;
    }

    public String getGenPath()
    {
        return tblGenpath;
    }

    public void setGenPath(String tblGenpath)
    {
        this.tblGenpath = tblGenpath;
    }

    public GenTableColumn getPkColumn()
    {
        return pkColumn;
    }

    public void setPkColumn(GenTableColumn pkColumn)
    {
        this.pkColumn = pkColumn;
    }

    public GenTable getSubTable()
    {
        return subTable;
    }

    public void setSubTable(GenTable subTable)
    {
        this.subTable = subTable;
    }

    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 isSub()
    {
        return isSub(this.tblTplcategory);
    }

    public static boolean isSub(String tplCategory)
    {
        return tplCategory != null && StringUtils.equals(GenConstants.TPL_SUB, tplCategory);
    }

    public boolean isTree()
    {
        return isTree(this.tblTplcategory);
    }

    public static boolean isTree(String tplCategory)
    {
        return tplCategory != null && StringUtils.equals(GenConstants.TPL_TREE, tplCategory);
    }

    public boolean isCrud()
    {
        return isCrud(this.tblTplcategory);
    }

    public static boolean isCrud(String tplCategory)
    {
        return tplCategory != null && StringUtils.equals(GenConstants.TPL_CRUD, tplCategory);
    }

    public boolean isSuperColumn(String javaField)
    {
        return isSuperColumn(this.tblTplcategory, 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);
    }



    public String getTblCreator()
    {
        return tblCreator;
    }

    public void setTblCreator(String tblCreator)
    {
        this.tblCreator = tblCreator;
    }

    public String getTblCreateddate()
    {
        return tblCreateddate;
    }

    public void setTblCreateddate(String tblCreateddate)
    {
        this.tblCreateddate = tblCreateddate;
    }

    public String getTblModifier()
    {
        return tblModifier;
    }

    public void setTblModifier(String tblModifier)
    {
        this.tblModifier = tblModifier;
    }

    public String getTblModifieddate()
    {
        return tblModifieddate;
    }

    public void setTblModifieddate(String tblModifieddate)
    {
        this.tblModifieddate = tblModifieddate;
    }

    public String getTblRemark()
    {
        return tblRemark;
    }

    public void setTblRemark(String tblRemark)
    {
        this.tblRemark = tblRemark;
    }









}