スタッツ画面の全面実装終了。
| @@ -25,7 +25,7 @@ | ||
| 25 | 25 | * </p> |
| 26 | 26 | * |
| 27 | 27 | */ |
| 28 | -@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.SqlFileTestModelFactoryImpl"}, date = "2015/06/19 22:14:24") | |
| 28 | +@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.SqlFileTestModelFactoryImpl"}, date = "2015/07/02 23:44:56") | |
| 29 | 29 | public class SqlFileTest extends S2TestCase { |
| 30 | 30 | |
| 31 | 31 | private JdbcManager jdbcManager; |
| @@ -17,27 +17,10 @@ | ||
| 17 | 17 | sum(win) as win, |
| 18 | 18 | sum(lose) as lose, |
| 19 | 19 | sum(save) as save |
| 20 | - FROM ( | |
| 21 | - select | |
| 22 | - player_id, | |
| 23 | - pl.name, | |
| 24 | - runs, | |
| 25 | - inning, | |
| 26 | - hit, | |
| 27 | - four_ball, | |
| 28 | - strike_out, | |
| 29 | - pa, | |
| 30 | - homerun, | |
| 31 | - complete, | |
| 32 | - shutout, | |
| 33 | - win, | |
| 34 | - save, | |
| 35 | - lose | |
| 36 | - from | |
| 20 | + FROM | |
| 37 | 21 | pitching p |
| 38 | 22 | inner join GAME g on g.game_id=p.game_id |
| 39 | 23 | inner join PLAYER pl on p.player_id=pl.id |
| 40 | 24 | WHERE game_date>=/*beginDate*/ and game_date<=/*endDate*/ |
| 41 | - ) as pitchig_result | |
| 42 | 25 | group by player_id |
| 43 | - order by era; | |
| \ No newline at end of file | ||
| 26 | + order by /*$order*/; | |
| \ No newline at end of file |
| @@ -15,23 +15,9 @@ | ||
| 15 | 15 | sum(strike_out) as strike_out, |
| 16 | 16 | sum(twobase) as twobase, |
| 17 | 17 | sum(homerun) as homerun |
| 18 | - FROM | |
| 19 | - (SELECT | |
| 20 | - player_id, | |
| 21 | - hit, | |
| 22 | - at_bats, | |
| 23 | - twobase, | |
| 24 | - homerun, | |
| 25 | - game_date, | |
| 26 | - four_ball, | |
| 27 | - tpa, | |
| 28 | - strike_out, | |
| 29 | - rbi, | |
| 30 | - name | |
| 31 | - FROM batting_sum b | |
| 18 | + FROM batting_sum b | |
| 32 | 19 | INNER JOIN GAME g on b.game_id=g.game_id |
| 33 | 20 | INNER JOIN PLAYER p on b.player_id=p.id |
| 34 | 21 | WHERE game_date>=/*beginDate*/ and game_date<=/*endDate*/ |
| 35 | - ) as batting_result | |
| 36 | 22 | group by player_id |
| 37 | -order by average desc; | |
| \ No newline at end of file | ||
| 23 | +order by /*$order*/; | |
| \ No newline at end of file |
| @@ -6,6 +6,6 @@ | ||
| 6 | 6 | * SQLファイルの定数クラスです。 |
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | -@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.SqlFileConstantsModelFactoryImpl"}, date = "2015/06/19 22:14:18") | |
| 9 | +@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.SqlFileConstantsModelFactoryImpl"}, date = "2015/07/02 23:44:51") | |
| 10 | 10 | public final class SqlFiles { |
| 11 | 11 | } |
| \ No newline at end of file |
| @@ -17,7 +17,7 @@ | ||
| 17 | 17 | * |
| 18 | 18 | */ |
| 19 | 19 | @Entity |
| 20 | -@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.EntityModelFactoryImpl"}, date = "2015/06/19 22:14:13") | |
| 20 | +@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.EntityModelFactoryImpl"}, date = "2015/07/02 23:44:46") | |
| 21 | 21 | public class Player implements Serializable { |
| 22 | 22 | |
| 23 | 23 | private static final long serialVersionUID = 1L; |
| @@ -2,6 +2,7 @@ | ||
| 2 | 2 | |
| 3 | 3 | import cx.myhome.ckoshien.entity.BattingDetailNames._BattingDetailNames; |
| 4 | 4 | import cx.myhome.ckoshien.entity.BattingSumNames._BattingSumNames; |
| 5 | +import cx.myhome.ckoshien.entity.LeagueNames._LeagueNames; | |
| 5 | 6 | import cx.myhome.ckoshien.entity.PitchingNames._PitchingNames; |
| 6 | 7 | import cx.myhome.ckoshien.entity.ResultNames._ResultNames; |
| 7 | 8 | import cx.myhome.ckoshien.entity.TeamNames._TeamNames; |
| @@ -13,7 +14,7 @@ | ||
| 13 | 14 | * {@link Game}のプロパティ名の集合です。 |
| 14 | 15 | * |
| 15 | 16 | */ |
| 16 | -@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.NamesModelFactoryImpl"}, date = "2015/06/19 22:14:16") | |
| 17 | +@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.NamesModelFactoryImpl"}, date = "2015/07/02 23:44:49") | |
| 17 | 18 | public class GameNames { |
| 18 | 19 | |
| 19 | 20 | /** |
| @@ -206,6 +207,15 @@ | ||
| 206 | 207 | } |
| 207 | 208 | |
| 208 | 209 | /** |
| 210 | + * leagueのプロパティ名を返します。 | |
| 211 | + * | |
| 212 | + * @return leagueのプロパティ名 | |
| 213 | + */ | |
| 214 | + public static _LeagueNames league() { | |
| 215 | + return new _LeagueNames("league"); | |
| 216 | + } | |
| 217 | + | |
| 218 | + /** | |
| 209 | 219 | * teamのプロパティ名を返します。 |
| 210 | 220 | * |
| 211 | 221 | * @return teamのプロパティ名 |
| @@ -464,6 +474,15 @@ | ||
| 464 | 474 | } |
| 465 | 475 | |
| 466 | 476 | /** |
| 477 | + * leagueのプロパティ名を返します。 | |
| 478 | + * | |
| 479 | + * @return leagueのプロパティ名 | |
| 480 | + */ | |
| 481 | + public _LeagueNames league() { | |
| 482 | + return new _LeagueNames(this, "league"); | |
| 483 | + } | |
| 484 | + | |
| 485 | + /** | |
| 467 | 486 | * teamのプロパティ名を返します。 |
| 468 | 487 | * |
| 469 | 488 | * @return teamのプロパティ名 |
| @@ -10,7 +10,7 @@ | ||
| 10 | 10 | * {@link BattingDetail}のプロパティ名の集合です。 |
| 11 | 11 | * |
| 12 | 12 | */ |
| 13 | -@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.NamesModelFactoryImpl"}, date = "2015/06/19 22:14:16") | |
| 13 | +@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.NamesModelFactoryImpl"}, date = "2015/07/02 23:44:49") | |
| 14 | 14 | public class BattingDetailNames { |
| 15 | 15 | |
| 16 | 16 | /** |
| @@ -10,7 +10,7 @@ | ||
| 10 | 10 | * {@link BattingSum}のプロパティ名の集合です。 |
| 11 | 11 | * |
| 12 | 12 | */ |
| 13 | -@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.NamesModelFactoryImpl"}, date = "2015/06/19 22:14:16") | |
| 13 | +@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.NamesModelFactoryImpl"}, date = "2015/07/02 23:44:49") | |
| 14 | 14 | public class BattingSumNames { |
| 15 | 15 | |
| 16 | 16 | /** |
| @@ -16,7 +16,7 @@ | ||
| 16 | 16 | * |
| 17 | 17 | */ |
| 18 | 18 | @Entity |
| 19 | -@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.EntityModelFactoryImpl"}, date = "2015/06/19 22:14:13") | |
| 19 | +@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.EntityModelFactoryImpl"}, date = "2015/07/02 23:44:46") | |
| 20 | 20 | public class League implements Serializable { |
| 21 | 21 | |
| 22 | 22 | private static final long serialVersionUID = 1L; |
| @@ -43,6 +43,10 @@ | ||
| 43 | 43 | @Column(precision = 10, nullable = false, unique = false) |
| 44 | 44 | public Integer totalFlg; |
| 45 | 45 | |
| 46 | + /** gameList関連プロパティ */ | |
| 47 | + @OneToMany(mappedBy = "league") | |
| 48 | + public List<Game> gameList; | |
| 49 | + | |
| 46 | 50 | /** resultList関連プロパティ */ |
| 47 | 51 | @OneToMany(mappedBy = "league") |
| 48 | 52 | public List<Result> resultList; |
| @@ -10,7 +10,7 @@ | ||
| 10 | 10 | * {@link Result}のプロパティ名の集合です。 |
| 11 | 11 | * |
| 12 | 12 | */ |
| 13 | -@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.NamesModelFactoryImpl"}, date = "2015/06/19 22:14:16") | |
| 13 | +@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.NamesModelFactoryImpl"}, date = "2015/07/02 23:44:49") | |
| 14 | 14 | public class ResultNames { |
| 15 | 15 | |
| 16 | 16 | /** |
| @@ -14,7 +14,7 @@ | ||
| 14 | 14 | * 名前クラスの集約です。 |
| 15 | 15 | * |
| 16 | 16 | */ |
| 17 | -@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.NamesAggregateModelFactoryImpl"}, date = "2015/06/19 22:14:16") | |
| 17 | +@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.NamesAggregateModelFactoryImpl"}, date = "2015/07/02 23:44:49") | |
| 18 | 18 | public class Names { |
| 19 | 19 | |
| 20 | 20 | /** |
| @@ -15,7 +15,7 @@ | ||
| 15 | 15 | * |
| 16 | 16 | */ |
| 17 | 17 | @Entity |
| 18 | -@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.EntityModelFactoryImpl"}, date = "2015/06/19 22:14:13") | |
| 18 | +@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.EntityModelFactoryImpl"}, date = "2015/07/02 23:44:46") | |
| 19 | 19 | public class Pitching implements Serializable { |
| 20 | 20 | |
| 21 | 21 | private static final long serialVersionUID = 1L; |
| @@ -18,7 +18,7 @@ | ||
| 18 | 18 | * |
| 19 | 19 | */ |
| 20 | 20 | @Entity |
| 21 | -@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.EntityModelFactoryImpl"}, date = "2015/06/19 22:13:26") | |
| 21 | +@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.EntityModelFactoryImpl"}, date = "2015/07/02 23:44:46") | |
| 22 | 22 | public class Game implements Serializable { |
| 23 | 23 | |
| 24 | 24 | private static final long serialVersionUID = 1L; |
| @@ -109,6 +109,10 @@ | ||
| 109 | 109 | @OneToMany(mappedBy = "game") |
| 110 | 110 | public List<BattingSum> battingSumList; |
| 111 | 111 | |
| 112 | + /** league関連プロパティ */ | |
| 113 | + @ManyToOne | |
| 114 | + public League league; | |
| 115 | + | |
| 112 | 116 | /** team関連プロパティ */ |
| 113 | 117 | @ManyToOne |
| 114 | 118 | @JoinColumn(name = "FIRST_TEAM", referencedColumnName = "TEAM_ID") |
| @@ -13,7 +13,7 @@ | ||
| 13 | 13 | * {@link Team}のプロパティ名の集合です。 |
| 14 | 14 | * |
| 15 | 15 | */ |
| 16 | -@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.NamesModelFactoryImpl"}, date = "2015/06/19 22:14:16") | |
| 16 | +@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.NamesModelFactoryImpl"}, date = "2015/07/02 23:44:49") | |
| 17 | 17 | public class TeamNames { |
| 18 | 18 | |
| 19 | 19 | /** |
| @@ -15,7 +15,7 @@ | ||
| 15 | 15 | * |
| 16 | 16 | */ |
| 17 | 17 | @Entity |
| 18 | -@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.EntityModelFactoryImpl"}, date = "2015/06/19 22:14:13") | |
| 18 | +@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.EntityModelFactoryImpl"}, date = "2015/07/02 23:44:46") | |
| 19 | 19 | public class BattingDetail implements Serializable { |
| 20 | 20 | |
| 21 | 21 | private static final long serialVersionUID = 1L; |
| @@ -15,7 +15,7 @@ | ||
| 15 | 15 | * |
| 16 | 16 | */ |
| 17 | 17 | @Entity |
| 18 | -@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.EntityModelFactoryImpl"}, date = "2015/06/19 22:14:13") | |
| 18 | +@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.EntityModelFactoryImpl"}, date = "2015/07/02 23:44:46") | |
| 19 | 19 | public class BattingSum implements Serializable { |
| 20 | 20 | |
| 21 | 21 | private static final long serialVersionUID = 1L; |
| @@ -15,7 +15,7 @@ | ||
| 15 | 15 | * |
| 16 | 16 | */ |
| 17 | 17 | @Entity |
| 18 | -@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.EntityModelFactoryImpl"}, date = "2015/06/19 22:14:13") | |
| 18 | +@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.EntityModelFactoryImpl"}, date = "2015/07/02 23:44:46") | |
| 19 | 19 | public class Result implements Serializable { |
| 20 | 20 | |
| 21 | 21 | private static final long serialVersionUID = 1L; |
| @@ -11,7 +11,7 @@ | ||
| 11 | 11 | * {@link Player}のプロパティ名の集合です。 |
| 12 | 12 | * |
| 13 | 13 | */ |
| 14 | -@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.NamesModelFactoryImpl"}, date = "2015/06/19 22:14:16") | |
| 14 | +@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.NamesModelFactoryImpl"}, date = "2015/07/02 23:44:49") | |
| 15 | 15 | public class PlayerNames { |
| 16 | 16 | |
| 17 | 17 | /** |
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | package cx.myhome.ckoshien.entity; |
| 2 | 2 | |
| 3 | +import cx.myhome.ckoshien.entity.GameNames._GameNames; | |
| 3 | 4 | import cx.myhome.ckoshien.entity.ResultNames._ResultNames; |
| 4 | 5 | import java.sql.Date; |
| 5 | 6 | import javax.annotation.Generated; |
| @@ -9,7 +10,7 @@ | ||
| 9 | 10 | * {@link League}のプロパティ名の集合です。 |
| 10 | 11 | * |
| 11 | 12 | */ |
| 12 | -@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.NamesModelFactoryImpl"}, date = "2015/06/19 22:14:16") | |
| 13 | +@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.NamesModelFactoryImpl"}, date = "2015/07/02 23:44:49") | |
| 13 | 14 | public class LeagueNames { |
| 14 | 15 | |
| 15 | 16 | /** |
| @@ -58,6 +59,15 @@ | ||
| 58 | 59 | } |
| 59 | 60 | |
| 60 | 61 | /** |
| 62 | + * gameListのプロパティ名を返します。 | |
| 63 | + * | |
| 64 | + * @return gameListのプロパティ名 | |
| 65 | + */ | |
| 66 | + public static _GameNames gameList() { | |
| 67 | + return new _GameNames("gameList"); | |
| 68 | + } | |
| 69 | + | |
| 70 | + /** | |
| 61 | 71 | * resultListのプロパティ名を返します。 |
| 62 | 72 | * |
| 63 | 73 | * @return resultListのプロパティ名 |
| @@ -145,6 +155,15 @@ | ||
| 145 | 155 | } |
| 146 | 156 | |
| 147 | 157 | /** |
| 158 | + * gameListのプロパティ名を返します。 | |
| 159 | + * | |
| 160 | + * @return gameListのプロパティ名 | |
| 161 | + */ | |
| 162 | + public _GameNames gameList() { | |
| 163 | + return new _GameNames(this, "gameList"); | |
| 164 | + } | |
| 165 | + | |
| 166 | + /** | |
| 148 | 167 | * resultListのプロパティ名を返します。 |
| 149 | 168 | * |
| 150 | 169 | * @return resultListのプロパティ名 |
| @@ -15,7 +15,7 @@ | ||
| 15 | 15 | * |
| 16 | 16 | */ |
| 17 | 17 | @Entity |
| 18 | -@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.EntityModelFactoryImpl"}, date = "2015/06/19 22:14:13") | |
| 18 | +@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.EntityModelFactoryImpl"}, date = "2015/07/02 23:44:46") | |
| 19 | 19 | public class Team implements Serializable { |
| 20 | 20 | |
| 21 | 21 | private static final long serialVersionUID = 1L; |
| @@ -10,7 +10,7 @@ | ||
| 10 | 10 | * {@link Pitching}のプロパティ名の集合です。 |
| 11 | 11 | * |
| 12 | 12 | */ |
| 13 | -@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.NamesModelFactoryImpl"}, date = "2015/06/19 22:14:16") | |
| 13 | +@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.NamesModelFactoryImpl"}, date = "2015/07/02 23:44:49") | |
| 14 | 14 | public class PitchingNames { |
| 15 | 15 | |
| 16 | 16 | /** |
| @@ -1,6 +1,7 @@ | ||
| 1 | 1 | package cx.myhome.ckoshien.action; |
| 2 | 2 | |
| 3 | 3 | import java.util.ArrayList; |
| 4 | +import java.util.Calendar; | |
| 4 | 5 | import java.util.Collections; |
| 5 | 6 | import java.util.List; |
| 6 | 7 |
| @@ -12,10 +13,12 @@ | ||
| 12 | 13 | import cx.myhome.ckoshien.dto.BattingResultDto; |
| 13 | 14 | import cx.myhome.ckoshien.dto.GameResultDto; |
| 14 | 15 | import cx.myhome.ckoshien.dto.PitchingResultDto; |
| 16 | +import cx.myhome.ckoshien.entity.Game; | |
| 15 | 17 | import cx.myhome.ckoshien.entity.League; |
| 16 | 18 | import cx.myhome.ckoshien.form.ResultForm; |
| 17 | 19 | import cx.myhome.ckoshien.logic.ResultLogic; |
| 18 | 20 | import cx.myhome.ckoshien.service.BattingSumService; |
| 21 | +import cx.myhome.ckoshien.service.GameService; | |
| 19 | 22 | import cx.myhome.ckoshien.service.LeagueService; |
| 20 | 23 | import cx.myhome.ckoshien.service.PitchingService; |
| 21 | 24 | import cx.myhome.ckoshien.service.ResultService; |
| @@ -40,6 +43,8 @@ | ||
| 40 | 43 | public List<GameResultDto> resultList; |
| 41 | 44 | @Resource |
| 42 | 45 | public ResultService resultService; |
| 46 | +@Resource | |
| 47 | +public GameService gameService; | |
| 43 | 48 | public int length; |
| 44 | 49 | public List<GameResultDto> opponentList; |
| 45 | 50 | public List<GameResultDto> resultList2; |
| @@ -47,6 +52,21 @@ | ||
| 47 | 52 | public List<BattingResultDto> homerunTop10; |
| 48 | 53 | public ResultLogic resultLogic; |
| 49 | 54 | public List<BattingResultDto> rbiTop10; |
| 55 | +public List<BattingResultDto> hitTop10; | |
| 56 | +public List<PitchingResultDto> eraTop10; | |
| 57 | +public List<PitchingResultDto> winTop10; | |
| 58 | +public List<PitchingResultDto> saveTop10; | |
| 59 | +public List<PitchingResultDto> strikeOutTop10; | |
| 60 | +public List<BattingResultDto> obpTop10; | |
| 61 | +public List<BattingResultDto> twobaseTop10; | |
| 62 | +public List<BattingResultDto> slgTop10; | |
| 63 | +public List<BattingResultDto> fourBallTop10; | |
| 64 | +public List<BattingResultDto> opsTop10; | |
| 65 | +public List<BattingResultDto> nsoTop10; | |
| 66 | +public Game game; | |
| 67 | +public int regAtBats; | |
| 68 | +public int regAtPitch; | |
| 69 | +public List<Game> gameList; | |
| 50 | 70 | |
| 51 | 71 | |
| 52 | 72 | @Execute(validator = false) |
| @@ -67,28 +87,76 @@ | ||
| 67 | 87 | resultList2=resultList; |
| 68 | 88 | length=resultList.size(); |
| 69 | 89 | opponentList=resultService.findOpponentResult(Integer.parseInt(resultForm.id)); |
| 70 | - battingResultList=battingSumService.findByPeriod(league.beginDate, league.endDate); | |
| 71 | - pitchingResultList=pitchingService.findByPeriod(league.beginDate, league.endDate); | |
| 90 | + battingResultList=battingSumService.findByPeriod(league.beginDate, league.endDate,"average desc"); | |
| 91 | + pitchingResultList=pitchingService.findByPeriod(league.beginDate, league.endDate,"era asc"); | |
| 92 | + gameList=gameService.findByPeriod(league.beginDate, league.endDate); | |
| 93 | + regAtBats=0; | |
| 94 | + regAtPitch=0; | |
| 95 | + if (gameList.size()>0){ | |
| 96 | + game=gameList.get(0); | |
| 97 | + //最新の試合日付がリーグ戦期間内だった場合 | |
| 98 | + if(game.gameDate.compareTo(league.beginDate)>=0&&game.gameDate.compareTo(league.endDate)<=0){ | |
| 99 | + Calendar cal=Calendar.getInstance(); | |
| 100 | + Calendar cal2=Calendar.getInstance(); | |
| 101 | + cal.setTime(game.gameDate); | |
| 102 | + cal2.setTime(league.beginDate); | |
| 103 | + int gameMonth = cal.get(Calendar.MONTH)+1; | |
| 104 | + int leagueMonth = cal2.get(Calendar.MONTH)+1; | |
| 105 | + regAtBats=(gameMonth-leagueMonth+1)*7; | |
| 106 | + regAtPitch=(gameMonth-leagueMonth+1)*3; | |
| 107 | + }else{ | |
| 108 | + //リーグ戦期間外だった場合 | |
| 109 | + Calendar cal=Calendar.getInstance(); | |
| 110 | + Calendar cal2=Calendar.getInstance(); | |
| 111 | + cal.setTime(league.beginDate); | |
| 112 | + cal2.setTime(league.endDate); | |
| 113 | + int beginMonth = cal.get(Calendar.MONTH)+1; | |
| 114 | + int endMonth = cal2.get(Calendar.MONTH)+1; | |
| 115 | + regAtBats=(endMonth-beginMonth+1)*7; | |
| 116 | + regAtPitch=(endMonth-beginMonth+1)*3; | |
| 117 | + } | |
| 118 | + } | |
| 72 | 119 | resultLogic=new ResultLogic(); |
| 73 | 120 | //打率TOP10 |
| 74 | - averageTop10=resultLogic.returnAverageTop10(battingResultList); | |
| 75 | -// Java7のソートにバグがありexceptionが発生するのでコメントアウト | |
| 76 | -// //HRTOP10 | |
| 77 | -// homerunTop10=new ArrayList<BattingResultDto>(); | |
| 78 | -// for(int i=0;i<battingResultList.size();i++){ | |
| 79 | -// homerunTop10.add(battingResultList.get(i)); | |
| 80 | -// } | |
| 81 | -// Collections.sort(homerunTop10, new HomerunComparator()); | |
| 82 | -// Collections.reverse(homerunTop10); | |
| 83 | -// homerunTop10=resultLogic.returnHomerunTop10(homerunTop10); | |
| 84 | -// //打点TOP10 | |
| 85 | -// rbiTop10=new ArrayList<BattingResultDto>(); | |
| 86 | -// for(int i=0;i<battingResultList.size();i++){ | |
| 87 | -// rbiTop10.add(battingResultList.get(i)); | |
| 88 | -// } | |
| 89 | -// Collections.sort(rbiTop10, new RbiComparator()); | |
| 90 | -// Collections.reverse(rbiTop10); | |
| 91 | -// rbiTop10=resultLogic.returnRbiTop10(rbiTop10); | |
| 121 | + averageTop10=resultLogic.returnAverageTop10(battingResultList,regAtBats); | |
| 122 | + //HRTOP10 | |
| 123 | + homerunTop10=battingSumService.findByPeriod(league.beginDate, league.endDate,"homerun desc"); | |
| 124 | + homerunTop10=resultLogic.returnHomerunTop10(homerunTop10); | |
| 125 | + //打点TOP10 | |
| 126 | + rbiTop10=battingSumService.findByPeriod(league.beginDate, league.endDate,"rbi desc"); | |
| 127 | + rbiTop10=resultLogic.returnRbiTop10(rbiTop10); | |
| 128 | + //安打数TOP10 | |
| 129 | + hitTop10=battingSumService.findByPeriod(league.beginDate, league.endDate,"hit desc"); | |
| 130 | + hitTop10=resultLogic.returnHitTop10(hitTop10); | |
| 131 | + //防御率TOP10 | |
| 132 | + eraTop10=resultLogic.returnEraTop10(pitchingResultList,regAtPitch); | |
| 133 | + //勝利数TOP10 | |
| 134 | + winTop10=pitchingService.findByPeriod(league.beginDate, league.endDate,"win desc"); | |
| 135 | + winTop10=resultLogic.returnWinTop10(winTop10); | |
| 136 | + //セーブTOP10 | |
| 137 | + saveTop10=pitchingService.findByPeriod(league.beginDate, league.endDate,"save desc,era asc"); | |
| 138 | + saveTop10=resultLogic.returnSaveTop10(saveTop10); | |
| 139 | + //奪三振TOP10 | |
| 140 | + strikeOutTop10=pitchingService.findByPeriod(league.beginDate, league.endDate,"strike_out desc"); | |
| 141 | + strikeOutTop10=resultLogic.returnStrikeOutTop10(strikeOutTop10); | |
| 142 | + //出塁率TOP10 | |
| 143 | + obpTop10=battingSumService.findByPeriod(league.beginDate, league.endDate,"obp desc"); | |
| 144 | + obpTop10=resultLogic.returnObpTop10(obpTop10,regAtBats); | |
| 145 | + //二塁打TOP10 | |
| 146 | + twobaseTop10=battingSumService.findByPeriod(league.beginDate, league.endDate,"twobase desc"); | |
| 147 | + twobaseTop10=resultLogic.returnTwobaseTop10(twobaseTop10); | |
| 148 | + //長打率TOP10 | |
| 149 | + slgTop10=battingSumService.findByPeriod(league.beginDate, league.endDate,"slg desc"); | |
| 150 | + slgTop10=resultLogic.returnSlgTop10(slgTop10,regAtBats); | |
| 151 | + //最多四球TOP10 | |
| 152 | + fourBallTop10=battingSumService.findByPeriod(league.beginDate, league.endDate,"four_ball desc"); | |
| 153 | + fourBallTop10=resultLogic.returnFourBallTop10(fourBallTop10); | |
| 154 | + //OPS TOP10 | |
| 155 | + opsTop10=battingSumService.findByPeriod(league.beginDate, league.endDate,"ops desc"); | |
| 156 | + opsTop10=resultLogic.returnOpsTop10(opsTop10,regAtBats); | |
| 157 | + //最多四球TOP10 | |
| 158 | + nsoTop10=battingSumService.findByPeriod(league.beginDate, league.endDate,"not_strike_out asc"); | |
| 159 | + nsoTop10=resultLogic.returnNsoTop10(nsoTop10); | |
| 92 | 160 | return "stats.jsp"; |
| 93 | 161 | } |
| 94 | 162 | } |
| @@ -4,6 +4,7 @@ | ||
| 4 | 4 | import java.util.List; |
| 5 | 5 | |
| 6 | 6 | import cx.myhome.ckoshien.dto.BattingResultDto; |
| 7 | +import cx.myhome.ckoshien.dto.PitchingResultDto; | |
| 7 | 8 | |
| 8 | 9 | public class ResultLogic { |
| 9 | 10 | public List<BattingResultDto> averageTop10; |
| @@ -10,14 +11,26 @@ | ||
| 10 | 11 | public BattingResultDto battingResultDto; |
| 11 | 12 | public List<BattingResultDto> homerunTop10; |
| 12 | 13 | public List<BattingResultDto> rbiTop10; |
| 14 | + public List<BattingResultDto> hitTop10; | |
| 15 | + public PitchingResultDto pitchingResultDto; | |
| 16 | + public List<PitchingResultDto> eraTop10; | |
| 17 | + public List<PitchingResultDto> winTop10; | |
| 18 | + public List<PitchingResultDto> saveTop10; | |
| 19 | + public List<PitchingResultDto> strikeOutTop10; | |
| 20 | + public List<BattingResultDto> obpTop10; | |
| 21 | + public List<BattingResultDto> twobaseTop10; | |
| 22 | + public List<BattingResultDto> slgTop10; | |
| 23 | + public List<BattingResultDto> fourBallTop10; | |
| 24 | + public List<BattingResultDto> opsTop10; | |
| 25 | + public List<BattingResultDto> nsoTop10; | |
| 13 | 26 | |
| 14 | - public List<BattingResultDto> returnAverageTop10(List<BattingResultDto> battingResultList){ | |
| 27 | + public List<BattingResultDto> returnAverageTop10(List<BattingResultDto> battingResultList,int regAtBats){ | |
| 15 | 28 | int j=0; |
| 16 | 29 | int k=0; |
| 17 | 30 | averageTop10=new ArrayList<BattingResultDto>(); |
| 18 | 31 | for(int i=0;i<battingResultList.size();i++){ |
| 19 | 32 | battingResultDto=new BattingResultDto(); |
| 20 | - if(battingResultList.get(i).tpa>=42){ | |
| 33 | + if(battingResultList.get(i).tpa>=regAtBats){ | |
| 21 | 34 | j++; |
| 22 | 35 | if (i>=1&&!(battingResultList.get(i-1).average==battingResultList.get(i).average)){ |
| 23 | 36 | battingResultDto.rank=j; |
| @@ -41,22 +54,24 @@ | ||
| 41 | 54 | homerunTop10=new ArrayList<BattingResultDto>(); |
| 42 | 55 | for(int i=0;i<battingResultList.size();i++){ |
| 43 | 56 | battingResultDto=new BattingResultDto(); |
| 44 | - j++; | |
| 45 | - if (i==0){ | |
| 46 | - battingResultDto.rank=1; | |
| 57 | + if(battingResultList.get(i).homerun>0){ | |
| 58 | + j++; | |
| 59 | + if (i==0){ | |
| 60 | + battingResultDto.rank=1; | |
| 61 | + } | |
| 62 | + if (i>=1 && (!battingResultList.get(i-1).homerun.equals(battingResultList.get(i).homerun))){ | |
| 63 | + battingResultDto.rank=j; | |
| 64 | + k=j; | |
| 65 | + } | |
| 66 | + convert2BattingResultDto(battingResultList,i); | |
| 67 | + if (battingResultDto.rank==null||battingResultDto.rank<=10){ | |
| 68 | + if (k>=11){ | |
| 69 | + break; | |
| 70 | + } | |
| 71 | + homerunTop10.add(battingResultDto); | |
| 72 | + } | |
| 47 | 73 | } |
| 48 | - if (i>=1 && (!battingResultList.get(i-1).homerun.equals(battingResultList.get(i).homerun))){ | |
| 49 | - battingResultDto.rank=j; | |
| 50 | - k=j; | |
| 51 | - } | |
| 52 | - convert2BattingResultDto(battingResultList,i); | |
| 53 | - if (battingResultDto.rank==null||battingResultDto.rank<=10){ | |
| 54 | - if (k>=11){ | |
| 55 | - break; | |
| 56 | - } | |
| 57 | - homerunTop10.add(battingResultDto); | |
| 58 | 74 | |
| 59 | - } | |
| 60 | 75 | } |
| 61 | 76 | return homerunTop10; |
| 62 | 77 | } |
| @@ -67,26 +82,360 @@ | ||
| 67 | 82 | rbiTop10=new ArrayList<BattingResultDto>(); |
| 68 | 83 | for(int i=0;i<battingResultList.size();i++){ |
| 69 | 84 | battingResultDto=new BattingResultDto(); |
| 70 | - j++; | |
| 71 | - if (i==0){ | |
| 72 | - battingResultDto.rank=1; | |
| 85 | + if(battingResultList.get(i).rbi>0){ | |
| 86 | + j++; | |
| 87 | + if (i==0){ | |
| 88 | + battingResultDto.rank=1; | |
| 89 | + } | |
| 90 | + if (i>=1 && (!battingResultList.get(i-1).rbi.equals(battingResultList.get(i).rbi))){ | |
| 91 | + battingResultDto.rank=j; | |
| 92 | + k=j; | |
| 93 | + } | |
| 94 | + convert2BattingResultDto(battingResultList,i); | |
| 95 | + if (battingResultDto.rank==null||battingResultDto.rank<=10){ | |
| 96 | + if (k>=11){ | |
| 97 | + break; | |
| 98 | + } | |
| 99 | + rbiTop10.add(battingResultDto); | |
| 100 | + } | |
| 101 | + | |
| 73 | 102 | } |
| 74 | - if (i>=1 && (!battingResultList.get(i-1).rbi.equals(battingResultList.get(i).rbi))){ | |
| 75 | - battingResultDto.rank=j; | |
| 76 | - k=j; | |
| 103 | + } | |
| 104 | + return rbiTop10; | |
| 105 | + } | |
| 106 | + | |
| 107 | + public List<BattingResultDto> returnHitTop10(List<BattingResultDto> battingResultList){ | |
| 108 | + int j=0; | |
| 109 | + int k=0; | |
| 110 | + hitTop10=new ArrayList<BattingResultDto>(); | |
| 111 | + for(int i=0;i<battingResultList.size();i++){ | |
| 112 | + battingResultDto=new BattingResultDto(); | |
| 113 | + if(battingResultList.get(i).hit>0){ | |
| 114 | + j++; | |
| 115 | + if (i==0){ | |
| 116 | + battingResultDto.rank=1; | |
| 117 | + } | |
| 118 | + if (i>=1 && (!battingResultList.get(i-1).hit.equals(battingResultList.get(i).hit))){ | |
| 119 | + battingResultDto.rank=j; | |
| 120 | + k=j; | |
| 121 | + } | |
| 122 | + convert2BattingResultDto(battingResultList,i); | |
| 123 | + if (battingResultDto.rank==null||battingResultDto.rank<=10){ | |
| 124 | + if (k>=11){ | |
| 125 | + break; | |
| 126 | + } | |
| 127 | + hitTop10.add(battingResultDto); | |
| 128 | + } | |
| 77 | 129 | } |
| 78 | - convert2BattingResultDto(battingResultList,i); | |
| 79 | - if (battingResultDto.rank==null||battingResultDto.rank<=10){ | |
| 80 | - if (k>=11){ | |
| 81 | - break; | |
| 130 | + } | |
| 131 | + return hitTop10; | |
| 132 | + } | |
| 133 | + | |
| 134 | + public List<BattingResultDto> returnObpTop10(List<BattingResultDto> battingResultList,int regAtBats){ | |
| 135 | + int j=0; | |
| 136 | + int k=0; | |
| 137 | + obpTop10=new ArrayList<BattingResultDto>(); | |
| 138 | + for(int i=0;i<battingResultList.size();i++){ | |
| 139 | + battingResultDto=new BattingResultDto(); | |
| 140 | + if(battingResultList.get(i).tpa>=regAtBats){ | |
| 141 | + j++; | |
| 142 | + if (i==0){ | |
| 143 | + battingResultDto.rank=1; | |
| 82 | 144 | } |
| 83 | - rbiTop10.add(battingResultDto); | |
| 145 | + if (i>=1 && (!battingResultList.get(i-1).obp.equals(battingResultList.get(i).obp))){ | |
| 146 | + battingResultDto.rank=j; | |
| 147 | + k=j; | |
| 148 | + } | |
| 149 | + convert2BattingResultDto(battingResultList,i); | |
| 150 | + if (battingResultDto.rank==null||battingResultDto.rank<=10){ | |
| 151 | + if (k>=11){ | |
| 152 | + break; | |
| 153 | + } | |
| 154 | + obpTop10.add(battingResultDto); | |
| 155 | + } | |
| 156 | + } | |
| 157 | + } | |
| 158 | + return obpTop10; | |
| 159 | + } | |
| 84 | 160 | |
| 161 | + public List<BattingResultDto> returnTwobaseTop10(List<BattingResultDto> battingResultList){ | |
| 162 | + int j=0; | |
| 163 | + int k=0; | |
| 164 | + twobaseTop10=new ArrayList<BattingResultDto>(); | |
| 165 | + for(int i=0;i<battingResultList.size();i++){ | |
| 166 | + battingResultDto=new BattingResultDto(); | |
| 167 | + if(battingResultList.get(i).twobase>0){ | |
| 168 | + j++; | |
| 169 | + if (i==0){ | |
| 170 | + battingResultDto.rank=1; | |
| 171 | + k=1; | |
| 172 | + } | |
| 173 | + if (i>=1 && (!battingResultList.get(i-1).twobase.equals(battingResultList.get(i).twobase))){ | |
| 174 | + battingResultDto.rank=j; | |
| 175 | + k=j; | |
| 176 | + } | |
| 177 | + if (i>=1 && (battingResultList.get(i-1).twobase.equals(battingResultList.get(i).twobase))){ | |
| 178 | + battingResultDto.rank=k; | |
| 179 | + } | |
| 180 | + convert2BattingResultDto(battingResultList,i); | |
| 181 | + if (battingResultDto.rank==null||battingResultDto.rank<=10){ | |
| 182 | + if (k>=11){ | |
| 183 | + break; | |
| 184 | + } | |
| 185 | + twobaseTop10.add(battingResultDto); | |
| 186 | + } | |
| 85 | 187 | } |
| 86 | 188 | } |
| 87 | - return rbiTop10; | |
| 189 | + return twobaseTop10; | |
| 88 | 190 | } |
| 191 | + public List<BattingResultDto> returnSlgTop10(List<BattingResultDto> battingResultList,int regAtBats){ | |
| 192 | + int j=0; | |
| 193 | + int k=0; | |
| 194 | + slgTop10=new ArrayList<BattingResultDto>(); | |
| 195 | + for(int i=0;i<battingResultList.size();i++){ | |
| 196 | + battingResultDto=new BattingResultDto(); | |
| 197 | + if(battingResultList.get(i).tpa>=regAtBats){ | |
| 198 | + j++; | |
| 199 | + if (i==0){ | |
| 200 | + battingResultDto.rank=1; | |
| 201 | + } | |
| 202 | + if (i>=1 && (!battingResultList.get(i-1).slg.equals(battingResultList.get(i).slg))){ | |
| 203 | + battingResultDto.rank=j; | |
| 204 | + k=j; | |
| 205 | + } | |
| 206 | + convert2BattingResultDto(battingResultList,i); | |
| 207 | + if (battingResultDto.rank==null||battingResultDto.rank<=10){ | |
| 208 | + if (k>=11){ | |
| 209 | + break; | |
| 210 | + } | |
| 211 | + slgTop10.add(battingResultDto); | |
| 212 | + } | |
| 213 | + } | |
| 214 | + } | |
| 215 | + return slgTop10; | |
| 216 | + } | |
| 89 | 217 | |
| 218 | + public List<BattingResultDto> returnFourBallTop10(List<BattingResultDto> battingResultList){ | |
| 219 | + int j=0; | |
| 220 | + int k=0; | |
| 221 | + fourBallTop10=new ArrayList<BattingResultDto>(); | |
| 222 | + for(int i=0;i<battingResultList.size();i++){ | |
| 223 | + battingResultDto=new BattingResultDto(); | |
| 224 | + if(battingResultList.get(i).fourBall>0){ | |
| 225 | + j++; | |
| 226 | + if (i==0){ | |
| 227 | + battingResultDto.rank=1; | |
| 228 | + k=1; | |
| 229 | + } | |
| 230 | + if (i>=1 && (!battingResultList.get(i-1).fourBall.equals(battingResultList.get(i).fourBall))){ | |
| 231 | + battingResultDto.rank=j; | |
| 232 | + k=j; | |
| 233 | + } | |
| 234 | + if (i>=1 && (battingResultList.get(i-1).fourBall.equals(battingResultList.get(i).fourBall))){ | |
| 235 | + battingResultDto.rank=k; | |
| 236 | + } | |
| 237 | + convert2BattingResultDto(battingResultList,i); | |
| 238 | + if (battingResultDto.rank==null||battingResultDto.rank<=10){ | |
| 239 | + if (k>=11){ | |
| 240 | + break; | |
| 241 | + } | |
| 242 | + fourBallTop10.add(battingResultDto); | |
| 243 | + } | |
| 244 | + } | |
| 245 | + } | |
| 246 | + return fourBallTop10; | |
| 247 | + } | |
| 248 | + | |
| 249 | + public List<BattingResultDto> returnOpsTop10(List<BattingResultDto> battingResultList,int regAtBats){ | |
| 250 | + int j=0; | |
| 251 | + int k=0; | |
| 252 | + opsTop10=new ArrayList<BattingResultDto>(); | |
| 253 | + for(int i=0;i<battingResultList.size();i++){ | |
| 254 | + battingResultDto=new BattingResultDto(); | |
| 255 | + if(battingResultList.get(i).tpa>=regAtBats){ | |
| 256 | + j++; | |
| 257 | + if (i==0){ | |
| 258 | + battingResultDto.rank=1; | |
| 259 | + } | |
| 260 | + if (i>=1 && (!battingResultList.get(i-1).ops.equals(battingResultList.get(i).ops))){ | |
| 261 | + battingResultDto.rank=j; | |
| 262 | + k=j; | |
| 263 | + } | |
| 264 | + convert2BattingResultDto(battingResultList,i); | |
| 265 | + if (battingResultDto.rank==null||battingResultDto.rank<=10){ | |
| 266 | + if (k>=11){ | |
| 267 | + break; | |
| 268 | + } | |
| 269 | + opsTop10.add(battingResultDto); | |
| 270 | + } | |
| 271 | + } | |
| 272 | + } | |
| 273 | + return opsTop10; | |
| 274 | + } | |
| 275 | + | |
| 276 | + public List<BattingResultDto> returnNsoTop10(List<BattingResultDto> battingResultList){ | |
| 277 | + int j=0; | |
| 278 | + int k=0; | |
| 279 | + nsoTop10=new ArrayList<BattingResultDto>(); | |
| 280 | + for(int i=0;i<battingResultList.size();i++){ | |
| 281 | + battingResultDto=new BattingResultDto(); | |
| 282 | + if(battingResultList.get(i).notStrikeOut>0){ | |
| 283 | + j++; | |
| 284 | + if (i==0){ | |
| 285 | + battingResultDto.rank=1; | |
| 286 | + } | |
| 287 | + if (i>=1 && (!battingResultList.get(i-1).notStrikeOut.equals(battingResultList.get(i).notStrikeOut))){ | |
| 288 | + battingResultDto.rank=j; | |
| 289 | + k=j; | |
| 290 | + } | |
| 291 | + convert2BattingResultDto(battingResultList,i); | |
| 292 | + if (battingResultDto.rank==null||battingResultDto.rank<=10){ | |
| 293 | + if (k>=11){ | |
| 294 | + break; | |
| 295 | + } | |
| 296 | + nsoTop10.add(battingResultDto); | |
| 297 | + } | |
| 298 | + } | |
| 299 | + } | |
| 300 | + return nsoTop10; | |
| 301 | + } | |
| 302 | + | |
| 303 | + public List<PitchingResultDto> returnEraTop10(List<PitchingResultDto> pitchingResultList,int regAtPitch){ | |
| 304 | + int j=0; | |
| 305 | + int k=0; | |
| 306 | + eraTop10=new ArrayList<PitchingResultDto>(); | |
| 307 | + for(int i=0;i<pitchingResultList.size();i++){ | |
| 308 | + pitchingResultDto=new PitchingResultDto(); | |
| 309 | + | |
| 310 | + if(pitchingResultList.get(i).inning>=regAtPitch){ | |
| 311 | + j++; | |
| 312 | + if (i==0){ | |
| 313 | + pitchingResultDto.rank=1; | |
| 314 | + } | |
| 315 | + if (i>=1&&!(pitchingResultList.get(i-1).era==pitchingResultList.get(i).era)){ | |
| 316 | + pitchingResultDto.rank=j; | |
| 317 | + k=j; | |
| 318 | + } | |
| 319 | + convert2PitchingResultDto(pitchingResultList,i); | |
| 320 | + if (pitchingResultDto.rank==null||pitchingResultDto.rank<=10){ | |
| 321 | + if (k>=11){ | |
| 322 | + break; | |
| 323 | + } | |
| 324 | + eraTop10.add(pitchingResultDto); | |
| 325 | + } | |
| 326 | + } | |
| 327 | + } | |
| 328 | + return eraTop10; | |
| 329 | + } | |
| 330 | + | |
| 331 | + public List<PitchingResultDto> returnWinTop10(List<PitchingResultDto> pitchingResultList){ | |
| 332 | + int j=0; | |
| 333 | + int k=0; | |
| 334 | + winTop10=new ArrayList<PitchingResultDto>(); | |
| 335 | + for(int i=0;i<pitchingResultList.size();i++){ | |
| 336 | + pitchingResultDto=new PitchingResultDto(); | |
| 337 | + if (pitchingResultList.get(i).win>0){ | |
| 338 | + j++; | |
| 339 | + if (i==0){ | |
| 340 | + pitchingResultDto.rank=1; | |
| 341 | + } | |
| 342 | + if (i>=1&&!(pitchingResultList.get(i-1).win.equals(pitchingResultList.get(i).win))){ | |
| 343 | + System.out.println(pitchingResultList.get(i-1).win+","+pitchingResultList.get(i).win); | |
| 344 | + pitchingResultDto.rank=j; | |
| 345 | + k=j; | |
| 346 | + } | |
| 347 | + convert2PitchingResultDto(pitchingResultList,i); | |
| 348 | + if (pitchingResultDto.rank==null||pitchingResultDto.rank<=10){ | |
| 349 | + if (k>=11){ | |
| 350 | + break; | |
| 351 | + } | |
| 352 | + winTop10.add(pitchingResultDto); | |
| 353 | + } | |
| 354 | + } | |
| 355 | + | |
| 356 | + } | |
| 357 | + return winTop10; | |
| 358 | + } | |
| 359 | + public List<PitchingResultDto> returnSaveTop10(List<PitchingResultDto> pitchingResultList){ | |
| 360 | + int j=0; | |
| 361 | + int k=0; | |
| 362 | + saveTop10=new ArrayList<PitchingResultDto>(); | |
| 363 | + for(int i=0;i<pitchingResultList.size();i++){ | |
| 364 | + pitchingResultDto=new PitchingResultDto(); | |
| 365 | + if (pitchingResultList.get(i).save>0){ | |
| 366 | + j++; | |
| 367 | + if (i==0){ | |
| 368 | + pitchingResultDto.rank=1; | |
| 369 | + } | |
| 370 | + if (i>=1&&!(pitchingResultList.get(i-1).save.equals(pitchingResultList.get(i).save))){ | |
| 371 | + //System.out.println(pitchingResultList.get(i-1).win+","+pitchingResultList.get(i).win); | |
| 372 | + pitchingResultDto.rank=j; | |
| 373 | + k=j; | |
| 374 | + } | |
| 375 | + convert2PitchingResultDto(pitchingResultList,i); | |
| 376 | + if (pitchingResultDto.rank==null||pitchingResultDto.rank<=10){ | |
| 377 | + if (k>=11){ | |
| 378 | + break; | |
| 379 | + } | |
| 380 | + saveTop10.add(pitchingResultDto); | |
| 381 | + } | |
| 382 | + } | |
| 383 | + | |
| 384 | + } | |
| 385 | + return saveTop10; | |
| 386 | + } | |
| 387 | + | |
| 388 | + public List<PitchingResultDto> returnStrikeOutTop10(List<PitchingResultDto> pitchingResultList){ | |
| 389 | + int j=0; | |
| 390 | + int k=0; | |
| 391 | + strikeOutTop10=new ArrayList<PitchingResultDto>(); | |
| 392 | + for(int i=0;i<pitchingResultList.size();i++){ | |
| 393 | + pitchingResultDto=new PitchingResultDto(); | |
| 394 | + if (pitchingResultList.get(i).strikeOut>0){ | |
| 395 | + j++; | |
| 396 | + if (i==0){ | |
| 397 | + pitchingResultDto.rank=1; | |
| 398 | + } | |
| 399 | + if (i>=1&&!(pitchingResultList.get(i-1).strikeOut.equals(pitchingResultList.get(i).strikeOut))){ | |
| 400 | + //System.out.println(pitchingResultList.get(i-1).win+","+pitchingResultList.get(i).win); | |
| 401 | + pitchingResultDto.rank=j; | |
| 402 | + k=j; | |
| 403 | + } | |
| 404 | + convert2PitchingResultDto(pitchingResultList,i); | |
| 405 | + if (pitchingResultDto.rank==null||pitchingResultDto.rank<=10){ | |
| 406 | + if (k>=11){ | |
| 407 | + break; | |
| 408 | + } | |
| 409 | + strikeOutTop10.add(pitchingResultDto); | |
| 410 | + } | |
| 411 | + } | |
| 412 | + | |
| 413 | + } | |
| 414 | + return strikeOutTop10; | |
| 415 | + } | |
| 416 | + | |
| 417 | + | |
| 418 | + public void convert2PitchingResultDto(List<PitchingResultDto> pitchingResultList, int i) { | |
| 419 | + pitchingResultDto.complete=pitchingResultList.get(i).complete; | |
| 420 | + pitchingResultDto.era=pitchingResultList.get(i).era; | |
| 421 | + pitchingResultDto.fourBall=pitchingResultList.get(i).fourBall; | |
| 422 | + pitchingResultDto.gameCount=pitchingResultList.get(i).gameCount; | |
| 423 | + pitchingResultDto.hit=pitchingResultList.get(i).hit; | |
| 424 | + pitchingResultDto.homerun=pitchingResultList.get(i).homerun; | |
| 425 | + pitchingResultDto.inning=pitchingResultList.get(i).inning; | |
| 426 | + pitchingResultDto.lose=pitchingResultList.get(i).lose; | |
| 427 | + pitchingResultDto.name=pitchingResultList.get(i).name; | |
| 428 | + pitchingResultDto.pa=pitchingResultList.get(i).pa; | |
| 429 | + pitchingResultDto.playerId=pitchingResultList.get(i).playerId; | |
| 430 | + pitchingResultDto.runs=pitchingResultList.get(i).runs; | |
| 431 | + pitchingResultDto.save=pitchingResultList.get(i).save; | |
| 432 | + pitchingResultDto.shutout=pitchingResultList.get(i).shutout; | |
| 433 | + pitchingResultDto.strikeAvg=pitchingResultList.get(i).strikeAvg; | |
| 434 | + pitchingResultDto.strikeOut=pitchingResultList.get(i).strikeOut; | |
| 435 | + pitchingResultDto.whip=pitchingResultList.get(i).whip; | |
| 436 | + pitchingResultDto.win=pitchingResultList.get(i).win; | |
| 437 | + } | |
| 438 | + | |
| 90 | 439 | public void convert2BattingResultDto(List<BattingResultDto> battingResultList,int i){ |
| 91 | 440 | battingResultDto.atBats=battingResultList.get(i).atBats; |
| 92 | 441 | battingResultDto.average=battingResultList.get(i).average; |
| @@ -98,5 +447,9 @@ | ||
| 98 | 447 | battingResultDto.strikeOut=battingResultList.get(i).strikeOut; |
| 99 | 448 | battingResultDto.tpa=battingResultList.get(i).tpa; |
| 100 | 449 | battingResultDto.twobase=battingResultList.get(i).twobase; |
| 450 | + battingResultDto.notStrikeOut=battingResultList.get(i).notStrikeOut; | |
| 451 | + battingResultDto.obp=battingResultList.get(i).obp; | |
| 452 | + battingResultDto.slg=battingResultList.get(i).slg; | |
| 453 | + battingResultDto.ops=battingResultList.get(i).ops; | |
| 101 | 454 | } |
| 102 | 455 | } |
| @@ -1,6 +1,7 @@ | ||
| 1 | 1 | package cx.myhome.ckoshien.service; |
| 2 | 2 | |
| 3 | 3 | import cx.myhome.ckoshien.entity.Game; |
| 4 | +import cx.myhome.ckoshien.entity.League; | |
| 4 | 5 | |
| 5 | 6 | import java.util.Date; |
| 6 | 7 | import java.util.List; |
| @@ -40,6 +41,14 @@ | ||
| 40 | 41 | return select().where("gameDate=?",gameDate).innerJoin(team()).innerJoin(team2()).orderBy(asc(gameNumber())).getResultList(); |
| 41 | 42 | } |
| 42 | 43 | |
| 44 | + public List<Game> findByLeagueId(Integer leagueId){ | |
| 45 | + return select().where("leagueId=?", leagueId).orderBy(desc(gameDate())).getResultList(); | |
| 46 | + } | |
| 47 | + | |
| 48 | + public List<Game> findByPeriod(Date beginDate,Date endDate){ | |
| 49 | + return select().innerJoin(league()).where("begin_date>=? and end_date<=?", beginDate,endDate).orderBy(desc(gameDate())).getResultList(); | |
| 50 | + } | |
| 51 | + | |
| 43 | 52 | public List<Game> findAllGroupByGameDate() { |
| 44 | 53 | return jdbcManager |
| 45 | 54 | .selectBySqlFile(Game.class, "cx.myhome.ckoshien.sql.GameDate.sql") |
| @@ -53,11 +53,12 @@ | ||
| 53 | 53 | list=select().where("gameId=?",gameId).orderBy(asc(id())).getResultList(); |
| 54 | 54 | return list; |
| 55 | 55 | } |
| 56 | - public List<BattingResultDto> findByPeriod(Date date,Date date2){ | |
| 56 | + public List<BattingResultDto> findByPeriod(Date date,Date date2,String order){ | |
| 57 | 57 | battingResultDtos=new ArrayList<BattingResultDto>(); |
| 58 | 58 | Map<String, Object> param = new HashMap<String, Object>(); |
| 59 | 59 | param.put("beginDate", date(date)); |
| 60 | 60 | param.put("endDate", date(date2)); |
| 61 | + param.put("order", order); | |
| 61 | 62 | battingResultDtos=jdbcManager.selectBySqlFile(BattingResultDto.class, "cx.myhome.ckoshien.sql.BattingResult.sql",param).getResultList(); |
| 62 | 63 | return battingResultDtos; |
| 63 | 64 | } |
| @@ -54,11 +54,12 @@ | ||
| 54 | 54 | return list; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - public List<PitchingResultDto> findByPeriod(Date date,Date date2){ | |
| 57 | + public List<PitchingResultDto> findByPeriod(Date date,Date date2,String order){ | |
| 58 | 58 | pitchingResultDtos=new ArrayList<PitchingResultDto>(); |
| 59 | 59 | Map<String, Object> param = new HashMap<String, Object>(); |
| 60 | 60 | param.put("beginDate", date(date)); |
| 61 | 61 | param.put("endDate", date(date2)); |
| 62 | + param.put("order", order); | |
| 62 | 63 | pitchingResultDtos=jdbcManager.selectBySqlFile(PitchingResultDto.class, "cx.myhome.ckoshien.sql.PitchingResult.sql", param).getResultList(); |
| 63 | 64 | return pitchingResultDtos; |
| 64 | 65 | } |