/** * */ package com.primeton.dsp.datarelease.api.model; import org.apache.commons.lang.builder.ToStringBuilder; /** * * SQL 的 where 条件 * * @author zhaopx * */ public class WhereCause { /** * 表,where 条件的表 */ String tableName; /** * 该字段名称 */ String fieldName; /** * 左表某字段大于右表某字段的条件 */ String toTableName; /** * 左表某字段大于右表某字段的条件 */ String toFieldName; /** * 数据类型:string, numeric, datetime 三种类型 */ String type = "string"; /** * 运算逻辑: =(等于),>(大于),<(小于),>=(大于或等于),<=(小于或等于),<> or !=(不等于) */ String opera = "="; /** * 取值 */ String value; /** * 与上一个条件的连接条件,与或。默认为 and。 and/or */ String cond = "and"; /** * 构造方法 */ public WhereCause() { } public WhereCause(String tableName, String fieldName, String value) { this.tableName = tableName; this.fieldName = fieldName; this.value = value; } public WhereCause(String tableName, String fieldName, String opera, String value) { this(tableName, fieldName, value); this.opera = opera; } public WhereCause(String tableName, String fieldName, String type, String opera, String value) { this(tableName, fieldName, value); this.type = type; this.opera = opera; } public WhereCause(String tableName, String fieldName, String type, String opera, String value, String cond) { this(tableName, fieldName, value); this.type = type; this.opera = opera; this.cond = cond; } public String getTableName() { return tableName; } public String getFieldName() { return fieldName; } public String getToTableName() { return toTableName; } public String getToFieldName() { return toFieldName; } public String getType() { return type; } public String getOpera() { return opera; } public String getValue() { return value; } public String getCond() { return cond; } public void setTableName(String tableName) { this.tableName = tableName; } public void setFieldName(String fieldName) { this.fieldName = fieldName; } public void setToTableName(String toTableName) { this.toTableName = toTableName; } public void setToFieldName(String toFieldName) { this.toFieldName = toFieldName; } public void setType(String type) { this.type = type; } public void setOpera(String opera) { this.opera = opera; } public void setValue(String value) { this.value = value; } public void setCond(String cond) { this.cond = cond; } @Override public String toString() { return ToStringBuilder.reflectionToString(this); } }