fix 修复添加直播间的sql错误

This commit is contained in:
zlzw 2024-11-30 15:45:11 +08:00
parent 3ac3c8e5e5
commit 313f8ac914

View File

@ -7,6 +7,7 @@ import com.alibaba.fastjson2.JSONObject;
import com.alibaba.fastjson2.annotation.JSONField; import com.alibaba.fastjson2.annotation.JSONField;
import com.alibaba.fastjson2.util.DateUtils; import com.alibaba.fastjson2.util.DateUtils;
import com.yutou.biliapi.bean.live.database.LiveConfigDatabaseBean; import com.yutou.biliapi.bean.live.database.LiveConfigDatabaseBean;
import com.yutou.bilibili.Tools.DateFormatUtils;
import com.yutou.common.inter.ISqlDatabaseBean; import com.yutou.common.inter.ISqlDatabaseBean;
import com.yutou.common.utils.Log; import com.yutou.common.utils.Log;
import lombok.Data; import lombok.Data;
@ -114,8 +115,8 @@ public abstract class SQLiteManager {
continue; continue;
} }
Object value = json.get(key); Object value = json.get(key);
if ("sql_time".equals(key) && value instanceof Date) { if ("sql_time".equals(key)) {
statement.setLong(i++, ((Date) value).getTime()); statement.setLong(i++, DateFormatUtils.getInstance().parse(value.toString(),DateFormatUtils.DEFAULT_PATTERN).getTime());
continue; continue;
} }
if (value instanceof String) { if (value instanceof String) {
@ -127,7 +128,7 @@ public abstract class SQLiteManager {
} else if (value instanceof Boolean) { } else if (value instanceof Boolean) {
statement.setBoolean(i++, (Boolean) value); statement.setBoolean(i++, (Boolean) value);
} else if (value instanceof Date) { } else if (value instanceof Date) {
statement.setTimestamp(i++, new Timestamp(((Date) value).getTime())); statement.setLong(i++, (Long) value);
} else { } else {
statement.setObject(i++, value); statement.setObject(i++, value);
} }