/*
 * 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.SysResourceRecord;

import org.jooq.Field;
import org.jooq.ForeignKey;
import org.jooq.Function9;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Records;
import org.jooq.Row9;
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 SysResource extends TableImpl<SysResourceRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>yx.sys_resource</code>
     */
    public static final SysResource SYS_RESOURCE = new SysResource();

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

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

    /**
     * The column <code>yx.sys_resource.parent_id</code>.
     */
    public final TableField<SysResourceRecord, String> PARENT_ID = createField(DSL.name("parent_id"), SQLDataType.VARCHAR(20).nullable(false), this, "");

    /**
     * The column <code>yx.sys_resource.level</code>. 菜单排列顺序
     */
    public final TableField<SysResourceRecord, Short> LEVEL = createField(DSL.name("level"), SQLDataType.SMALLINT.defaultValue(DSL.field(DSL.raw("NULL"), SQLDataType.SMALLINT)), this, "菜单排列顺序");

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

    /**
     * The column <code>yx.sys_resource.types</code>. 资源类型
     */
    public final TableField<SysResourceRecord, String> TYPES = createField(DSL.name("types"), SQLDataType.VARCHAR(40).defaultValue(DSL.field(DSL.raw("NULL"), SQLDataType.VARCHAR)), this, "资源类型");

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

    /**
     * The column <code>yx.sys_resource.icon</code>. 菜单图标
     */
    public final TableField<SysResourceRecord, String> ICON = createField(DSL.name("icon"), SQLDataType.VARCHAR(100).defaultValue(DSL.field(DSL.raw("NULL"), SQLDataType.VARCHAR)), this, "菜单图标");

    /**
     * The column <code>yx.sys_resource.ishide</code>. 是否折叠隐藏
     */
    public final TableField<SysResourceRecord, Byte> ISHIDE = createField(DSL.name("ishide"), SQLDataType.TINYINT.defaultValue(DSL.field(DSL.raw("0"), SQLDataType.TINYINT)), this, "是否折叠隐藏");

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

    private SysResource(Name alias, Table<SysResourceRecord> aliased) {
        this(alias, aliased, null);
    }

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

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

    /**
     * Create an aliased <code>yx.sys_resource</code> table reference
     */
    public SysResource(Name alias) {
        this(alias, SYS_RESOURCE);
    }

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

    public <O extends Record> SysResource(Table<O> child, ForeignKey<O, SysResourceRecord> key) {
        super(child, key, SYS_RESOURCE);
    }

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

    @Override
    public UniqueKey<SysResourceRecord> getPrimaryKey() {
        return Keys.KEY_SYS_RESOURCE_PRIMARY;
    }

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

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

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

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

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

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

    // -------------------------------------------------------------------------
    // Row9 type methods
    // -------------------------------------------------------------------------

    @Override
    public Row9<String, String, Short, String, String, String, String, Byte, String> fieldsRow() {
        return (Row9) super.fieldsRow();
    }

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