String sql2 = "select description,resourceid from t_resource where resourceid in (select resourceid from t_resource_role where roleid = @roleId) order by resourceid ";
Sql sqls = Sqls.create(sql2);
sqls.params().set("roleId", 19);
sqls.setCallback(new SqlCallback() {
@Override
public Object invoke(Connection conn, ResultSet rs, Sql sql) throws SQLException {
List<Record> list1 = new ArrayList<Record>();
while (rs.next()) {
Record record = new Record();
record.put("roleCode", rs.getInt("rolecode"));
record.put("resourceDesp", rs.getString("description"));
list1.add(record);
data.add(record);
}
return list1;
}
});
this.dao().execute(sqls);
代码如上,然后在执行到execute的时候,提示“java.sql.SQLException: Invalid column or parameter name.”
我把控制台输出的sql语句复制在数据库当中可以查询出结果。。。