如题。很奇怪
2017-03-17 15:35:28,639 DEBUG [org.nutz.dao.impl.sql.run.NutDaoExecutor] INSERT INTO t_report_electricity_hour(regionid,total_num,increase,opt,cdtr) VALUES(?,?,?,?,?)
| 1 | 2 | 3 | 4 | 5 |
|---|----------|--------|---------------------------------------------------|---------------------|
| 1 | 44869.20 | 159.40 | {"other":0.0,"dongli":44869.2,"kongtiao":11205.9} | 2017-03-17 14:59:59 |
For example:> "INSERT INTO t_report_electricity_hour(regionid,total_num,increase,opt,cdtr) VALUES(1,'44869.20','159.40','{"other":0.0,"dongli":44869.2,"kongtiao":11205.9}','2017-03-17 14:59:59') "
2017-03-17 15:35:28,644 DEBUG [druid.sql.Statement] {conn-10001, pstmt-20008} created. INSERT INTO t_report_electricity_hour(regionid,total_num,increase,opt,cdtr) VALUES(?,?,?,?,?)
执行完成后,去数据库里查,却查到的记录日期字段是 2017-3-17 15:00:00 ?
+--------+----------+-----------+----------+---------------------------------------------------+---------------------+
| id | regionID | total_num | increase | opt | cdtr |
+--------+----------+-----------+----------+---------------------------------------------------+---------------------+
| 416553 | 1 | 44869.20 | 159.40 | {"other":0.0,"dongli":44869.2,"kongtiao":11205.9} | 2017-03-17 15:00:00 |
+--------+----------+-----------+----------+---------------------------------------------------+---------------------+
奇葩了,昨天升级了下mysql至 5.6.35 就出问题了,难道是 mysql 问题? 我再研究研究...
刚试了下,我插入的日期是 Date 型,实际值为 2017-03-17 14:59:59:999 但入库后会被转换为 2017-03-17 15:00:00, 而我把日期改为 2017-03-17 14:59:59:0 ,入库后就显示为 2017-03-17 14:59:59 了。这个问题在之前的mysql 5.1版本时没有问题,升级到mysql 5.6.35版时,就出现了。感觉可能是 mysql 数据精度的问题。