suochencheng %!s(int64=7) %!d(string=hai) anos
pai
achega
2be9279908

+ 4 - 0
src/main/java/com/izouma/awesomeadmin/dao/PlayerInfoMapper.java

@@ -34,8 +34,12 @@ public interface PlayerInfoMapper {
 
     List<PlayerInfo> queryPlayerInfoRankByPage(Map<String, Object> parameter);
 
+    List<PlayerInfo> queryPlayerInfoSeasonRankPageByPage(Map<String, Object> parameter);
+
     int userRank(PlayerInfo record);
 
+    PlayerInfo seasonUserRank(PlayerInfo record);
+
     List<PlayerInfo> queryNoStartPlayer(HouseInfo record);
 
     int overTimePlayer(PlayerInfo record);

+ 183 - 0
src/main/java/com/izouma/awesomeadmin/dao/PlayerInfoMapper.xml

@@ -682,6 +682,189 @@
         IFNULL(live_time,999) ,
         id desc
     </select>
+    <select id="queryPlayerInfoSeasonRankPageByPage" parameterType="java.util.Map"
+            resultMap="PagePlayerInfoResult">
+
+        SELECT
+        game_id,
+        user_id,
+        season_id,
+        bonus,
+        @curRank :=
+        IF (
+        @prevRank = bonus,
+        @curRank,
+        @incRank
+        ) AS rank,
+        @incRank := @incRank + 1,
+        @prevRank := bonus
+        FROM
+        (
+        SELECT
+        game_id,
+        user_id,
+        season_id,
+        SUM(IFNULL(bonus, 0)) AS bonus
+        FROM
+        player_info
+        <where>
+            and del_flag = 'N'
+            <if test="record.idStr != null and !&quot;&quot;.equals(record.idStr)">
+                and id in (${record.idStr})
+            </if>
+            <if test="record.id != null and !&quot;&quot;.equals(record.id)">
+                and id = #{record.id}
+            </if>
+            <if test="record.delFlag != null and !&quot;&quot;.equals(record.delFlag)">
+                and del_flag = #{record.delFlag}
+            </if>
+            <if test="record.updateTime != null and !&quot;&quot;.equals(record.updateTime)">
+                and update_time = #{record.updateTime}
+            </if>
+            <if test="record.updateUser != null and !&quot;&quot;.equals(record.updateUser)">
+                and update_user = #{record.updateUser}
+            </if>
+            <if test="record.createTime != null and !&quot;&quot;.equals(record.createTime)">
+                and create_time = #{record.createTime}
+            </if>
+            <if test="record.createUser != null and !&quot;&quot;.equals(record.createUser)">
+                and create_user = #{record.createUser}
+            </if>
+            <if test="record.gameId != null and !&quot;&quot;.equals(record.gameId)">
+                and game_id = #{record.gameId}
+            </if>
+            <if test="record.houseId != null and !&quot;&quot;.equals(record.houseId)">
+                and house_id = #{record.houseId}
+            </if>
+            <if test="record.joinTime != null and !&quot;&quot;.equals(record.joinTime)">
+                and join_time = #{record.joinTime}
+            </if>
+            <if test="record.principal != null and !&quot;&quot;.equals(record.principal)">
+                and principal = #{record.principal}
+            </if>
+            <if test="record.bonus != null and !&quot;&quot;.equals(record.bonus)">
+                and bonus = #{record.bonus}
+            </if>
+            <if test="record.userId != null and !&quot;&quot;.equals(record.userId)">
+                and user_id = #{record.userId}
+            </if>
+            <if test="record.remark != null and !&quot;&quot;.equals(record.remark)">
+                and remark = #{record.remark}
+            </if>
+            <if test="record.image != null and !&quot;&quot;.equals(record.image)">
+                and image = #{record.image}
+            </if>
+            <if test="record.killNumber != null and !&quot;&quot;.equals(record.killNumber)">
+                and kill_number = #{record.killNumber}
+            </if>
+            <if test="record.ranking != null and !&quot;&quot;.equals(record.ranking)">
+                and ranking = #{record.ranking}
+            </if>
+            <if test="record.beginTime != null and !&quot;&quot;.equals(record.beginTime)">
+                and begin_time = #{record.beginTime}
+            </if>
+            <if test="record.endTime != null and !&quot;&quot;.equals(record.endTime)">
+                and end_time = #{record.endTime}
+            </if>
+            <if test="record.statusFlag != null and !&quot;&quot;.equals(record.statusFlag)">
+                and status_flag = #{record.statusFlag}
+            </if>
+            <if test="record.examineUser != null and !&quot;&quot;.equals(record.examineUser)">
+                and examine_user = #{record.examineUser}
+            </if>
+            <if test="record.examineTime != null and !&quot;&quot;.equals(record.examineTime)">
+                and examine_time = #{record.examineTime}
+            </if>
+            <if test="record.examineType != null and !&quot;&quot;.equals(record.examineType)">
+                and examine_type = #{record.examineType}
+            </if>
+            <if test="record.video != null and !&quot;&quot;.equals(record.video)">
+                and video = #{record.video}
+            </if>
+            <if test="record.liveTime != null and !&quot;&quot;.equals(record.liveTime)">
+                and live_time = #{record.liveTime}
+            </if>
+            <if test="record.gameType != null and !&quot;&quot;.equals(record.gameType)">
+                and game_type = #{record.gameType}
+            </if>
+            <if test="record.seasonId != null and !&quot;&quot;.equals(record.seasonId)">
+                and season_id = #{record.seasonId}
+            </if>
+
+        </where>
+        GROUP BY
+        game_id,
+        user_id,
+        season_id
+        ) AS p,
+        (
+        SELECT
+        @curRank := 0,
+        @prevRank := NULL,
+        @incRank := 1
+        ) r
+        ORDER BY
+        bonus DESC
+
+    </select>
+    <select id="seasonUserRank" parameterType="java.util.Map"
+            resultMap="PagePlayerInfoResult">
+
+        select  * from  (
+        SELECT
+        game_id,
+        user_id,
+        season_id,
+        bonus,
+        @curRank :=
+        IF (
+        @prevRank = bonus,
+        @curRank,
+        @incRank
+        ) AS rank,
+        @incRank := @incRank + 1,
+        @prevRank := bonus
+        FROM
+        (
+        SELECT
+        game_id,
+        user_id,
+        season_id,
+        SUM(IFNULL(bonus, 0)) AS bonus
+        FROM
+        player_info
+        <where>
+            and del_flag = 'N'
+            <if test="gameId != null and !&quot;&quot;.equals(gameId)">
+                and game_id = #{gameId}
+            </if>
+            <if test="seasonId != null and !&quot;&quot;.equals(seasonId)">
+                and season_id = #{seasonId}
+            </if>
+
+        </where>
+        GROUP BY
+        game_id,
+        user_id,
+        season_id
+        ) AS p,
+        (
+        SELECT
+        @curRank := 0,
+        @prevRank := NULL,
+        @incRank := 1
+        ) r
+        ORDER BY
+        bonus DESC
+        ) u
+
+        where
+        <if test="userId != null and !&quot;&quot;.equals(userId)">
+             u.user_id = #{userId}
+        </if>
+
+        LIMIT 1
+    </select>
     <select id="queryAllPlayerInfo" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.PlayerInfo">
         select
         <include refid="Base_Column_List"/>

+ 10 - 0
src/main/java/com/izouma/awesomeadmin/model/PlayerInfo.java

@@ -39,6 +39,8 @@ public class PlayerInfo {
 
     private Integer houseRank;
 
+    private Integer rank;
+
 
     private UserInfo userInfo;
 
@@ -311,5 +313,13 @@ public class PlayerInfo {
     public void setUserInfo(UserInfo userInfo) {
         this.userInfo = userInfo;
     }
+
+    public Integer getRank() {
+        return rank;
+    }
+
+    public void setRank(Integer rank) {
+        this.rank = rank;
+    }
 }
 

+ 4 - 0
src/main/java/com/izouma/awesomeadmin/service/PlayerInfoService.java

@@ -29,8 +29,12 @@ public interface PlayerInfoService {
 
     List<PlayerInfo> getPlayerInfoRankByPage(Page page, PlayerInfo record);
 
+    List<PlayerInfo> getPlayerInfoSeasonRankPageByPage(Page page, PlayerInfo record);
+
     int userRank(PlayerInfo record);
 
+    PlayerInfo seasonUserRank(PlayerInfo record);
+
     List<PlayerInfo> getNoStartPlayer(HouseInfo record);
 
     boolean overTimePlayer(PlayerInfo playerInfo);

+ 35 - 2
src/main/java/com/izouma/awesomeadmin/service/impl/PlayerInfoServiceImpl.java

@@ -114,6 +114,24 @@ public class PlayerInfoServiceImpl implements PlayerInfoService {
         return null;
     }
 
+    @Override
+    public List<PlayerInfo> getPlayerInfoSeasonRankPageByPage(Page page, PlayerInfo record) {
+
+        logger.info("getPlayerInfoSeasonRankPageByPage");
+        try {
+
+            Map<String, Object> parameter = new HashMap<String, Object>();
+            parameter.put("record", record);
+            parameter.put(AppConstant.PAGE, page);
+
+            return playerInfoMapper.queryPlayerInfoSeasonRankPageByPage(parameter);
+        } catch (Exception e) {
+            logger.error("getPlayerInfoSeasonRankPageByPage", e);
+        }
+
+        return null;
+    }
+
     @Override
     public PlayerInfo getPlayerInfoById(String id) {
 
@@ -145,18 +163,33 @@ public class PlayerInfoServiceImpl implements PlayerInfoService {
     @Override
     public int userRank(PlayerInfo record) {
 
-        logger.info("getPlayerInfo");
+        logger.info("userRank");
         try {
 
             return playerInfoMapper.userRank(record);
 
         } catch (Exception e) {
-            logger.error("getPlayerInfo", e);
+            logger.error("userRank", e);
         }
 
         return 0;
     }
 
+    @Override
+    public PlayerInfo seasonUserRank(PlayerInfo record) {
+
+        logger.info("seasonUserRank");
+        try {
+
+            return playerInfoMapper.seasonUserRank(record);
+
+        } catch (Exception e) {
+            logger.error("seasonUserRank", e);
+        }
+
+        return null;
+    }
+
     @Override
     public boolean createPlayerInfo(PlayerInfo record) {
 

+ 21 - 0
src/main/java/com/izouma/awesomeadmin/web/PlayerInfoController.java

@@ -105,6 +105,18 @@ public class PlayerInfoController {
         return new Result(true, result);
     }
 
+    @RequestMapping(value = "/seasonRankPage", method = RequestMethod.GET)
+    @ResponseBody
+    public Result seasonRankPage(Page page, PlayerInfo record) {
+        Map<String, Object> result = new HashMap<>();
+
+        List<PlayerInfo> pp = playerInfoService.getPlayerInfoSeasonRankPageByPage(page, record);
+
+        result.put(AppConstant.PAGE, page);
+        result.put("pp", pp);
+        return new Result(true, result);
+    }
+
     @RequestMapping(value = "/userRank", method = RequestMethod.GET)
     @ResponseBody
     public Result userRank(PlayerInfo record) {
@@ -114,6 +126,15 @@ public class PlayerInfoController {
         return new Result(true, rank);
     }
 
+    @RequestMapping(value = "/seasonUserRank", method = RequestMethod.GET)
+    @ResponseBody
+    public Result seasonUserRank(PlayerInfo record) {
+
+        PlayerInfo playerInfo = playerInfoService.seasonUserRank(record);
+
+        return new Result(true, playerInfo);
+    }
+
 
     /**
      * <p>保存。</p>