使用nutz1.60版本,代码如下
String query_sql="select * from demo_test a where 1=1 $autoaddsql";
HashMap param=new HashMap();
param.put("id", 3);
param.put("type", "N");
HashMap var=new HashMap();
var.put("autoaddsql", " and id=@id and a.type=@type");
Dao dao=NutOper.getDbDao("tsg");
Record rec=NutOper.getList(dao, query_sql, param, var);
public static List getList(Dao dao,String exesql,Map<String,Object> param,Map<String,Object> var) {
Sql sql3 = Sqls.create(exesql);
if (var!=null) {
sql3.vars().putAll(var);
}
if (param!=null) {
sql3.params().putAll(param);
}
if (pager!=null) {
sql3.setPager(pager);
}
sql3.setEntity(dao.getEntity(Record.class));
sql3.setCallback(Sqls.callback.entities());
dao.execute(sql3);
List ll=sql3.getList(Record.class);
return ll;
}
查不到记录