diff --git a/luoo_user/src/main/java/com/luoo/user/controller/ArtistController.java b/luoo_user/src/main/java/com/luoo/user/controller/ArtistController.java index cb25034..5aa538c 100644 --- a/luoo_user/src/main/java/com/luoo/user/controller/ArtistController.java +++ b/luoo_user/src/main/java/com/luoo/user/controller/ArtistController.java @@ -73,4 +73,12 @@ public class ArtistController { return Result.success(); } + @ApiOperation(value = "分页显示音乐人列表", notes = "分页显示音乐人列表") + @GetMapping("/app/list/{page}/{size}") + public Result> getArtistList(@ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token, + @ApiParam(value = "页码", required = true) @PathVariable Integer page, + @ApiParam(value = "每页条数", required = true) @PathVariable Integer size) { + return Result.success(artistService.getListApproveSuccess(page, size)); + } + } diff --git a/luoo_user/src/main/java/com/luoo/user/dao/ArtistInfoDao.java b/luoo_user/src/main/java/com/luoo/user/dao/ArtistInfoDao.java index 82c6840..9a7da4e 100644 --- a/luoo_user/src/main/java/com/luoo/user/dao/ArtistInfoDao.java +++ b/luoo_user/src/main/java/com/luoo/user/dao/ArtistInfoDao.java @@ -19,7 +19,11 @@ public interface ArtistInfoDao extends JpaRepository, JpaSpe @Query(value = " select t1.* from tb_artist_info t1 left join tb_user_process t2 on t1.user_id = t2.user_id \n" + - " where t2.type = 1 and status = 0", countProjection = "t1.id", nativeQuery = true) + " where t2.type = 1 and t2.status = 0", countProjection = "t1.id", nativeQuery = true) public Page findListByCheckState(Pageable pageable); + @Query(value = " select t1.* from tb_artist_info t1 left join tb_user_process t2 on t1.user_id = t2.user_id \n" + + " where t2.type = 1 and t2.status = 1 order by t1.id desc", countProjection = "t1.id", nativeQuery = true) + public Page findListApproveSuccess(Pageable pageable); + } diff --git a/luoo_user/src/main/java/com/luoo/user/service/ArtistService.java b/luoo_user/src/main/java/com/luoo/user/service/ArtistService.java index 2e05bf1..ecb0b50 100644 --- a/luoo_user/src/main/java/com/luoo/user/service/ArtistService.java +++ b/luoo_user/src/main/java/com/luoo/user/service/ArtistService.java @@ -198,6 +198,12 @@ public class ArtistService { } } + public PageResult getListApproveSuccess(Integer page, Integer size) { + Pageable pageable = PageRequest.of(page - 1, size); + Page artistInfoPage = artistInfoDao.findListApproveSuccess(pageable); + long totalElements = artistInfoPage.getTotalElements(); + return new PageResult<>(totalElements, artistInfoPage.getContent()); + } }