From cfafe4574c2bd670ece3d38e3d8254f86be55e60 Mon Sep 17 00:00:00 2001 From: yuejiajun <1530620364@qq.com> Date: Tue, 30 Sep 2025 14:04:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9ESQLite=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/example/demo/common/domain/BaseEntity.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/example/demo/common/domain/BaseEntity.java b/src/main/java/com/example/demo/common/domain/BaseEntity.java index 9589305..d306d2c 100644 --- a/src/main/java/com/example/demo/common/domain/BaseEntity.java +++ b/src/main/java/com/example/demo/common/domain/BaseEntity.java @@ -1,5 +1,6 @@ package com.example.demo.common.domain; +import com.example.demo.common.config.orm.handler.SqliteDateTypeHandler; import com.example.demo.common.config.orm.listener.FlexListener; import com.mybatisflex.annotation.Column; import com.mybatisflex.annotation.Id; @@ -33,7 +34,7 @@ import java.util.Date; @NoArgsConstructor @AllArgsConstructor @Table( - value = "", + value = "demo", comment = "基本类没有对应的表!", onInsert = FlexListener.class, onUpdate = FlexListener.class, @@ -85,7 +86,7 @@ public class BaseEntity implements Serializable { * Column(onInsertValue = "CURRENT_TIMESTAMP") * Column(onInsertValue = "datetime('now', 'localtime')") */ -// @Column(onInsertValue = "datetime('now', 'localtime')") + @Column(typeHandler = SqliteDateTypeHandler.class) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @Schema(description = "创建时间") @@ -105,7 +106,7 @@ public class BaseEntity implements Serializable { * Column(onUpdateValue = "CURRENT_TIMESTAMP", onInsertValue = "CURRENT_TIMESTAMP") * Column(onUpdateValue = "datetime('now', 'localtime')", onInsertValue = "datetime('now', 'localtime')") */ -// @Column(onUpdateValue = "datetime('now', 'localtime')", onInsertValue = "datetime('now', 'localtime')") + @Column(typeHandler = SqliteDateTypeHandler.class) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @Schema(description = "更新时间")