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


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.SysUrlsRecord;

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 SysUrls extends TableImpl<SysUrlsRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>yx.sys_urls</code>
     */
    public static final SysUrls SYS_URLS = new SysUrls();

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

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

    /**
     * The column <code>yx.sys_urls.pid</code>. 父类id
     */
    public final TableField<SysUrlsRecord, Integer> PID = createField(DSL.name("pid"), SQLDataType.INTEGER.defaultValue(DSL.field(DSL.raw("NULL"), SQLDataType.INTEGER)), this, "父类id");

    /**
     * The column <code>yx.sys_urls.types</code>. 1:url,2:菜单
     */
    public final TableField<SysUrlsRecord, Integer> TYPES = createField(DSL.name("types"), SQLDataType.INTEGER.defaultValue(DSL.field(DSL.raw("1"), SQLDataType.INTEGER)), this, "1:url,2:菜单");

    /**
     * The column <code>yx.sys_urls.level</code>. 0:url,1:一级菜单, 2:二级菜单
     */
    public final TableField<SysUrlsRecord, Integer> LEVEL = createField(DSL.name("level"), SQLDataType.INTEGER.defaultValue(DSL.field(DSL.raw("0"), SQLDataType.INTEGER)), this, "0:url,1:一级菜单, 2:二级菜单");

    /**
     * The column <code>yx.sys_urls.url</code>.
     */
    public final TableField<SysUrlsRecord, String> URL = createField(DSL.name("url"), SQLDataType.VARCHAR(300).defaultValue(DSL.field(DSL.raw("NULL"), SQLDataType.VARCHAR)), this, "");

    /**
     * The column <code>yx.sys_urls.name</code>.
     */
    public final TableField<SysUrlsRecord, String> NAME = createField(DSL.name("name"), SQLDataType.VARCHAR(200).defaultValue(DSL.field(DSL.raw("NULL"), SQLDataType.VARCHAR)), this, "");

    /**
     * The column <code>yx.sys_urls.method</code>.
     */
    public final TableField<SysUrlsRecord, String> METHOD = createField(DSL.name("method"), SQLDataType.VARCHAR(200).defaultValue(DSL.field(DSL.raw("NULL"), SQLDataType.VARCHAR)), this, "");

    private SysUrls(Name alias, Table<SysUrlsRecord> aliased) {
        this(alias, aliased, null);
    }

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

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

    /**
     * Create an aliased <code>yx.sys_urls</code> table reference
     */
    public SysUrls(Name alias) {
        this(alias, SYS_URLS);
    }

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

    public <O extends Record> SysUrls(Table<O> child, ForeignKey<O, SysUrlsRecord> key) {
        super(child, key, SYS_URLS);
    }

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

    @Override
    public UniqueKey<SysUrlsRecord> getPrimaryKey() {
        return Keys.KEY_SYS_URLS_PRIMARY;
    }

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

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

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

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

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

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

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

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

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

    /**
     * Convenience mapping calling {@link SelectField#convertFrom(Function)}.
     */
    public <U> SelectField<U> mapping(Function7<? super String, ? super Integer, ? super Integer, ? super Integer, ? super String, ? super String, ? super String, ? 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 Integer, ? super Integer, ? super Integer, ? super String, ? super String, ? super String, ? extends U> from) {
        return convertFrom(toType, Records.mapping(from));
    }
}
