release- 按审核状态查询音乐人列表

release-2024-08-08
pikaqiudeshujia 6 months ago
parent ff0df5e3b3
commit aaff05805c

@ -4,6 +4,7 @@ import api.PageResult;
import api.Result;
import com.luoo.user.dto.UserProcessApproveDto;
import com.luoo.user.dto.artist.ArtistRegisterDto;
import com.luoo.user.dto.artist.ArtistSearchDto;
import com.luoo.user.dto.artist.ArtistUserBindDto;
import com.luoo.user.pojo.ArtistInfo;
import com.luoo.user.pojo.UserProcess;
@ -75,11 +76,12 @@ public class ArtistController {
}
@ApiOperation(value = "分页显示音乐人列表", notes = "分页显示音乐人列表")
@GetMapping("/app/list/{page}/{size}")
@PostMapping("/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));
@ApiParam(value = "查询条件", required = true) @RequestBody ArtistSearchDto artistSearchDto,
@ApiParam(value = "页码", required = true) @PathVariable Integer page,
@ApiParam(value = "每页条数", required = true) @PathVariable Integer size) {
return Result.success(artistService.getList(artistSearchDto, page, size));
}
@ApiOperation(value = "上一次申请的记录", notes = "上一次申请的记录-音乐人注册审批失败后可以自动带出上一次审批填写的数据")

@ -18,13 +18,21 @@ import org.springframework.data.jpa.repository.Query;
public interface ArtistInfoDao extends JpaRepository<ArtistInfo, String>, JpaSpecificationExecutor<ArtistInfo> {
@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.*, t2.status 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 = 0", countProjection = "t1.id", nativeQuery = true)
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" +
@Query(value = " select t1.*, t2.status 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);
@Query(value = " select distinct 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> findAllByStatus(Integer status, Pageable pageable);
@Query(value = " select distinct t1.* from tb_artist_info t1 left join tb_user_process t2 on t1.user_id = t2.user_id \n" +
" where t2.type = 1 order by t1.id desc", countProjection = "t1.id", nativeQuery = true)
public Page<ArtistInfo> findAllNoStatus(Pageable pageable);
public ArtistInfo findArtistInfoByUserId(String userId);
}

@ -0,0 +1,21 @@
package com.luoo.user.dto.artist;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @Author: yawei.huang
* @Package: com.luoo.user.dto.artist
* @Project: luoo_parent
* @Date: 2024/5/27 16:07
* @Filename: ArtistSearchDto
* @Describe:
*/
@Data
public class ArtistSearchDto implements Serializable {
@ApiModelProperty(value = "申请状态 0-待审批 1-审批通过 2-审批失败")
private Integer status;
}

@ -1,9 +1,13 @@
package com.luoo.user.service;
import api.PageResult;
import com.luoo.user.dao.*;
import com.luoo.user.dao.ArtistInfoDao;
import com.luoo.user.dao.ArtistUserDao;
import com.luoo.user.dao.UserInfoDao;
import com.luoo.user.dao.UserProcessDao;
import com.luoo.user.dto.UserProcessApproveDto;
import com.luoo.user.dto.artist.ArtistRegisterDto;
import com.luoo.user.dto.artist.ArtistSearchDto;
import com.luoo.user.dto.artist.ArtistUserBindDto;
import com.luoo.user.pojo.ArtistInfo;
import com.luoo.user.pojo.ArtistUser;
@ -286,9 +290,14 @@ public class ArtistService {
*
*
*/
public PageResult<ArtistInfo> getListApproveSuccess(Integer page, Integer size) {
public PageResult<ArtistInfo> getList(ArtistSearchDto artistSearchDto, Integer page, Integer size) {
Pageable pageable = PageRequest.of(page - 1, size);
Page<ArtistInfo> artistInfoPage = artistInfoDao.findListApproveSuccess(pageable);
Page<ArtistInfo> artistInfoPage;
if(artistSearchDto.getStatus() == null) {
artistInfoPage = artistInfoDao.findAllNoStatus(pageable);
} else {
artistInfoPage = artistInfoDao.findAllByStatus(artistSearchDto.getStatus(), pageable);
}
long totalElements = artistInfoPage.getTotalElements();
return new PageResult<>(totalElements, artistInfoPage.getContent());
}

Loading…
Cancel
Save