release- app分页显示音乐人列表

release-2024-08-08
pikaqiudeshujia 6 months ago
parent 1ebbf5431c
commit 1a9371cb49

@ -73,4 +73,12 @@ public class ArtistController {
return Result.success(); return Result.success();
} }
@ApiOperation(value = "分页显示音乐人列表", notes = "分页显示音乐人列表")
@GetMapping("/app/list/{page}/{size}")
public Result<PageResult<ArtistInfo>> 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));
}
} }

@ -19,7 +19,11 @@ public interface ArtistInfoDao extends JpaRepository<ArtistInfo, String>, JpaSpe
@Query(value = " select t1.* from tb_artist_info t1 left join tb_user_process t2 on t1.user_id = t2.user_id \n" + @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<ArtistInfo> findListByCheckState(Pageable pageable); public Page<ArtistInfo> 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<ArtistInfo> findListApproveSuccess(Pageable pageable);
} }

@ -198,6 +198,12 @@ public class ArtistService {
} }
} }
public PageResult<ArtistInfo> getListApproveSuccess(Integer page, Integer size) {
Pageable pageable = PageRequest.of(page - 1, size);
Page<ArtistInfo> artistInfoPage = artistInfoDao.findListApproveSuccess(pageable);
long totalElements = artistInfoPage.getTotalElements();
return new PageResult<>(totalElements, artistInfoPage.getContent());
}
} }

Loading…
Cancel
Save