Commit 03afc0b6 authored by liming's avatar liming

表信息上传

parent d190732a
...@@ -10,12 +10,12 @@ import java.math.BigDecimal; ...@@ -10,12 +10,12 @@ import java.math.BigDecimal;
@Data @Data
public class RespRoomRank { public class RespRoomRank {
@ApiModelProperty("用户Id") @ApiModelProperty("用户Id")
private Long userId; private Long playerId;
@ApiModelProperty("昵称") @ApiModelProperty("昵称")
private String nickname; private String nickname;
@ApiModelProperty("头像") @ApiModelProperty("头像")
private String avatar; private String avatar;
@ApiModelProperty("比赛名次(没有可以不填)") @ApiModelProperty("比赛名次")
private Integer matchRank; private Integer matchRank;
@ApiModelProperty("用时(秒)") @ApiModelProperty("用时(秒)")
private Integer duration; private Integer duration;
......
...@@ -3,7 +3,6 @@ package com.antai.sport.http.server.server.api.business.simplematch.controller; ...@@ -3,7 +3,6 @@ package com.antai.sport.http.server.server.api.business.simplematch.controller;
import com.antai.sport.http.server.common.base.Result; import com.antai.sport.http.server.common.base.Result;
import com.antai.sport.http.server.server.api.business.simplematch.dto.*; import com.antai.sport.http.server.server.api.business.simplematch.dto.*;
import com.antai.sport.http.server.server.api.business.simplematch.service.SimpleMatchService; import com.antai.sport.http.server.server.api.business.simplematch.service.SimpleMatchService;
import com.antai.sport.http.server.server.api.common.dto.CyclingDataDTO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
...@@ -73,4 +72,11 @@ public class SimpleMatchController { ...@@ -73,4 +72,11 @@ public class SimpleMatchController {
simpleMatchService.recordUpload(dataList); simpleMatchService.recordUpload(dataList);
return success(); return success();
} }
@ApiOperation("查询日常赛排名")
@GetMapping("/rank/{matchId}")
public ResponseEntity<Result<List<RespSimpleMatchRank>>> rank(@PathVariable("matchId") Long matchId) {
return success(simpleMatchService.rank(matchId));
}
} }
package com.antai.sport.http.server.server.api.business.simplematch.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@ApiModel("日常赛排名")
@Data
public class RespSimpleMatchRank {
@ApiModelProperty("用户Id")
private Long playerId;
@ApiModelProperty("昵称")
private String nickname;
@ApiModelProperty("头像")
private String avatar;
@ApiModelProperty("比赛名次")
private Integer matchRank;
@ApiModelProperty("用时(秒)")
private Integer duration;
@ApiModelProperty("骑行总长度")
private BigDecimal distance;
@ApiModelProperty("爬坡高度")
private BigDecimal climbDistance;
@ApiModelProperty("平均功率")
private BigDecimal avgFtp;
@ApiModelProperty("平均速度")
private BigDecimal avgSpeed;
@ApiModelProperty("状态 10:未完赛 20:已完赛")
private Integer status;
}
package com.antai.sport.http.server.server.api.business.simplematch.mapper; package com.antai.sport.http.server.server.api.business.simplematch.mapper;
import com.antai.sport.http.server.server.api.business.simplematch.dto.RespSimpleMatchList; import com.antai.sport.http.server.server.api.business.simplematch.dto.RespSimpleMatchList;
import com.antai.sport.http.server.server.api.business.simplematch.dto.RespSimpleMatchRank;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.time.LocalDateTime; import java.time.LocalDateTime;
...@@ -10,4 +11,6 @@ public interface SimpleMatchBusinessMapper { ...@@ -10,4 +11,6 @@ public interface SimpleMatchBusinessMapper {
List<RespSimpleMatchList> getUnFinishedSimpleMatchListForUser(@Param("userId") Long userId, @Param("now") LocalDateTime now); List<RespSimpleMatchList> getUnFinishedSimpleMatchListForUser(@Param("userId") Long userId, @Param("now") LocalDateTime now);
List<RespSimpleMatchList> getUnFinishedSimpleMatchListForServer(@Param("now") LocalDateTime now); List<RespSimpleMatchList> getUnFinishedSimpleMatchListForServer(@Param("now") LocalDateTime now);
List<RespSimpleMatchRank> getSimpleMatchRank(@Param("matchId") Long matchId);
} }
...@@ -180,4 +180,14 @@ public class SimpleMatchService { ...@@ -180,4 +180,14 @@ public class SimpleMatchService {
simpleMatchPlayerRecordMapper.updateById(record); simpleMatchPlayerRecordMapper.updateById(record);
}); });
} }
/**
* 查询日常赛排名
*
* @param matchId
* @return
*/
public List<RespSimpleMatchRank> rank(Long matchId) {
return simpleMatchBusinessMapper.getSimpleMatchRank(matchId);
}
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.antai.sport.http.server.server.api.business.roommode.mapper.RoomBusinessMapper"> <mapper namespace="com.antai.sport.http.server.server.api.business.roommode.mapper.RoomBusinessMapper">
<select id="getRoomBank" resultType="com.antai.sport.http.server.server.api.business.roommode.dto.RespRoomRank"> <select id="getRoomBank" resultType="com.antai.sport.http.server.server.api.business.roommode.dto.RespRoomRank">
select t1.player_id as user_id, select t1.player_id,
t2.avatar, t2.avatar,
t2.nickname, t2.nickname,
t1.* t1.*
......
...@@ -27,4 +27,15 @@ ...@@ -27,4 +27,15 @@
and t1.deleted = 0 and t1.deleted = 0
order by t1.show_order, t1.start_time order by t1.show_order, t1.start_time
</select> </select>
<select id="getSimpleMatchRank" resultType="com.antai.sport.http.server.server.api.business.simplematch.dto.RespSimpleMatchRank">
select t1.player_id,
t2.avatar,
t2.nickname,
t1.*
from simple_match_player_record t1
left join sport_user t2 on t1.player_id = t2.id
where t1.match_id = #{matchId}
order by match_rank asc
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment