日志里没有报错信息,试了几次,都不行。
在navicat执行拷贝日志打印的sql,可以获取到数据。
StringBuffer bf = new StringBuffer();
bf.append(" (select edit_time,address,diagnose_total,diagnose_add,suspect_total,suspect_add, cure_total,cure_add,death_total,death_add from hp_epidemic ");
bf.append(" where type ='1' and edit_time >= DATE_FORMAT(CURDATE(),'%Y-%m-%d %H:%i:%s') ORDER BY edit_time desc LIMIT 0,1) UNION ");
bf.append(" (select edit_time,address,diagnose_total,diagnose_add,suspect_total,suspect_add, cure_total,cure_add,death_total,death_add from hp_epidemic ");
bf.append(" where type ='2' and edit_time >= DATE_FORMAT(CURDATE(),'%Y-%m-%d %H:%i:%s') ORDER BY edit_time desc LIMIT 0,1) ");
String sqls = bf.toString();
Sql sql = Sqls.create(sqls);
sql.setEntity(dao().getEntity(Record.class));
sql.setCallback(Sqls.callback.entities());
dao().execute(sql);
List<Record> list = sql.getList(Record.class);