Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
antai-sport-http-server
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
antai-sport
antai-sport-http-server
Commits
dd8b7d4e
Commit
dd8b7d4e
authored
Apr 13, 2022
by
liming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户主页骑行记录查询
parent
42fd6d20
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
114 additions
and
4 deletions
+114
-4
SportUserTrainingLogVO.java
.../api/business/traininglog/dto/SportUserTrainingLogVO.java
+47
-0
SportUserTrainingLogBusinessMapper.java
...raininglog/mapper/SportUserTrainingLogBusinessMapper.java
+4
-0
SportUserTrainingLogService.java
...ness/traininglog/service/SportUserTrainingLogService.java
+13
-0
SportUserController.java
...ver/api/business/user/controller/SportUserController.java
+13
-4
ReqSportUserTrainingLog.java
...server/api/business/user/dto/ReqSportUserTrainingLog.java
+20
-0
SportUserTrainingLogBusinessMapper.xml
...mapper/traininglog/SportUserTrainingLogBusinessMapper.xml
+17
-0
No files found.
server-api/src/main/java/com/antai/sport/http/server/server/api/business/traininglog/dto/SportUserTrainingLogVO.java
0 → 100644
View file @
dd8b7d4e
package
com
.
antai
.
sport
.
http
.
server
.
server
.
api
.
business
.
traininglog
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
@Data
@ApiModel
(
"用户训练记录"
)
public
class
SportUserTrainingLogVO
{
@ApiModelProperty
(
"运动类型 1:自行车 2:跑步"
)
private
Integer
sportType
;
@ApiModelProperty
(
"运动模式 10:漫游 20:日常赛 30:系列赛 40:课程训练 50: 团练 60:房间模式"
)
private
Integer
gameMode
;
@ApiModelProperty
(
"玩家id"
)
private
Long
playerId
;
@ApiModelProperty
(
"主数据id 如比赛为比赛id 房间模式为房间id 漫游为漫游记录id"
)
private
Long
sourceId
;
@ApiModelProperty
(
"运动记录Id"
)
private
Long
recordId
;
@ApiModelProperty
(
"地图名称"
)
private
String
mapName
;
@ApiModelProperty
(
"赛道名称"
)
private
String
pathName
;
@ApiModelProperty
(
"卡路里 临时没有数据可以先不显示"
)
private
Integer
calorie
;
@ApiModelProperty
(
"点赞数量"
)
private
Integer
praiseNum
;
@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
(
"记录实际那 yyyy-MM-dd HH:mm"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm"
,
timezone
=
"GMT+8"
)
private
LocalDateTime
createTime
;
}
server-api/src/main/java/com/antai/sport/http/server/server/api/business/traininglog/mapper/SportUserTrainingLogBusinessMapper.java
View file @
dd8b7d4e
...
...
@@ -2,9 +2,11 @@ package com.antai.sport.http.server.server.api.business.traininglog.mapper;
import
com.antai.sport.http.server.repository.sport.entity.SportUserTrainingLog
;
import
com.antai.sport.http.server.server.api.business.traininglog.dto.SportUserTrainingLogSummaryVO
;
import
com.antai.sport.http.server.server.api.business.traininglog.dto.SportUserTrainingLogVO
;
import
org.apache.ibatis.annotations.Param
;
import
java.time.LocalDate
;
import
java.util.List
;
public
interface
SportUserTrainingLogBusinessMapper
{
SportUserTrainingLog
getLongestTrainingLog
(
@Param
(
"sportType"
)
Integer
sportType
,
@Param
(
"userId"
)
Long
userId
);
...
...
@@ -13,4 +15,6 @@ public interface SportUserTrainingLogBusinessMapper {
@Param
(
"userId"
)
Long
userId
,
@Param
(
"beginDate"
)
LocalDate
beginDate
,
@Param
(
"endDate"
)
LocalDate
endDate
);
List
<
SportUserTrainingLogVO
>
getSportUserTrainingLog
(
@Param
(
"userId"
)
Long
userId
,
@Param
(
"date"
)
LocalDate
date
,
@Param
(
"gameMode"
)
Integer
gameMod
);
}
server-api/src/main/java/com/antai/sport/http/server/server/api/business/traininglog/service/SportUserTrainingLogService.java
View file @
dd8b7d4e
...
...
@@ -8,7 +8,9 @@ import com.antai.sport.http.server.repository.sport.mapper.SportUserSummaryMappe
import
com.antai.sport.http.server.repository.sport.mapper.SportUserTrainingLogMapper
;
import
com.antai.sport.http.server.server.api.business.traininglog.converter.SportUserTrainingLogConverter
;
import
com.antai.sport.http.server.server.api.business.traininglog.dto.SportUserTrainingLogSummaryVO
;
import
com.antai.sport.http.server.server.api.business.traininglog.dto.SportUserTrainingLogVO
;
import
com.antai.sport.http.server.server.api.business.traininglog.mapper.SportUserTrainingLogBusinessMapper
;
import
com.antai.sport.http.server.server.api.business.user.dto.ReqSportUserTrainingLog
;
import
com.antai.sport.http.server.server.api.common.dto.CyclingDataDTO
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
org.springframework.stereotype.Service
;
...
...
@@ -17,6 +19,7 @@ import javax.annotation.Resource;
import
java.math.BigDecimal
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.util.List
;
@Service
public
class
SportUserTrainingLogService
{
...
...
@@ -103,4 +106,14 @@ public class SportUserTrainingLogService {
}
return
summaryVO
;
}
/**
* 查询用户训练记录
*
* @param param
* @return
*/
public
List
<
SportUserTrainingLogVO
>
getSportUserTrainingLog
(
ReqSportUserTrainingLog
param
)
{
return
sportUserTrainingLogBusinessMapper
.
getSportUserTrainingLog
(
param
.
getPlayerId
(),
param
.
getDate
(),
param
.
getGameMode
());
}
}
server-api/src/main/java/com/antai/sport/http/server/server/api/business/user/controller/SportUserController.java
View file @
dd8b7d4e
package
com
.
antai
.
sport
.
http
.
server
.
server
.
api
.
business
.
user
.
controller
;
import
com.antai.sport.http.server.common.base.Result
;
import
com.antai.sport.http.server.server.api.business.traininglog.dto.SportUserTrainingLogVO
;
import
com.antai.sport.http.server.server.api.business.traininglog.service.SportUserTrainingLogService
;
import
com.antai.sport.http.server.server.api.business.user.dto.ReqSportUserTrainingLog
;
import
com.antai.sport.http.server.server.api.business.user.dto.RespUserHomeInfo
;
import
com.antai.sport.http.server.server.api.business.user.service.SportUserService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
static
com
.
antai
.
sport
.
http
.
server
.
common
.
util
.
ResultUtil
.
success
;
...
...
@@ -21,10 +22,18 @@ import static com.antai.sport.http.server.common.util.ResultUtil.success;
public
class
SportUserController
{
@Resource
private
SportUserService
sportUserService
;
@Resource
private
SportUserTrainingLogService
sportUserTrainingLogService
;
@ApiOperation
(
"查询用户主页数据"
)
@GetMapping
(
"{userId}"
)
public
ResponseEntity
<
Result
<
RespUserHomeInfo
>>
getUserHomeInfo
(
@PathVariable
(
"userId"
)
Long
userId
)
{
return
success
(
sportUserService
.
getUserHomeInfo
(
userId
));
}
@ApiOperation
(
"查询用户运动记录"
)
@PostMapping
(
"/training/log"
)
public
ResponseEntity
<
Result
<
List
<
SportUserTrainingLogVO
>>>
getSportUserTrainingLog
(
@RequestBody
ReqSportUserTrainingLog
param
)
{
return
success
(
sportUserTrainingLogService
.
getSportUserTrainingLog
(
param
));
}
}
server-api/src/main/java/com/antai/sport/http/server/server/api/business/user/dto/ReqSportUserTrainingLog.java
0 → 100644
View file @
dd8b7d4e
package
com
.
antai
.
sport
.
http
.
server
.
server
.
api
.
business
.
user
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.time.LocalDate
;
@ApiModel
(
"用户训练记录查询"
)
@Data
public
class
ReqSportUserTrainingLog
{
@ApiModelProperty
(
"玩家id"
)
private
Long
playerId
;
@ApiModelProperty
(
"查询日期 yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
LocalDate
date
;
@ApiModelProperty
(
"模式 10:漫游 20:日常赛 30:系列赛 40:课程训练 50: 团练 60:房间模式"
)
private
Integer
gameMode
;
}
server-api/src/main/resources/mapper/traininglog/SportUserTrainingLogBusinessMapper.xml
View file @
dd8b7d4e
...
...
@@ -14,4 +14,21 @@
where player_id = #{userId} and sport_type = #{sportType}
and create_date
>
= #{beginDate} and create_date
<
= #{endDate}
</select>
<select
id=
"getSportUserTrainingLog"
resultType=
"com.antai.sport.http.server.server.api.business.traininglog.dto.SportUserTrainingLogVO"
>
select t1.sport_type,t1.game_mode,t1.player_id,t1.source_id,t1.record_id,
t2.map_name,t3.path_name,t1.calorie,t1.duration,t1.match_rank,
t1.distance,t1.climb_distance,t1.avg_ftp,t1.avg_speed,t1.praise_num,t1.create_time
from sport_user_training_log t1
left join map t2 on t1.map = t2.map_key
left join map_path t3 on t1.path = t3.path_key
where t1.player_id = #{userId}
<if
test=
"date != null"
>
and t1.date = #{date}
</if>
<if
test=
"gameMode != null"
>
and t1.game_mode = #{gameMode}
</if>
order by t1.id desc
</select>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment