代码
public GeneralStat getByAllColums(String tableName, GeneralStat gs) {
Condition cond = Cnd.where("corporationid", "=", gs.getCorpId())
.and("kpiid", "=", gs.getKpiId())
.and("time", "=", gs.getTime())
.and("dimension1", "=", gs.getDimension1())
.and("dimension2", "=", gs.getDimension2())
.and("dimension3", "=", gs.getDimension3())
.and("dimension4", "=", gs.getDimension4())
.and("value", "=", gs.getValue())
.and("flag", "=", gs.getFlag());
try {
TableName.set(tableName);
return dao.fetch(GeneralStat.class, cond);
} finally {
TableName.clear();
}
}
log生成的sql
SELECT * FROM (SELECT T.*, ROWNUM RN FROM ( SELECT * FROM STAT_BASE WHERE corporationid='0300' AND kpiid='10001' AND TIME='2016-03-02 21:07:37' AND DIMENSION1='0101' AND DIMENSION2='-1' AND DIMENSION3='-1' AND DIMENSION4='-1' AND VALUE='88' AND FLAG=0) T WHERE ROWNUM <= 1) WHERE RN > 0
通过debug生成的sql,更改time为todate函数后,可以查出来数据,但程序返回的结果却为null