sql结果:
data_type datatypename
G 大气成分
J 雷达
M 产品
E 农气
A 地面
B 高空
代码
@At
@Ok("json")
/*
* select distinct fault.data_type,
* stationtype.datatypename from t_fault_total fault
* inner join t_stationtype stationtype on
* fault.data_type=stationtype.datatype;
*/
public List<String> getFaultBigTypes() {
String sqlStr="select distinct fault.data_type,"+
"stationtype.datatypename from t_fault_total fault "+
"inner join t_stationtype stationtype on "+
"fault.data_type=stationtype.datatype";
Sql sql = Sqls.create(sqlStr);
sql.setCallback(new SqlCallback() {
public Object invoke(Connection conn, ResultSet rs, Sql sql) throws SQLException {
List<String> list = new LinkedList<String>();
while (rs.next())
list.add(rs.getString("data_type"));
list.add(rs.getString("datatypename"));
return list;
}
});
return sql.getList(String.class);
}
返回null