Skip to content

Commit

Permalink
for share
Browse files Browse the repository at this point in the history
  • Loading branch information
leedar360 committed Dec 16, 2015
1 parent b3ada64 commit f429a07
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.zmsport.iyuesai.controller.site;

import java.sql.Date;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.*;

import javax.servlet.http.HttpSession;

Expand Down Expand Up @@ -64,7 +62,10 @@ public class SiteChallengeController {
public String list(Model model, HttpSession session) {
User currentUser = (User)session.getAttribute("user");
model.addAttribute("list", service.getAllChallenges(currentUser.getId()));
model.addAttribute("roundList", rService.getAllRoundsNew(currentUser.getId()));
List<Round> cList = new ArrayList<Round>();
cList = rService.getAllRoundsNew(currentUser.getId());
this.sortCList(cList);
model.addAttribute("roundList", cList );
return "/site/pages/challenge";
}

Expand Down Expand Up @@ -301,4 +302,15 @@ public String confirmRound(@RequestParam long roundApplyId, @RequestParam long r
public Object showRoundApply(@RequestParam long roundApplyId) {
return raService.getRoundApplyById(roundApplyId);
}


private void sortCList(List<Round> clist){
Collections.sort(clist, new Comparator() {
@Override
public int compare(Object o1, Object o2) {
return ((Round) o2).getTime().compareTo(((Round) o1).getTime());
//return new Double((String) o1).compareTo(new Double((String) o2));
}
});
}
}
4 changes: 2 additions & 2 deletions src/main/java/com/zmsport/iyuesai/mapper/challenge.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
</select>

<select id="getAllChallenges" parameterType="long" resultType="challenge">
SELECT * FROM (SELECT * FROM t_challenge WHERE creatorId=#{uid} ORDER BY time DESC) AS c1
SELECT * FROM (SELECT * FROM t_challenge WHERE creatorId=#{uid} and TIME > date_sub(NOW(),interval 7 day) ORDER BY time DESC) AS c1
UNION ALL
SELECT * FROM (SELECT * FROM t_challenge WHERE creatorId!=#{uid} ORDER BY time DESC) AS c2
SELECT * FROM (SELECT * FROM t_challenge WHERE creatorId!=#{uid} and TIME > date_sub(NOW(),interval 7 day) ORDER BY time DESC) AS c2
</select>

<select id="findChallengesByTeamId" parameterType="int" resultType="challenge">
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/zmsport/iyuesai/mapper/game.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</select>

<select id="getNewGamesByUser" parameterType="int" resultType="game">
SELECT * FROM t_game WHERE status=0 AND createType=1 ORDER BY createTime DESC
SELECT * FROM t_game WHERE status=0 AND createType=1 ORDER BY createTime DESC
</select>

<select id="getGamesById" parameterType="long" resultType="game">
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/zmsport/iyuesai/mapper/round.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@
</select>

<select id="getAllRoundsNew" parameterType="long" resultType="round">
SELECT * FROM t_round WHERE creatorId=#{uid}
SELECT * FROM t_round WHERE creatorId=#{uid} AND TIME > date_sub(NOW(),interval 7 day)
UNION ALL
SELECT * FROM t_round WHERE creatorId!=#{uid}
SELECT * FROM t_round WHERE creatorId!=#{uid} AND TIME > date_sub(NOW(),interval 7 day)
</select>

<select id="findRoundById" parameterType="long" resultType="round">
Expand Down
9 changes: 7 additions & 2 deletions src/main/webapp/site/pages/challengeAndRoundPublish.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
<meta name="viewport"
content="width=device-width,initial-scale=1,minimum-scale=1.0, maximum-scale=1,user-scalable=yes" />
<meta name="format-detection" content="telephone=no" />

<div id='wx_pic' style='margin:0 auto;display:none;'>
<img src='/site/images/yingdoulogo.jpg' />
</div>

<title></title>
<link rel="stylesheet" href="<c:url value="/site/css/style.css" />" />
<script type="text/javascript" src="<c:url value="/site/js/jquery.js" />"></script>
Expand Down Expand Up @@ -288,7 +293,7 @@
<tr>
<td height="40" align="right">*开始时间:</td>
<td height="40">
<select class="fab_sel" style="width:148px;" type="date" name="startDate" />
<select class="fab_sel" style="width:148px;" type="date" name="startDate" >
<%
for (int i=0; i<15; i++){
String dayStr = df.format(new Date(d.getTime() + i * 24 * 60 * 60 * 1000));
Expand All @@ -297,7 +302,7 @@
<%
}
%>
</select
</select>
<input class="fab_sel" style="width:148px;" type="time" name="startTimestamp" />
</td>
</tr>
Expand Down
7 changes: 5 additions & 2 deletions src/main/webapp/site/pages/team.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0, maximum-scale=1,user-scalable=yes" />
<meta name="format-detection" content="telephone=no" />
<title></title>
<div id='wx_pic' style='margin:0 auto;display:none;'>
<img src='/site/images/yingdoulogo.jpg' />
</div>
<title>硬斗超级战队</title>
<link rel="stylesheet" href="<c:url value="/site/css/style.css" />" />
<script type="text/javascript" src="<c:url value="/site/js/jquery.js" />"></script>
<%@ include file="../../commons/wechatJs.jsp"%>
Expand Down Expand Up @@ -246,7 +249,7 @@
<p class="ph_jshtit"><c:if test="${team.creatorId == user.id }"><a href="<c:url value="/site/team/allMembers?teamId=${team.id }" />">管理成员</a></c:if>球队成员(${fn:length(list)})</p>
<ul class="ph_txul">
<c:forEach items="${list }" var="user" varStatus="status">
<c:if test="${status.count < 9 }">
<c:if test="${status.count < 100 }">
<li><a href="<c:url value="/site/user/info/${user.id}" />"><img src="<c:url value="${user.headPic }" />">${user.username}</a></li>
</c:if>
</c:forEach>
Expand Down

0 comments on commit f429a07

Please sign in to comment.