From 313f8ac91444bbc455d1bf66f9971bcca6868b45 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Sat, 30 Nov 2024 15:45:11 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=9B=B4=E6=92=AD=E9=97=B4=E7=9A=84sql=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/yutou/common/databases/SQLiteManager.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/yutou/common/databases/SQLiteManager.java b/src/main/java/com/yutou/common/databases/SQLiteManager.java index e583091..fc92a5e 100644 --- a/src/main/java/com/yutou/common/databases/SQLiteManager.java +++ b/src/main/java/com/yutou/common/databases/SQLiteManager.java @@ -7,6 +7,7 @@ import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.annotation.JSONField; import com.alibaba.fastjson2.util.DateUtils; import com.yutou.biliapi.bean.live.database.LiveConfigDatabaseBean; +import com.yutou.bilibili.Tools.DateFormatUtils; import com.yutou.common.inter.ISqlDatabaseBean; import com.yutou.common.utils.Log; import lombok.Data; @@ -114,8 +115,8 @@ public abstract class SQLiteManager { continue; } Object value = json.get(key); - if ("sql_time".equals(key) && value instanceof Date) { - statement.setLong(i++, ((Date) value).getTime()); + if ("sql_time".equals(key)) { + statement.setLong(i++, DateFormatUtils.getInstance().parse(value.toString(),DateFormatUtils.DEFAULT_PATTERN).getTime()); continue; } if (value instanceof String) { @@ -127,7 +128,7 @@ public abstract class SQLiteManager { } else if (value instanceof Boolean) { statement.setBoolean(i++, (Boolean) value); } else if (value instanceof Date) { - statement.setTimestamp(i++, new Timestamp(((Date) value).getTime())); + statement.setLong(i++, (Long) value); } else { statement.setObject(i++, value); }