|
|
@@ -12,7 +12,7 @@ import java.time.LocalDateTime;
|
|
|
* @date 2023-08-14 19:00
|
|
|
*/
|
|
|
@Data
|
|
|
-public class BaseEntity implements Serializable {
|
|
|
+public abstract class BaseEntity<T extends BaseEntity<T>> implements Serializable {
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
/**
|
|
|
* ID
|
|
|
@@ -30,4 +30,16 @@ public class BaseEntity implements Serializable {
|
|
|
*/
|
|
|
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
|
|
private LocalDateTime updateTime;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置父类id返回子类对象
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public T setBaseId(Long id) {
|
|
|
+ this.setId(id);
|
|
|
+ return (T) this;
|
|
|
+ }
|
|
|
+
|
|
|
}
|