package cc.smtweb.framework.core.mvc.service.list;

/**
 * Created by Akmm at 13-4-16 上午10:51
 * 合计行列定义
 */
public class FooterField {
    //计数 不同值计数
    public static final String SUM_TYPE_COUNT = "COUNT";
    //计数 记录数
    public static final String SUM_TYPE_COUNT_ALL = "COUNT_A";
    //求和
    public static final String SUM_TYPE_SUM = "SUM";
    //整数求和
    public static final String SUM_TYPE_SUM_NUM = "SUM_NUM";
    //平均数
    public static final String SUM_TYPE_AVG = "AVG";
    //最大值
    public static final String SUM_TYPE_MAX = "MAX";
    //最小值
    public static final String SUM_TYPE_MIN = "MIN";
    //静态文本
    public static final String STATIC_TEXT = "TEXT";

    public String field;
    public String type;
    public String text;

    public FooterField() {
    }

    public FooterField(String field, String type, String text) {
        this.field = field;
        this.type = type;
        this.text = text;
    }

    public String toString() {
        return "field=" + field + ";type=" + type + ";text=" + text;
    }

    public static FooterField newSumField(String field) {
        return new FooterField(field, SUM_TYPE_SUM, null);
    }

    public static FooterField newCountField(String field) {
        return new FooterField(field, SUM_TYPE_COUNT, null);
    }

    public static FooterField newTextField(String field, String text) {
        return new FooterField(field, STATIC_TEXT, text);
    }

    public static FooterField newSumField(String field, String type) {
        return new FooterField(field, type, null);
    }
}
