List<LabelValueBean> list = equipScrapDAO.getScrapTypeList();
public List<LabelValueBean> getScrapTypeList() throws SQLException {
List<LabelValueBean> list = new ArrayList<LabelValueBean>();
String sql = "select SCRAP_TYPE,SCRAP_TYPE_NAME from SYS_Scrap_Type";
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
conn = getConnection();
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
while (rs.next()) {
LabelValueBean bean = new LabelValueBean();
bean.setValue(rs.getString("SCRAP_TYPE"));
bean.setLabel(rs.getString("SCRAP_TYPE_NAME"));
list.add(bean);
}
} finally {
close(rs, pstmt, conn);
}
return list;
}
转载于:https://my.oschina.net/u/934148/blog/519981