码迷,mamicode.com
首页 > 其他好文 > 详细

马拉松参赛人员旧版本最终版(私藏版)

时间:2017-03-30 10:18:01      阅读:210      评论:0      收藏:0      [点我收藏+]

标签:ble   getc   table   under   报名时间   姓名   时间   on()   return   

接上次改了一些后,加入map

>>>2*健康达人奖(每日步数达7500) 1*参与奖(11.11活动券 满246减46

service层代码如下:

public List<JoinMarathonView> joinMarathonList() {
List<JoinMarathonView> marathonjoinAllList = joinMarathonDao.getNamesByMarathon();
List<String> cityofonelist = null;
HashMap<String, Integer> awardMap = null;
int count = 0;
for (JoinMarathonView joinmaraOneList : marathonjoinAllList) {
List<JoinMarathonView> citysOfIdList = getCitysById(joinmaraOneList.getMemberId());
count = 0;
cityofonelist = new ArrayList<String>();
for (JoinMarathonView ct : citysOfIdList) {
cityofonelist.add(ct.getCity());
count++;
}
if (cityofonelist == null) {
joinmaraOneList.setCity("");
} else {
joinmaraOneList.setCity(cityofonelist.toString().replace("[", "").replace("]", ""));
joinmaraOneList.setCount(count);
}

List<Award> awards = getAwardsById(joinmaraOneList.getMemberId()); // 获取每个人的总奖牌
if (awards == null) {
joinmaraOneList.setAward_count(null);
} else {
awardMap = new HashMap<String, Integer>();
for (Award award : awards) {
String ac = award.getName()+"("+award.getMemo()+")";
if (awardMap.containsKey(ac)) {
awardMap.put(ac, (awardMap.get(ac).intValue()) + 1);
} else {
awardMap.put(ac, 1);
}
}
joinmaraOneList.setAward_count(awardMap);
}
}

return marathonjoinAllList;
}

附ftl页面显示块代码:

<table id="datatable"
class="table table-striped table-bordered dt-responsive nowrap order-column"
cellspacing="0" width="100%">
<thead>
<tr>
<th>人员ID</th>
<th>参赛人员姓名</th>
<th>性别</th>
<th>手机号</th>
<th>所在单位</th>
<th>参赛次数</th>
<th>参赛城市</th>
<th>报名时间</th>
<th>获得过的奖牌</th>
</tr>
</thead>
<tbody>
<#list joinList as join>
<tr>
<td>${join.id}</td><!-- 隐藏列 -->
<td class=‘dt-left‘><a href="/admin/marathon/detail?joinnameid=${join.id}">${join.membName}</a></td>
<td>${(join.gender == "1") ? string("男", "女")}</td>
<td>${join.mobile}</td>
<td>${join.hospital}</td>
<td>${join.count}</td>
<td>${join.city}</td>
<td>${join.createTime?string("yyyy-MM-dd HH:mm:ss")}</td>
<td>
<#list join.award_count?keys as key>
${join.award_count[key]}*${key}
</#list>
</td>
</tr>
</#list>
</tbody>
</table>

马拉松参赛人员旧版本最终版(私藏版)

标签:ble   getc   table   under   报名时间   姓名   时间   on()   return   

原文地址:http://www.cnblogs.com/zz-3m23d-begining/p/6644480.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!