if (strWhere != "") { sql += " where " + strWhere; }该怎么理解 strWhere又是什么意思 有什么用?谢谢
/***得到列表**@return*/publicList<category>GetList(StringstrWhere){List<category>list=nul...
/*** 得到列表** @return */
public List<category> GetList(String strWhere) {
List<category> list = null;
sql = "select * from category ";
if (strWhere != "") {
sql += " where " + strWhere;
}
sql += " order by id Desc ";
Result res = bd.getResultSet(sql, paramsList);
if (res != null && res.getRowCount() > 0) {// 存在数据
list = new ArrayList<category>();// 开始循环
for (int i = 0; i < res.getRowCount(); i++) {
// Result的每一行数据以key—value的形式保存(即Map)
Map row = res.getRows()[i];
category model = new category();
model.setid((Integer) row.get("id"));
model.setname((String) row.get("name"));
model.setparentId((Integer) row.get("parentId"));
model.setremark((String) row.get("remark"));
list.add(model);
}
}
return list;
} 展开
public List<category> GetList(String strWhere) {
List<category> list = null;
sql = "select * from category ";
if (strWhere != "") {
sql += " where " + strWhere;
}
sql += " order by id Desc ";
Result res = bd.getResultSet(sql, paramsList);
if (res != null && res.getRowCount() > 0) {// 存在数据
list = new ArrayList<category>();// 开始循环
for (int i = 0; i < res.getRowCount(); i++) {
// Result的每一行数据以key—value的形式保存(即Map)
Map row = res.getRows()[i];
category model = new category();
model.setid((Integer) row.get("id"));
model.setname((String) row.get("name"));
model.setparentId((Integer) row.get("parentId"));
model.setremark((String) row.get("remark"));
list.add(model);
}
}
return list;
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询