package com.yanzuoguang.dao.impl; import com.yanzuoguang.util.helper.StringHelper; /** * 行转列实体 * * @author 颜佐光 */ public class CaseSqlModel { public final static int GROUP_TYPE_SUM = 0; public final static int GROUP_TYPE_COUNT = 1; public final static int GROUP_TYPE_AVG = 2; public final static int GROUP_TYPE_MIN = 3; public final static int GROUP_TYPE_MAX = 4; public CaseSqlModel(String caseField, String caseValue, String valueField, String toName) { this(GROUP_TYPE_SUM, caseField, caseValue, valueField, toName); } public CaseSqlModel(int groupType, String caseField, String caseValue, String valueField, String toName) { this.groupType = groupType; this.caseField = caseField; this.caseValue = caseValue; this.valueField = valueField; this.toName = toName; this.andWhere = ""; } public CaseSqlModel(String caseField, String caseValue, Object value, String toName, String andWhere) { this(GROUP_TYPE_SUM, caseField, caseValue, value, toName, andWhere); } public CaseSqlModel(int groupType, String caseField, String caseValue, Object value, String toName, String andWhere) { this.groupType = groupType; this.caseField = caseField; this.caseValue = caseValue; this.value = value; this.toName = toName; this.andWhere = andWhere; } public CaseSqlModel(String caseField, String caseValue, String valueField, String toName, String andWhere) { this(GROUP_TYPE_SUM, caseField, caseValue, valueField, toName, andWhere); } public CaseSqlModel(int groupType, String caseField, String caseValue, String valueField, String toName, String andWhere) { this.groupType = groupType; this.caseField = caseField; this.caseValue = caseValue; this.valueField = valueField; this.toName = toName; this.andWhere = andWhere; } /** * 统计纬度 */ private int groupType; /** * 需要判断的字段 */ private String caseField; /** * 需要判断的值 */ private String caseValue; /** * 需要统计的字段,和 value 只能存在一个,ValueField优先级更高 */ private String valueField; /** * 需要统计的值,和 ValueField只能存在一个,ValueField优先级更高 */ private Object value; /** * 目标字段名称 */ private String toName; /** * 需要判断的CASE字段的附加条件 */ private String andWhere; /** * 格式化-前面的字符 */ private String from = StringHelper.EMPTY; /** * 格式化-后面的字符 */ private String to = StringHelper.EMPTY; public int getGroupType() { return groupType; } public void setGroupType(int groupType) { this.groupType = groupType; } public String getCaseField() { return caseField; } public void setCaseField(String caseField) { this.caseField = caseField; } public String getCaseValue() { return caseValue; } public void setCaseValue(String caseValue) { this.caseValue = caseValue; } public String getValueField() { return valueField; } public void setValueField(String valueField) { this.valueField = valueField; } public Object getValue() { return value; } public void setValue(Object value) { this.value = value; } public String getToName() { return toName; } public void setToName(String toName) { this.toName = toName; } public String getAndWhere() { return andWhere; } public void setAndWhere(String andWhere) { this.andWhere = andWhere; } public String getFrom() { return from; } public void setFrom(String from) { this.from = from; } public String getTo() { return to; } public void setTo(String to) { this.to = to; } }