BaseVO.java 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package com.sumbytes.common.base.domain.vo;
  2. import com.sumbytes.common.validator.Messages;
  3. import com.sumbytes.common.validator.annotion.IntegerNotNull;
  4. import com.sumbytes.common.validator.annotion.NotNull;
  5. import com.sumbytes.common.validator.group.Page;
  6. import com.sumbytes.common.validator.group.Update;
  7. import lombok.Data;
  8. import lombok.experimental.Accessors;
  9. /**
  10. * VO 层基础父类.
  11. *
  12. * @param <T> VO类型
  13. * @author Young
  14. */
  15. @Data
  16. @Accessors(chain = true)
  17. public class BaseVO<T> {
  18. /**
  19. * 主键
  20. */
  21. @NotNull(message = Messages.ID_NOT_NULL, groups = {Update.class})
  22. protected Long id;
  23. /**
  24. * 关键词搜索
  25. */
  26. protected String keywords;
  27. /**
  28. * 页数
  29. */
  30. @IntegerNotNull(groups = {Page.class}, message = Messages.PAGE_NOT_NULL)
  31. protected Integer page;
  32. /**
  33. * 每页大小
  34. */
  35. @IntegerNotNull(groups = {Page.class}, message = Messages.SIZE_NOT_NULL)
  36. protected Integer size;
  37. public Long getId() {
  38. return id;
  39. }
  40. public T setId(Long id) {
  41. this.id = id;
  42. return (T) this;
  43. }
  44. public Integer getSize() {
  45. return size;
  46. }
  47. public T setSize(Integer size) {
  48. this.size = size > 20 ? 20 : size;
  49. return (T) this;
  50. }
  51. }