From a1354429fbab61493a62e13512d7417bb3e3c98d Mon Sep 17 00:00:00 2001 From: pikaqiudeshujia Date: Tue, 30 Apr 2024 14:13:49 +0800 Subject: [PATCH] =?UTF-8?q?release-=20=E5=A4=84=E7=90=86=E4=B8=93=E8=BE=91?= =?UTF-8?q?=E4=B8=8D=E5=8F=AF=E6=8A=97=E5=8A=9B=E5=8E=9F=E5=9B=A0=E7=8A=B6?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- luoo_common/src/main/java/enums/AlbumStateEnum.java | 6 +++++- .../src/main/java/com/luoo/music/service/AlbumService.java | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/luoo_common/src/main/java/enums/AlbumStateEnum.java b/luoo_common/src/main/java/enums/AlbumStateEnum.java index 8f813e8..35ae8b3 100644 --- a/luoo_common/src/main/java/enums/AlbumStateEnum.java +++ b/luoo_common/src/main/java/enums/AlbumStateEnum.java @@ -12,6 +12,8 @@ import lombok.Getter; */ @Getter public enum AlbumStateEnum { + FORCE(-1 ,"不可抗力原因不允许显示"), + SAVE(0, "新建"), IN_APPROVE(1, "待审核"), @@ -20,7 +22,9 @@ public enum AlbumStateEnum { WAIT_ARRIVE(3, "待上架"), - ARRIVED(4, "已上架") + ARRIVED(4, "已上架"), + + DELETE(5, "已删除") ; private Integer code; diff --git a/luoo_music/src/main/java/com/luoo/music/service/AlbumService.java b/luoo_music/src/main/java/com/luoo/music/service/AlbumService.java index 4484add..1f2bdca 100644 --- a/luoo_music/src/main/java/com/luoo/music/service/AlbumService.java +++ b/luoo_music/src/main/java/com/luoo/music/service/AlbumService.java @@ -102,6 +102,7 @@ public class AlbumService { private Specification buildSearchSpecification(AlbumSearchDTO param) { return (Root root, CriteriaQuery query, CriteriaBuilder builder) -> { List predicateList = new ArrayList(); + predicateList.add(builder.notEqual(root.get("state"), AlbumStateEnum.FORCE.getCode())); if (StringUtils.isNotBlank(param.getArtistId())) { // 音乐人id predicateList.add(builder.equal(root.get("artistId"), param.getArtistId())); @@ -169,6 +170,9 @@ public class AlbumService { if (artistAlbum == null) { throw new RuntimeException("专辑不存在,请刷新后重试"); } + if (ObjectUtils.equals(AlbumStateEnum.FORCE.getCode(), artistAlbum.getState())) { + throw new RuntimeException("专辑因不可抗力原因无法显示"); + } // 整个数据库所有的tag List tagAllList = tagDao.findAll();