From 1a9371cb49d557e3eb0354761ddae5b3c35f1fe3 Mon Sep 17 00:00:00 2001 From: pikaqiudeshujia Date: Wed, 15 May 2024 13:03:32 +0800 Subject: [PATCH] =?UTF-8?q?release-=20app=E5=88=86=E9=A1=B5=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=9F=B3=E4=B9=90=E4=BA=BA=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/luoo/user/controller/ArtistController.java | 8 ++++++++ .../src/main/java/com/luoo/user/dao/ArtistInfoDao.java | 6 +++++- .../main/java/com/luoo/user/service/ArtistService.java | 6 ++++++ 3 files changed, 19 insertions(+), 1 deletion(-) 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()); + } }