diff --git a/pom.xml b/pom.xml index 9c5f2d4..88a3aea 100644 --- a/pom.xml +++ b/pom.xml @@ -27,7 +27,7 @@ org.mybatis mybatis - 3.5.5 + 3.5.0 diff --git a/sqlite.db b/sqlite.db index 55847c8..1f5a7c7 100644 Binary files a/sqlite.db and b/sqlite.db differ diff --git a/src/main/java/com/louzin/structure/pojo/Host.java b/src/main/java/com/louzin/structure/pojo/Host.java index 22420e5..ef9a0bb 100644 --- a/src/main/java/com/louzin/structure/pojo/Host.java +++ b/src/main/java/com/louzin/structure/pojo/Host.java @@ -2,6 +2,7 @@ package com.louzin.structure.pojo; import com.fasterxml.jackson.annotation.JsonFormat; +import java.time.LocalDateTime; import java.util.Date; public class Host { @@ -9,16 +10,14 @@ public class Host { private String username; private String password; private String host; - @JsonFormat(pattern = "yyyy-MM-dd HH-mm-ss") - private Date ctime; - @JsonFormat(pattern = "yyyy-MM-dd HH-mm-ss") - private Date utime; + private LocalDateTime ctime; + private LocalDateTime utime; - public Date getUtime() { + public LocalDateTime getUtime() { return utime; } - public void setUtime(Date utime) { + public void setUtime(LocalDateTime utime) { this.utime = utime; } @@ -76,11 +75,11 @@ public class Host { this.host = host; } - public Date getCtime() { + public LocalDateTime getCtime() { return ctime; } - public void setCtime(Date ctime) { + public void setCtime(LocalDateTime ctime) { this.ctime = ctime; } } diff --git a/src/main/java/com/louzin/structure/util/test.java b/src/main/java/com/louzin/structure/util/test.java index 9f1c56c..878f22e 100644 --- a/src/main/java/com/louzin/structure/util/test.java +++ b/src/main/java/com/louzin/structure/util/test.java @@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.*; import org.testng.annotations.Test; import java.text.SimpleDateFormat; +import java.time.LocalDateTime; import java.util.Date; import java.util.List; @@ -72,8 +73,7 @@ public class test { Host host = new Host("louzin","123456","12.1.2.2"); host.setId(1); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); -// host.setUtime(new java.util.Date().getTime()); - //无法将date解析成timestamp 待解决 + host.setUtime(LocalDateTime.now()); System.out.println(new HostDaoImpl().update(host)); } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 8b13789..e69de29 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1 +0,0 @@ - diff --git a/src/main/resources/mybatis-config.xml b/src/main/resources/mybatis-config.xml index 4041a1f..619f3a8 100644 --- a/src/main/resources/mybatis-config.xml +++ b/src/main/resources/mybatis-config.xml @@ -6,12 +6,10 @@ - -