package com.mortals.xhx.base.system.gentable.model;

import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.common.utils.StringUtils;
import lombok.Data;

import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

/**
 * Description:Gentable
 * date: 2021-9-29 9:35:30
 */
@Data
public class GentableEntityExt extends BaseEntityLong {

    /**
     * 关联子表的表名
     */
    private String subTableName1;
    /**
     * 子表关联的外键名
     */
    private String subTableFkName1;

    /**
     * 关联子表的表名
     */
    private String subTableName2;
    /**
     * 子表关联的外键名
     */
    private String subTableFkName2;

    /**
     * 关联子表的表名
     */
    private String subTableName3;
    /**
     * 子表关联的外键名
     */
    private String subTableFkName3;


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

    /**
     * 子表信息
     */
    private GentableEntity subTable;
    /**
     * 子表1信息
     */
    private GentableEntity subTable1;
    /**
     * 子表信息
     */
    private GentableEntity subTable2;
    private GentableEntity subTable3;

    private String requestMapping;

    private String code;
    private String name;
    private String desc;


    /**
     * 项目应用访问path
     */
    private String path;

    private List<Long> idList;

    /**
     * 表列信息
     */
    private List<GentableColumnEntity> columns;


    public static boolean isSuperColumn(String javaField) {
        return StringUtils.equalsAnyIgnoreCase(javaField,
                // BaseEntity
                "id", "createUser", "createTime", "updateUser",
                "updateTime", "createUserId", "updateUserId"
                // TreeEntity
                //"parentName", "parentId", "orderNum", "ancestors"

        );
    }


}