Commit 8ce9ef7c authored by 麻笑宇's avatar 麻笑宇

feat(amos-boot-module-statistics): 添加条件枚举类

- 新增 ConditionEnum 枚举类,定义了多种条件类型 -包含字符串、数字和日期等不同类型的操作符 - 提供了根据参数类型获取条件枚举的方法
parent 5b673c1c
package com.yeejoin.amos.boot.module.statistics.api.enums;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.annotation.TechnicalParameter;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.HashMap;
import java.util.Map;
@AllArgsConstructor
@Getter
public enum ConditionEnum {
/**
* 类型枚举
*/
stringEq("等于", "eq", TechnicalParameter.ParamType.STRING),
like("匹配", "like", TechnicalParameter.ParamType.STRING),
notLike("不匹配", "notLike", TechnicalParameter.ParamType.STRING),
numberEq("等于", "eq", TechnicalParameter.ParamType.BIG_DECIMAL),
numberGt("大于", "gt", TechnicalParameter.ParamType.BIG_DECIMAL),
numberLt("小于", "lt", TechnicalParameter.ParamType.BIG_DECIMAL),
numberGe("大于等于", "ge", TechnicalParameter.ParamType.BIG_DECIMAL),
numberLe("小于等于", "le", TechnicalParameter.ParamType.BIG_DECIMAL),
dateEq("等于", "eq", TechnicalParameter.ParamType.DATE),
dateGt("大于", "gt", TechnicalParameter.ParamType.DATE),
dateLt("小于", "lt", TechnicalParameter.ParamType.DATE),
dateGe("大于等于", "ge", TechnicalParameter.ParamType.DATE),
dateLe("小于等于", "le", TechnicalParameter.ParamType.DATE),
in("包含","in", null),
notin("不包含","notin", null),
;
private String name;
private String code;
private TechnicalParameter.ParamType paramType;
public static JSONArray getByCode(TechnicalParameter.ParamType paramType) {
JSONArray jsonArray = new JSONArray();
for (ConditionEnum value : values()) {
if (value.code.equals(paramType)) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("label", value.name);
jsonObject.put("value", value.code);
jsonArray.add(jsonObject);
}
}
return jsonArray;
}
}
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