这样好像不行,我只能手写里面的字段
public List<Map> getList(String sqltext){
Sql sql = Sqls.create(sqltext);
sql.setCallback(new SqlCallback() {
@Override
public Object invoke(Connection conn, ResultSet rs, Sql sql) throws SQLException {
List<Map<String,Object>> list = new ArrayList<>();
while (rs.next()){
Map<String,Object> map = new HashMap<>();
map.put(rs.getCursorName(), rs.getString("name")); //这一块字段是动态的,最好能一句sql直接返回List<Map>
list.add(map);
}
return list;
}
});
//sql.setEntity(dao.getEntity(Pet.class));
dao.execute(sql);
List<Map> list = sql.getList(Map.class);
return list;
}