sql语句执行后,控制台打印的sql语句执行后查到的结果与sql.callback赋值到List中的结果不一致,请问是什么原因造成的
public JSONObject getTable(Pager pager, String startDate, String endDate, String code) {
JSONObject rst = new JSONObject();
String str = " select t.drug_code_platform,t.drug_code_gtin,t.drug_code,t.drug_batchno,t.entered_datetime," +
"t.use_flag,p.drug_name,p.drug_spec,p.units,p.packing,p.manufactor " +
"from drug_code t left join drug_price p " +
"on p.drug_code_platform = t.drug_code_platform and p.drug_code_gtin = t.drug_code_gtin "
+ " where (t.drug_code_platform like '%'||@code||'%' or t.drug_code_gtin like '%'||@code||'%'" +
" or t.drug_batchno like '%'||@code||'%' or t.drug_code like '%'||@code||'%'" +
" or p.drug_name like '%'||@code||'%' or p.drug_spec like '%'||@code||'%' or p.drug_price like '%'||@code||'%' or p.units" +
" like '%'||@code||'%' or p.drug_form like '%'||@code||'%' or p.packing like '%'||@code||'%' or p.manufactor like '%'||@code||'%' )"
+ " and t.ENTERED_DATETIME BETWEEN @startDate and @endDate "
+ " order by t.drug_code_platform , t.drug_code_gtin";
Sql sql = Sqls.create(str);
sql.setParam("code", code);
sql.setParam("startDate", Times.D(startDate));
sql.setParam("endDate", Times.D(endDate+" 23:59:59"));
pager.setRecordCount((int) Daos.queryCount(dao, sql));
sql.setPager(pager);
sql.setCallback(Sqls.callback.records());
dao.execute(sql);
List<Record> list = sql.getList(Record.class) == null ? new ArrayList<Record>() : sql.getList(Record.class);
for(int i=0; i<list.size(); i++){
Record re = list.get(i);
System.out.println(re.get("drug_code").toString());
}
rst.put("data", list);
rst.put("pager", pager);
return ResponseVo.ok(rst);
}