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();