新增SQLite时间格式问题

This commit is contained in:
yuejiajun 2025-09-30 14:04:39 +08:00
parent e0e0306577
commit cfafe4574c

View File

@ -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 = "更新时间")