package com.persagy.dmp.basic.model;

import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.fasterxml.jackson.databind.node.ObjectNode;
import lombok.Data;

import java.util.List;
import java.util.Set;

/**
 * 通用查询参数 - 仅用于接收参数
 * 兼容数据中台查询规则，将数据中台查询条件转换为MyBatisPlus查询条件
 * <pre>
 * {
 *     "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"
 *     ]
 * }
 * </pre>
 * @author yaoll
 * @date 2020-09-04
 */
@Data
public class QueryCriteria {

    /** 分页页码,从 1 开始 */
    private Long page;
    /** 每页行数 */
    private Long size;
    /** 是否只统计总数 */
    private boolean onlyCount = false;
    /** 是否不统计总数 */
    private boolean withoutCount = false;
    /** 查询条件 */
    private ObjectNode criteria;
    /** 排序条件 */
    private List<OrderItem> orders;
    /** 额外返回的扩展字段清单 */
    private Set<String> withColumns;

}
