package com.persagy.apm.dmpalarm.criteria; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import com.alibaba.fastjson.JSONObject; import lombok.Data; import lombok.Getter; import lombok.Setter; /** * @author: yaoll * @date: 2020-09-04 * @verison: 1.0 * *
 * {
 *     "page": 1,
 *     "size": 10,
 *     "onlyCount": false,
 *     "criteria": {
 *         "name": "zhangsan",
 *         "name": [ "zhangsan", "lisi" ],
 *         "age": {
 *             "$gt": 18,
 *             "$lt": 35
 *         },
 *         "gender": {
 *             "$null": false
 *         }
 *     },
 *     "orders": [
 *            {
 *     		 	"column": "name",
 *     		 	"asc": false
 *            }
 *     ],
 *     "withColumns": [
 *     		"name", "age"
 *     ],
 *     "groupByColumns": [
 *     		"name", "age"
 *     ]
 * }
 *           
*/ public class JsonCriteria { @Getter @Setter private Integer page =1; @Getter @Setter private Integer size=500; /** * 是否只统计数量 */ @Getter @Setter private boolean onlyCount = false; @Getter @Setter private boolean withoutCount = false; @Getter @Setter private JSONObject criteria = new JSONObject(); @Getter @Setter private List orders = new ArrayList<>(); @Getter @Setter private Set withColumns = new HashSet<>(); @Getter @Setter private Set groupByColumns = new HashSet<>(); @Data public static class Order { private String column; private boolean asc = true; public Order() { } public Order(String column) { this.column = column; } public Order(String column, boolean asc) { this.column = column; this.asc = asc; } } }