Criteria criteria = ConUtils.makeCri(request);
Sql sql = Sqls.create("select count(*) as count,C_SNAME as serviceName from $table $condition group by C_SNAME");
sql.setCallback(Sqls.callback.records());
sql.vars().set("table", "T_WD_SERVICE_CLOG");
sql.setCondition(cri);
sql.setPager(pager);
dao.execute(sql);
使用上述代码request中传递的是日期参数,控制台输出的sql是:
select count(*) as count,C_SNAME as serviceName from T_WD_SERVICE_CLOG WHERE (c_call_time <= '2016-05-26 00:00:00') AND (c_call_time >= '2016-05-23 00:00:00') group by C_SNAME;
报错ORA-01861: 文字与格式字符串不匹配
但是我用dao.query(XXX.class, cri,pager);这种形式查询,控制台输出的语句:
SELECT * FROM T_WD_SERVICE_CLOG WHERE (C_CALL_TIME <= '2016-05-26 00:00:00') AND (C_CALL_TIME >= '2016-05-17 00:00:00');
形式是一样的,但是这个就能正常的显示出查询内容,而且上边两个sql在plsql里均不能执行。
求解我在拼sql是时间参数应该怎么添加进去呢?