通过时间差查询数据库

//查询下单后一分钟之后未收到微信通知的记录

private static SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");

String format = sdf.format(new Date());

int nowTime = Integer.parseInt(format)-60;

String sql ="SELECT * FROM t_order_info WHERE wx_notice_status != 1

                    AND DATE_FORMAT(create_time,'%Y-%m-%d %H:%M:%s') < DATE_FORMAT(?,'%Y-%m-%d %H:%M:%s')";

return dao.find(sql,new Object[]{nowTime});

posted @ 2018-03-14 16:16  NoctisYang  阅读(119)  评论(0编辑  收藏  举报