首页 > 代码库 > 马拉松参赛人员显示(瞬逝版)

马拉松参赛人员显示(瞬逝版)

service层代码如下:

// 马拉松参赛成员列表
public List<JoinMarathonView> joinMarathonList() {
List<JoinMarathonView> marathonjoinAllList = joinMarathonDao.getNamesByMarathon();//包含唯一mberid的集合
List<Marathon> allCityList =joinMarathonDao.getAllCity();
List<JoinMarathonView> allAwardList =joinMarathonDao.getAllAward();

for (JoinMarathonView coreofonelist : marathonjoinAllList) { //加城市

//List<String> listcitysnew1 = new ArrayList<String>();
StringBuilder citystr = new StringBuilder();
int count = 0;
for(Marathon allcityone : allCityList){
if(allcityone.getMemberId().equals(coreofonelist.getMemberId())){
//listcitysnew1.add(allcityone.getCity());
citystr.append(allcityone.getCity());
citystr.append(",");
count++;
}
}
//coreofonelist.setCity(listcitysnew1.toString().replace("[", "").replace("]", ""));
System.out.println(citystr);
coreofonelist.setCity(citystr.toString());
coreofonelist.setCount(count);
}//一个大循环结束

for (JoinMarathonView coreofonelist : marathonjoinAllList) { //加奖项
StringBuilder str = new StringBuilder();
for(JoinMarathonView allawardone : allAwardList){
if(allawardone.getMemberId().equals(coreofonelist.getMemberId())){
String addaward = allawardone.getName() + "x" + allawardone.getCount() + "(" + allawardone.getMemo() + ")";
str.append(addaward);
}
}
System.out.println(str);
coreofonelist.setAward(str.toString());
}//第二个大循环结束
return marathonjoinAllList;
}//方法结束

马拉松参赛人员显示(瞬逝版)