All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.vonce.sql.bean.Join Maven / Gradle / Ivy

The newest version!
package cn.vonce.sql.bean;

import cn.vonce.sql.define.ColumnFun;
import cn.vonce.sql.enumerate.JoinType;

import java.io.Serializable;

/**
 * Select
 *
 * @author Jovi
 * @version 1.0
 * @email [email protected]
 * @date 2019年6月10日上午12:00:00
 */
public class Join implements Serializable {

    public Join() {
    }

    public Join(JoinType joinType, String schema, String tableName, String tableAlias) {
        this.joinType = joinType;
        this.schema = schema;
        this.tableName = tableName;
        this.tableAlias = tableAlias;
    }

    public Join(JoinType joinType, String schema, String tableName, String tableAlias, String tableKeyword, String mainKeyword, String on) {
        this.joinType = joinType;
        this.schema = schema;
        this.tableName = tableName;
        this.tableAlias = tableAlias;
        this.tableKeyword = tableKeyword;
        this.mainKeyword = mainKeyword;
        this.on = on;
    }

    private JoinType joinType;
    private String schema;
    private String tableName;
    private String tableAlias;
    @Deprecated
    private String tableKeyword;
    @Deprecated
    private String mainKeyword;
    @Deprecated
    private String on;

    /**
     * Join 条件
     */
    private Condition on(String field, Object value) {
        return joinCondition.eq(field, value);
    }

    public Logic on(Column column, Object value) {
        return joinCondition.eq(column, value);
    }

    public  Logic on(ColumnFun columnFun, ColumnFun value) {
        return joinCondition.eq(columnFun, value);
    }

    public Condition