分享一段代码,关于List
@SuppressWarnings("unchecked")
public List<LogisticsOrderType> getAllLogisticsOrderType() {
String sql = "from LogisticsOrderType t where t.status='A' and t.warehouseUsed=null";
return hibernateTemplate.find(sql + " order by t.id asc");
}
List<LogisticsOrderType> olist = logisticsOrdersTypeService.getAllLogisticsOrderType();
List<LogisticsOrderType> nlist = new ArrayList<LogisticsOrderType>();
if (olist != null && olist.size() > 0) {
for (LogisticsOrderType logisticsOrderType : olist) {
if (logisticsOrderType.getTypeName() != null
&& (logisticsOrderType.getTypeCode().contains("bjfh01"))||(logisticsOrderType.getTypeCode().contains("bjfh02"))) {
nlist.add(logisticsOrderType);
}
}
}
怎么讲感觉写得是有点烦了,大概意思是是获得一个List 再筛选里面的item 再放入一个list中
自信与努力 用心坚持
浙公网安备 33010602011771号