Commit 445340c8 authored by liming's avatar liming

系列赛详情接口

parent c2d17ae6
......@@ -30,10 +30,12 @@ public class SeriesController {
return success(seriesService.getSeriesList());
}
@GetMapping("{id}")
@GetMapping("{id}/{sportUserId}")
@ApiOperation(value = "查询系列赛详情")
public ResponseEntity<Result<SeriesDetailsVO>> getSeriesDetails(@PathVariable("id") Long id) {
return success(seriesService.getSeriesDetails(id));
public ResponseEntity<Result<SeriesDetailsVO>> getSeriesDetails(
@PathVariable("id") Long id,
@PathVariable("sportUserId") Long sportUserId) {
return success(seriesService.getSeriesDetails(id, sportUserId));
}
}
......@@ -11,4 +11,6 @@ public interface SeriesBusinessMapper {
List<SeriesListVO> getSeriesList();
List<SeriesNoticeVO> getSeriesNotice(@Param("seriesId") Long seriesId);
Boolean checkUserSeriesIsApplied(@Param("seriesId") Long seriesId,@Param("sportUserId") Long sportUserId);
}
......@@ -29,7 +29,7 @@ public class SeriesService {
return seriesBusinessMapper.getSeriesList();
}
public SeriesDetailsVO getSeriesDetails(Long id) {
public SeriesDetailsVO getSeriesDetails(Long id, Long sportUserId) {
Series series = seriesMapper.selectById(id);
if (series == null) {
throw new BusinessException("您查询的系列赛信息不存在");
......@@ -47,6 +47,7 @@ public class SeriesService {
}
SeriesDetailsVO result = seriesConverter.toSeriesDetailVO(series, status);
result.setNoticeList(seriesBusinessMapper.getSeriesNotice(id));
result.setApplied(seriesBusinessMapper.checkUserSeriesIsApplied(id, sportUserId));
return result;
}
......
......@@ -29,6 +29,8 @@ public class SeriesDetailsVO {
private LocalDateTime applyEndTime;
@ApiModelProperty("报名数量")
private Integer applyNum;
@ApiModelProperty("是否已报名 true 报名 false 未报名")
private Boolean applied;
@ApiModelProperty("通知列表")
List<SeriesNoticeVO> noticeList;
......
......@@ -19,4 +19,8 @@
and series_id = #{seriesId}
order by create_time desc
</select>
<select id="checkUserSeriesIsApplied" resultType="java.lang.Boolean">
select count(1)>0 from series_apply where series_id = #{seriesId} and sport_user_id = #{sportUserId}
</select>
</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