/*
 * This file is generated by jOOQ.
 */
package jj.tech.paolu.repository.jooq.tables;


import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.function.Function;

import jj.tech.paolu.repository.jooq.Keys;
import jj.tech.paolu.repository.jooq.Yx;
import jj.tech.paolu.repository.jooq.tables.records.SysConfigRecord;

import org.jooq.Field;
import org.jooq.ForeignKey;
import org.jooq.Function7;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Records;
import org.jooq.Row7;
import org.jooq.Schema;
import org.jooq.SelectField;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.TableOptions;
import org.jooq.UniqueKey;
import org.jooq.impl.DSL;
import org.jooq.impl.SQLDataType;
import org.jooq.impl.TableImpl;


/**
 * This class is generated by jOOQ.
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" })
public class SysConfig extends TableImpl<SysConfigRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>yx.sys_config</code>
     */
    public static final SysConfig SYS_CONFIG = new SysConfig();

    /**
     * The class holding records for this type
     */
    @Override
    public Class<SysConfigRecord> getRecordType() {
        return SysConfigRecord.class;
    }

    /**
     * The column <code>yx.sys_config.id</code>.
     */
    public final TableField<SysConfigRecord, String> ID = createField(DSL.name("id"), SQLDataType.VARCHAR(20).nullable(false), this, "");

    /**
     * The column <code>yx.sys_config.subgroup</code>. 分组
     */
    public final TableField<SysConfigRecord, String> SUBGROUP = createField(DSL.name("subgroup"), SQLDataType.VARCHAR(500).nullable(false), this, "分组");

    /**
     * The column <code>yx.sys_config.k</code>. 键
     */
    public final TableField<SysConfigRecord, String> K = createField(DSL.name("k"), SQLDataType.VARCHAR(1000).nullable(false), this, "键");

    /**
     * The column <code>yx.sys_config.val</code>. 值
     */
    public final TableField<SysConfigRecord, String> VAL = createField(DSL.name("val"), SQLDataType.VARCHAR(14000).defaultValue(DSL.field(DSL.raw("NULL"), SQLDataType.VARCHAR)), this, "值");

    /**
     * The column <code>yx.sys_config.admin_id</code>. 管理员id
     */
    public final TableField<SysConfigRecord, String> ADMIN_ID = createField(DSL.name("admin_id"), SQLDataType.VARCHAR(20).nullable(false), this, "管理员id");

    /**
     * The column <code>yx.sys_config.adminname</code>. 管理员名称
     */
    public final TableField<SysConfigRecord, String> ADMINNAME = createField(DSL.name("adminname"), SQLDataType.VARCHAR(100).nullable(false), this, "管理员名称");

    /**
     * The column <code>yx.sys_config.edittime</code>. 最后编辑时间
     */
    public final TableField<SysConfigRecord, LocalDateTime> EDITTIME = createField(DSL.name("edittime"), SQLDataType.LOCALDATETIME(0).defaultValue(DSL.field(DSL.raw("current_timestamp()"), SQLDataType.LOCALDATETIME)), this, "最后编辑时间");

    private SysConfig(Name alias, Table<SysConfigRecord> aliased) {
        this(alias, aliased, null);
    }

    private SysConfig(Name alias, Table<SysConfigRecord> aliased, Field<?>[] parameters) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table());
    }

    /**
     * Create an aliased <code>yx.sys_config</code> table reference
     */
    public SysConfig(String alias) {
        this(DSL.name(alias), SYS_CONFIG);
    }

    /**
     * Create an aliased <code>yx.sys_config</code> table reference
     */
    public SysConfig(Name alias) {
        this(alias, SYS_CONFIG);
    }

    /**
     * Create a <code>yx.sys_config</code> table reference
     */
    public SysConfig() {
        this(DSL.name("sys_config"), null);
    }

    public <O extends Record> SysConfig(Table<O> child, ForeignKey<O, SysConfigRecord> key) {
        super(child, key, SYS_CONFIG);
    }

    @Override
    public Schema getSchema() {
        return aliased() ? null : Yx.YX;
    }

    @Override
    public UniqueKey<SysConfigRecord> getPrimaryKey() {
        return Keys.KEY_SYS_CONFIG_PRIMARY;
    }

    @Override
    public List<UniqueKey<SysConfigRecord>> getUniqueKeys() {
        return Arrays.asList(Keys.KEY_SYS_CONFIG_K);
    }

    @Override
    public SysConfig as(String alias) {
        return new SysConfig(DSL.name(alias), this);
    }

    @Override
    public SysConfig as(Name alias) {
        return new SysConfig(alias, this);
    }

    @Override
    public SysConfig as(Table<?> alias) {
        return new SysConfig(alias.getQualifiedName(), this);
    }

    /**
     * Rename this table
     */
    @Override
    public SysConfig rename(String name) {
        return new SysConfig(DSL.name(name), null);
    }

    /**
     * Rename this table
     */
    @Override
    public SysConfig rename(Name name) {
        return new SysConfig(name, null);
    }

    /**
     * Rename this table
     */
    @Override
    public SysConfig rename(Table<?> name) {
        return new SysConfig(name.getQualifiedName(), null);
    }

    // -------------------------------------------------------------------------
    // Row7 type methods
    // -------------------------------------------------------------------------

    @Override
    public Row7<String, String, String, String, String, String, LocalDateTime> fieldsRow() {
        return (Row7) super.fieldsRow();
    }

    /**
     * Convenience mapping calling {@link SelectField#convertFrom(Function)}.
     */
    public <U> SelectField<U> mapping(Function7<? super String, ? super String, ? super String, ? super String, ? super String, ? super String, ? super LocalDateTime, ? extends U> from) {
        return convertFrom(Records.mapping(from));
    }

    /**
     * Convenience mapping calling {@link SelectField#convertFrom(Class,
     * Function)}.
     */
    public <U> SelectField<U> mapping(Class<U> toType, Function7<? super String, ? super String, ? super String, ? super String, ? super String, ? super String, ? super LocalDateTime, ? extends U> from) {
        return convertFrom(toType, Records.mapping(from));
    }
}
