JsonCriteria.java 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. package com.persagy.apm.dmpalarm.criteria;
  2. import java.util.ArrayList;
  3. import java.util.HashSet;
  4. import java.util.List;
  5. import java.util.Set;
  6. import com.alibaba.fastjson.JSONObject;
  7. import lombok.Data;
  8. import lombok.Getter;
  9. import lombok.Setter;
  10. /**
  11. * @author: yaoll
  12. * @date: 2020-09-04
  13. * @verison: 1.0
  14. *
  15. * <pre>
  16. * {
  17. * "page": 1,
  18. * "size": 10,
  19. * "onlyCount": false,
  20. * "criteria": {
  21. * "name": "zhangsan",
  22. * "name": [ "zhangsan", "lisi" ],
  23. * "age": {
  24. * "$gt": 18,
  25. * "$lt": 35
  26. * },
  27. * "gender": {
  28. * "$null": false
  29. * }
  30. * },
  31. * "orders": [
  32. * {
  33. * "column": "name",
  34. * "asc": false
  35. * }
  36. * ],
  37. * "withColumns": [
  38. * "name", "age"
  39. * ],
  40. * "groupByColumns": [
  41. * "name", "age"
  42. * ]
  43. * }
  44. * </pre>
  45. */
  46. public class JsonCriteria {
  47. @Getter
  48. @Setter
  49. private Integer page =1;
  50. @Getter
  51. @Setter
  52. private Integer size=500;
  53. /**
  54. * 是否只统计数量
  55. */
  56. @Getter
  57. @Setter
  58. private boolean onlyCount = false;
  59. @Getter
  60. @Setter
  61. private boolean withoutCount = false;
  62. @Getter
  63. @Setter
  64. private JSONObject criteria = new JSONObject();
  65. @Getter
  66. @Setter
  67. private List<Order> orders = new ArrayList<>();
  68. @Getter
  69. @Setter
  70. private Set<String> withColumns = new HashSet<>();
  71. @Getter
  72. @Setter
  73. private Set<String> groupByColumns = new HashSet<>();
  74. @Data
  75. public static class Order {
  76. private String column;
  77. private boolean asc = true;
  78. public Order() {
  79. }
  80. public Order(String column) {
  81. this.column = column;
  82. }
  83. public Order(String column, boolean asc) {
  84. this.column = column;
  85. this.asc = asc;
  86. }
  87. }
  88. }