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


import java.util.Collection;

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

import org.jooq.Condition;
import org.jooq.Field;
import org.jooq.Name;
import org.jooq.PlainSQL;
import org.jooq.QueryPart;
import org.jooq.SQL;
import org.jooq.Schema;
import org.jooq.Select;
import org.jooq.Stringly;
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" })
public class SysOrg extends TableImpl<SysOrgRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>yx.sys_org</code>
     */
    public static final SysOrg SYS_ORG = new SysOrg();

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

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

    /**
     * The column <code>yx.sys_org.pid</code>.
     */
    public final TableField<SysOrgRecord, String> PID = createField(DSL.name("pid"), SQLDataType.VARCHAR(20).nullable(false), this, "");

    /**
     * The column <code>yx.sys_org.status</code>.
     */
    public final TableField<SysOrgRecord, Integer> STATUS = createField(DSL.name("status"), SQLDataType.INTEGER.defaultValue(DSL.field(DSL.raw("1"), SQLDataType.INTEGER)), this, "");

    /**
     * The column <code>yx.sys_org.org_type</code>.
     */
    public final TableField<SysOrgRecord, String> ORG_TYPE = createField(DSL.name("org_type"), SQLDataType.VARCHAR(20).defaultValue(DSL.field(DSL.raw("NULL"), SQLDataType.VARCHAR)), this, "");

    private SysOrg(Name alias, Table<SysOrgRecord> aliased) {
        this(alias, aliased, (Field<?>[]) null, null);
    }

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

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

    /**
     * Create an aliased <code>yx.sys_org</code> table reference
     */
    public SysOrg(Name alias) {
        this(alias, SYS_ORG);
    }

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

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

    @Override
    public UniqueKey<SysOrgRecord> getPrimaryKey() {
        return Keys.KEY_SYS_ORG_PRIMARY;
    }

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

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

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

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

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

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

    /**
     * Create an inline derived table from this table
     */
    @Override
    public SysOrg where(Condition condition) {
        return new SysOrg(getQualifiedName(), aliased() ? this : null, null, condition);
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public SysOrg where(Collection<? extends Condition> conditions) {
        return where(DSL.and(conditions));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public SysOrg where(Condition... conditions) {
        return where(DSL.and(conditions));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public SysOrg where(Field<Boolean> condition) {
        return where(DSL.condition(condition));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    @PlainSQL
    public SysOrg where(SQL condition) {
        return where(DSL.condition(condition));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    @PlainSQL
    public SysOrg where(@Stringly.SQL String condition) {
        return where(DSL.condition(condition));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    @PlainSQL
    public SysOrg where(@Stringly.SQL String condition, Object... binds) {
        return where(DSL.condition(condition, binds));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    @PlainSQL
    public SysOrg where(@Stringly.SQL String condition, QueryPart... parts) {
        return where(DSL.condition(condition, parts));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public SysOrg whereExists(Select<?> select) {
        return where(DSL.exists(select));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public SysOrg whereNotExists(Select<?> select) {
        return where(DSL.notExists(select));
    }
}
