Commit e27fad09 authored by shyWang's avatar shyWang

Merge remote-tracking branch 'origin/master'

parents 524c07dd abe4e95a
package com.yonde.basedata.search; package com.yonde.basedata.search;
import com.yonde.basedata.data.DxEnumData; import com.yonde.basedata.data.DxEnumData;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import java.io.Serializable; import java.io.Serializable;
public class SearchItem implements Serializable { public class SearchItem implements Serializable {
public enum Operator {
EQ(0, "等于"), NEQ(1, "不等于"), LIKE(2, "模糊查询"), GT(3, "大于"), LT(4, "小于"), GTE(5, "大于等于"),
LTE(6, "小于等于"), BTWN(7, "范围查询"), IN(8, "多值查询");
/**
* code编码
*/
final int code;
/**
* 获取名称
*/
final String value;
public int getCode() {
return code;
}
public String getValue() {
return value;
}
private Operator(int code, String value) {
this.code = code;
this.value = value;
}
}
public String fieldName; public String fieldName;
public Object value; public Object value;
public Object value1; public Object value1;
public String operator; public Operator operator;
public String searchItemType; public String searchItemType;
public SearchItem() { public String getFieldName() {
return fieldName;
} }
public SearchItem(String fieldName, String operator, Object value, Object value1) { public void setFieldName(String fieldName) {
this.fieldName = fieldName; this.fieldName = fieldName;
}
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value; this.value = value;
this.operator = operator; }
public Object getValue1() {
return value1;
}
public void setValue1(Object value1) {
this.value1 = value1; this.value1 = value1;
} }
public enum Operator implements DxEnumData { public Operator getOperator() {
EQ(1, "等于"), return operator;
NEQ(2, "不等于"), }
LIKE(3, "模糊查询"),
GT(4, "大于"),
LT(5, "小于"),
GTE(6, "大于等于"),
LTE(7, "小于等于"),
BTWN(8, "范围查询"),
IN(9, "in"),
ISNULL(10, "空值查询"),
NOTNULL(11, "非空查询"),
FULLLIKE(12, "全模糊查询"),
NOTIN(13, "非集合查询");
final String code;
final String value;
Operator(int code, String value) { public void setOperator(Operator operator) {
this.code = String.format("%04d", code); this.operator = operator;
this.value = value;
} }
public String getCode() { public String getSearchItemType() {
return this.code; return searchItemType;
} }
public String getValue() { public void setSearchItemType(String searchItemType) {
return this.value; this.searchItemType = searchItemType;
} }
Operator(String code, String value) { public SearchItem() {
this.code = code;
}
public SearchItem(String fieldName, Operator operator, Object value, Object value1) {
this.fieldName = fieldName;
this.value = value; this.value = value;
this.operator = operator;
this.value1 = value1;
} }
@Override
public SearchItem clone() throws CloneNotSupportedException {
return (SearchItem) super.clone();
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((fieldName == null) ? 0 : fieldName.hashCode());
result = prime * result + ((operator == null) ? 0 : operator.hashCode());
result = prime * result + ((searchItemType == null) ? 0 : searchItemType.hashCode());
result = prime * result + ((value == null) ? 0 : value.hashCode());
result = prime * result + ((value1 == null) ? 0 : value1.hashCode());
return result;
} }
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SearchItem other = (SearchItem) obj;
if (fieldName == null) {
if (other.fieldName != null)
return false;
} else if (!fieldName.equals(other.fieldName))
return false;
if (operator != other.operator)
return false;
if (searchItemType == null) {
if (other.searchItemType != null)
return false;
} else if (!searchItemType.equals(other.searchItemType))
return false;
if (value == null) {
if (other.value != null)
return false;
} else if (!value.equals(other.value))
return false;
if (value1 == null) {
if (other.value1 != null)
return false;
} else if (!value1.equals(other.value1))
return false;
return true;
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment