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


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

import org.jooq.Field;
import org.jooq.ForeignKey;
import org.jooq.Function4;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Records;
import org.jooq.Row4;
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 SysRoleUrl extends TableImpl<SysRoleUrlRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>yx.sys_role_url</code>
     */
    public static final SysRoleUrl SYS_ROLE_URL = new SysRoleUrl();

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

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

    /**
     * The column <code>yx.sys_role_url.roleid</code>.
     */
    public final TableField<SysRoleUrlRecord, String> ROLEID = createField(DSL.name("roleid"), SQLDataType.VARCHAR(20).nullable(false), this, "");

    /**
     * The column <code>yx.sys_role_url.url</code>. 对应sys_urls的url
     */
    public final TableField<SysRoleUrlRecord, String> URL = createField(DSL.name("url"), SQLDataType.VARCHAR(300).nullable(false), this, "对应sys_urls的url");

    /**
     * The column <code>yx.sys_role_url.urltypes</code>. 1:url,2:菜单
     */
    public final TableField<SysRoleUrlRecord, Integer> URLTYPES = createField(DSL.name("urltypes"), SQLDataType.INTEGER.nullable(false), this, "1:url,2:菜单");

    private SysRoleUrl(Name alias, Table<SysRoleUrlRecord> aliased) {
        this(alias, aliased, null);
    }

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

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

    /**
     * Create an aliased <code>yx.sys_role_url</code> table reference
     */
    public SysRoleUrl(Name alias) {
        this(alias, SYS_ROLE_URL);
    }

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

    public <O extends Record> SysRoleUrl(Table<O> child, ForeignKey<O, SysRoleUrlRecord> key) {
        super(child, key, SYS_ROLE_URL);
    }

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

    @Override
    public UniqueKey<SysRoleUrlRecord> getPrimaryKey() {
        return Keys.KEY_SYS_ROLE_URL_PRIMARY;
    }

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

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

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

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

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

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

    // -------------------------------------------------------------------------
    // Row4 type methods
    // -------------------------------------------------------------------------

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

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

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