WorkCalendar.java 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. package com.persagy.calendar.pojo.dto;
  2. import java.util.List;
  3. import java.util.Set;
  4. import com.alibaba.fastjson.JSONObject;
  5. import com.baomidou.mybatisplus.annotation.FieldFill;
  6. import com.baomidou.mybatisplus.annotation.FieldStrategy;
  7. import com.baomidou.mybatisplus.annotation.TableField;
  8. import com.baomidou.mybatisplus.annotation.TableName;
  9. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  10. import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
  11. import com.persagy.calendar.constant.WorkCalendarConstant;
  12. import com.persagy.common.annotation.IdGenerator;
  13. import com.persagy.common.enums.IdGeneratorAlgorithm;
  14. import com.persagy.common.utils.StringUtil;
  15. import com.persagy.db.model.BaseEntity;
  16. import lombok.EqualsAndHashCode;
  17. import lombok.Getter;
  18. import lombok.Setter;
  19. import lombok.ToString;
  20. /**
  21. * 工作历主表
  22. *
  23. * @version 1.0.0
  24. * @company persagy
  25. * @author zhangqiankun
  26. * @date 2020-10-02 11:33:00
  27. */
  28. @Getter
  29. @Setter
  30. @ToString
  31. @TableName("work_calendar")
  32. @EqualsAndHashCode(callSuper = false)
  33. @IdGenerator(prefix = WorkCalendarConstant.WORK_CALENDAR_ID_PREFIX, algorithm = IdGeneratorAlgorithm.SNOW_STR)
  34. public class WorkCalendar extends BaseEntity<WorkCalendar> {
  35. private static final long serialVersionUID = -1507838782036817943L;
  36. @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
  37. private String groupCode; // 集团编码
  38. @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
  39. private String projectId; // 工作历分类ID
  40. @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
  41. private String calendarName; // 同一PROJECT_ID下唯一,代码判断
  42. @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
  43. private String calendarDesc; // 工作历描述
  44. @TableField(fill = FieldFill.INSERT, updateStrategy = FieldStrategy.NOT_EMPTY)
  45. private String createTime; // 创建时间
  46. @TableField(fill = FieldFill.INSERT_UPDATE, updateStrategy = FieldStrategy.NOT_EMPTY)
  47. private String updateTime; // 更新时间
  48. @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
  49. private String updateUser; // 操作用户ID
  50. @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
  51. private String delFlag; // 0-正常;1-删除
  52. // objectId, objectName
  53. @TableField(exist = false)
  54. private List<JSONObject> objects;
  55. @TableField(exist = false)
  56. private Set<String> objIds; //对象ID集合,空间、建筑、楼层、项目
  57. public static class Builder {
  58. private QueryWrapper<WorkCalendar> queryWrapper = null;
  59. private UpdateWrapper<WorkCalendar> updateWrapper = null;
  60. public Builder createQueryWrapper() {
  61. queryWrapper = new QueryWrapper<WorkCalendar>();
  62. return this;
  63. }
  64. public Builder createUpdateWrapper() {
  65. updateWrapper = new UpdateWrapper<WorkCalendar>();
  66. return this;
  67. }
  68. public Builder idEq(String id) {
  69. if (StringUtil.isNotBlank(id)) {
  70. if (updateWrapper != null) {
  71. updateWrapper.eq("ID", id);
  72. } else {
  73. queryWrapper.eq("ID", id);
  74. }
  75. }
  76. return this;
  77. }
  78. public Builder groupCodeEq(String groupCode) {
  79. if (StringUtil.isNotBlank(groupCode)) {
  80. if (updateWrapper != null) {
  81. updateWrapper.eq("GROUP_CODE", groupCode);
  82. } else {
  83. queryWrapper.eq("GROUP_CODE", groupCode);
  84. }
  85. }
  86. return this;
  87. }
  88. public Builder projectIdEq(String projectId) {
  89. if (StringUtil.isNotBlank(projectId)) {
  90. if (updateWrapper != null) {
  91. updateWrapper.eq("PROJECT_ID", projectId);
  92. } else {
  93. queryWrapper.eq("PROJECT_ID", projectId);
  94. }
  95. }
  96. return this;
  97. }
  98. public Builder calendarNameEq(String calendarName) {
  99. if (StringUtil.isNotBlank(calendarName)) {
  100. if (updateWrapper != null) {
  101. updateWrapper.eq("CALENDAR_NAME", calendarName);
  102. } else {
  103. queryWrapper.eq("CALENDAR_NAME", calendarName);
  104. }
  105. }
  106. return this;
  107. }
  108. public Builder calendarNameLike(String calendarName) {
  109. if (StringUtil.isNotBlank(calendarName)) {
  110. if (updateWrapper != null) {
  111. updateWrapper.like("CALENDAR_NAME", calendarName);
  112. } else {
  113. queryWrapper.like("CALENDAR_NAME", calendarName);
  114. }
  115. }
  116. return this;
  117. }
  118. public Builder calendarDescEq(String calendarDesc) {
  119. if (StringUtil.isNotBlank(calendarDesc)) {
  120. if (updateWrapper != null) {
  121. updateWrapper.eq("CALENDAR_DESC", calendarDesc);
  122. } else {
  123. queryWrapper.eq("CALENDAR_DESC", calendarDesc);
  124. }
  125. }
  126. return this;
  127. }
  128. public Builder createTimeEq(String createTime) {
  129. if (StringUtil.isNotBlank(createTime)) {
  130. if (updateWrapper != null) {
  131. updateWrapper.eq("CREATE_TIME", createTime);
  132. } else {
  133. queryWrapper.eq("CREATE_TIME", createTime);
  134. }
  135. }
  136. return this;
  137. }
  138. public Builder updateTimeEq(String updateTime) {
  139. if (StringUtil.isNotBlank(updateTime)) {
  140. if (updateWrapper != null) {
  141. updateWrapper.eq("UPDATE_TIME", updateTime);
  142. } else {
  143. queryWrapper.eq("UPDATE_TIME", updateTime);
  144. }
  145. }
  146. return this;
  147. }
  148. public Builder updateUserEq(String updateUser) {
  149. if (StringUtil.isNotBlank(updateUser)) {
  150. if (updateWrapper != null) {
  151. updateWrapper.eq("UPDATE_USER", updateUser);
  152. } else {
  153. queryWrapper.eq("UPDATE_USER", updateUser);
  154. }
  155. }
  156. return this;
  157. }
  158. public Builder delFlagEq(String delFlag) {
  159. if (StringUtil.isNotBlank(delFlag)) {
  160. if (updateWrapper != null) {
  161. updateWrapper.eq("DEL_FLAG", delFlag);
  162. } else {
  163. queryWrapper.eq("DEL_FLAG", delFlag);
  164. }
  165. }
  166. return this;
  167. }
  168. public QueryWrapper<WorkCalendar> builderQueryWrapper() {
  169. return queryWrapper;
  170. }
  171. public UpdateWrapper<WorkCalendar> builderUpdateWrapper() {
  172. return updateWrapper;
  173. }
  174. }
  175. }