Skip to content

Commit

Permalink
add the cityId in game module, modified the gameEdit.jsp page and it'…
Browse files Browse the repository at this point in the history
…s controller
  • Loading branch information
leedarKen committed Feb 26, 2016
1 parent 9063192 commit 33cd2b7
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import javax.servlet.http.HttpSession;

import com.zmsport.iyuesai.service.CityService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -37,6 +38,9 @@ public class GameController {

@Autowired
private GameService service;

@Autowired
private CityService cityService ;

/**
* 获取赛事列表
Expand Down Expand Up @@ -67,6 +71,7 @@ public String edit(@PathVariable String type,@PathVariable long id,Model model)
if(type.equals("update")) {
model.addAttribute("game", service.getGamesById(id));
}
model.addAttribute("cityList", cityService.getEffectiveCitys()) ;
return "/admin/pages/gameEdit";
}

Expand Down
10 changes: 10 additions & 0 deletions src/main/java/com/zmsport/iyuesai/mapper/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ public class Game {
*/
private int teamNum;

private int cityId ;

/**
* @return the id
*/
Expand Down Expand Up @@ -261,4 +263,12 @@ public int getTeamNum() {
public void setTeamNum(int teamNum) {
this.teamNum = teamNum;
}

public int getCityId() {
return cityId;
}

public void setCityId(int cityId) {
this.cityId = cityId;
}
}
18 changes: 18 additions & 0 deletions src/main/webapp/admin/pages/gameEdit.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@
$('input[name="name"]').focus();
return false;
}
var cityId = $.trim($('#cityId').val());
if(cityId == -1) {
alert("请选择城市");
$('cityId').focus();
return false;
}
var duration = $.trim($('input[name="duration"]').val());
if(duration.length == 0) {
alert("请输入赛事时间");
Expand Down Expand Up @@ -118,6 +125,17 @@
<span class="ziduan"><span class="required">*</span>赛事名称:</span>
<div class="wen"><input type="text" name="name" class="input_cjxm2" value="<c:out value="${game.name }" />"></div>
</li>
<li>
<span class="ziduan"><span class="required">*</span>赛事城市:</span>
<div class="wen">
<select class="input_cjxm2" name="cityId" id="cityId">
<option value="-1">请选择</option>
<c:forEach items="${cityList}" var="city">
<option value="${city.id}">${city.cityName}</option>
</c:forEach>
</select>
</div>
</li>
<li>
<span class="ziduan"><span class="required">*</span>赛事时间:</span>
<div class="wen"><input type="text" name="duration" class="input_cjxm2" value="<c:out value="${game.duration }" />"></div>
Expand Down

0 comments on commit 33cd2b7

Please sign in to comment.