選手一覧の取得方法を外部SQLに変更、それに伴いロジック・画面改修
@@ -0,0 +1,15 @@ | ||
1 | +select | |
2 | + * | |
3 | +from player p | |
4 | +inner join | |
5 | +(SELECT | |
6 | + t.team_id as team_id, | |
7 | + t.team_name as team_name, | |
8 | + t.short_name as short_name, | |
9 | + max(game_date) as last_join_date | |
10 | + FROM team t | |
11 | + inner join result r on t.team_id=r.team_id | |
12 | + inner join game g on r.game_id=g.game_id | |
13 | +group by team_id | |
14 | +order by last_join_date desc) team_date | |
15 | +on p.team_id=team_date.team_id; | |
\ No newline at end of file |
@@ -12,6 +12,7 @@ | ||
12 | 12 | import org.seasar.struts.annotation.Execute; |
13 | 13 | |
14 | 14 | import cx.myhome.ckoshien.dto.BattingResultDto; |
15 | +import cx.myhome.ckoshien.dto.PlayerDto; | |
15 | 16 | import cx.myhome.ckoshien.dto.TeamBattingResultDto; |
16 | 17 | import cx.myhome.ckoshien.dto.TeamPitchingResultDto; |
17 | 18 | import cx.myhome.ckoshien.entity.Player; |
@@ -35,7 +36,7 @@ | ||
35 | 36 | public PlayerForm playerForm; |
36 | 37 | |
37 | 38 | public List<Team> teamList; |
38 | - public List<Player> playerList; | |
39 | + public List<PlayerDto> playerList; | |
39 | 40 | public Player player; |
40 | 41 | @Resource |
41 | 42 | public BattingSumService battingSumService; |
@@ -21,6 +21,7 @@ | ||
21 | 21 | |
22 | 22 | import cx.myhome.ckoshien.dto.BattingResultDto; |
23 | 23 | import cx.myhome.ckoshien.dto.GameListDto; |
24 | +import cx.myhome.ckoshien.dto.PlayerDto; | |
24 | 25 | import cx.myhome.ckoshien.entity.BattingSum; |
25 | 26 | import cx.myhome.ckoshien.entity.Game; |
26 | 27 | import cx.myhome.ckoshien.entity.League; |
@@ -49,7 +50,7 @@ | ||
49 | 50 | @Resource |
50 | 51 | public PlayerService playerService; |
51 | 52 | public List<Team> teamList; |
52 | -public List<Player> playerList; | |
53 | +public List<PlayerDto> playerList; | |
53 | 54 | @Resource |
54 | 55 | public GameService gameService; |
55 | 56 | public Game game; |
@@ -8,6 +8,7 @@ | ||
8 | 8 | import javax.annotation.Resource; |
9 | 9 | |
10 | 10 | import cx.myhome.ckoshien.dto.GameListDto; |
11 | +import cx.myhome.ckoshien.dto.PlayerDto; | |
11 | 12 | import cx.myhome.ckoshien.entity.BattingSum; |
12 | 13 | import cx.myhome.ckoshien.entity.Game; |
13 | 14 | import cx.myhome.ckoshien.entity.Pitching; |
@@ -183,7 +184,7 @@ | ||
183 | 184 | } |
184 | 185 | } |
185 | 186 | |
186 | - public BattingSum convert2BattingSum(BattingSumForm battingSumForm,BattingSum battingSum,List<Player> playerList,int i){ | |
187 | + public BattingSum convert2BattingSum(BattingSumForm battingSumForm,BattingSum battingSum,List<PlayerDto> playerList,int i){ | |
187 | 188 | battingSum.playerId=Integer.parseInt(battingSumForm.playerId.get(i)); |
188 | 189 | //空文字の場合0と解釈 |
189 | 190 | if(battingSumForm.tpa.get(i)==""){ |
@@ -1,11 +1,20 @@ | ||
1 | 1 | package cx.myhome.ckoshien.service; |
2 | 2 | |
3 | +import cx.myhome.ckoshien.dto.BattingResultDto; | |
4 | +import cx.myhome.ckoshien.dto.PlayerDto; | |
3 | 5 | import cx.myhome.ckoshien.entity.Player; |
6 | + | |
7 | +import java.util.ArrayList; | |
8 | +import java.util.Date; | |
9 | +import java.util.HashMap; | |
4 | 10 | import java.util.List; |
11 | +import java.util.Map; | |
12 | + | |
5 | 13 | import javax.annotation.Generated; |
6 | 14 | |
7 | 15 | import static cx.myhome.ckoshien.entity.PlayerNames.*; |
8 | 16 | import static org.seasar.extension.jdbc.operation.Operations.*; |
17 | +import static org.seasar.extension.jdbc.parameter.Parameter.date; | |
9 | 18 | |
10 | 19 | /** |
11 | 20 | * {@link Player}のサービスクラスです。 |
@@ -14,7 +23,9 @@ | ||
14 | 23 | @Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.ServiceModelFactoryImpl"}, date = "2014/12/09 16:58:09") |
15 | 24 | public class PlayerService extends AbstractService<Player> { |
16 | 25 | |
17 | - /** | |
26 | + public List<PlayerDto> playerList; | |
27 | + | |
28 | + /** | |
18 | 29 | * 識別子でエンティティを検索します。 |
19 | 30 | * |
20 | 31 | * @param id |
@@ -30,9 +41,14 @@ | ||
30 | 41 | * |
31 | 42 | * @return エンティティのリスト |
32 | 43 | */ |
33 | - public List<Player> findAllOrderById() { | |
34 | - return select().innerJoin(team()).orderBy(asc(teamId())).getResultList(); | |
35 | - } | |
44 | +// public List<Player> findAllOrderById() { | |
45 | +// return select().innerJoin(team()).orderBy(asc(teamId())).getResultList(); | |
46 | +// } | |
47 | + public List<PlayerDto> findAllOrderById(){ | |
48 | + playerList=new ArrayList<PlayerDto>(); | |
49 | + playerList=jdbcManager.selectBySqlFile(PlayerDto.class, "cx.myhome.ckoshien.sql.TeamDate.sql").getResultList(); | |
50 | + return playerList; | |
51 | + } | |
36 | 52 | |
37 | 53 | public Player findByLoginId(String loginId) { |
38 | 54 | return select().where("loginId=?", loginId).getSingleResult(); |
@@ -0,0 +1,8 @@ | ||
1 | +package cx.myhome.ckoshien.dto; | |
2 | + | |
3 | +import cx.myhome.ckoshien.entity.Player; | |
4 | + | |
5 | +public class PlayerDto extends Player{ | |
6 | + public String shortName; | |
7 | + | |
8 | +} |