Browse Source

专辑分类

刘俊驰 1 ngày trước cách đây
mục cha
commit
fb9537bbd9

+ 9 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/MusicAlbumSheetDto.java

@@ -1,7 +1,9 @@
 package com.yonge.cooleshow.biz.dal.dto;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
 
 import java.util.List;
 
@@ -48,6 +50,7 @@ public class MusicAlbumSheetDto {
         this.albumMusicList = albumMusicList;
     }
 
+    @Data
     public static class AlbumMusic{
         @ApiModelProperty("曲目id")
         private Long musicSheetId;
@@ -55,6 +58,12 @@ public class MusicAlbumSheetDto {
         @ApiModelProperty("排序")
         private Integer sortNumber;
 
+        @ApiModelProperty(value = "级别")
+        private Long alBumCategoryLevelId;
+
+        @ApiModelProperty(value = "类型")
+        private Long alBumCategoryTypeId;
+
         public Long getMusicSheetId() {
             return musicSheetId;
         }

+ 5 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/search/MusicAlbumDetailSearch.java

@@ -48,6 +48,11 @@ public class MusicAlbumDetailSearch extends MusicSheetSearch {
     private Long studentId;
 
 
+    @ApiModelProperty("专辑分类级别ID")
+    private Long albumCategoryLevelId;
+
+    @ApiModelProperty("专辑分类类型ID")
+    private Long albumCategoryTypeId;
 
     @ApiModelProperty("是否查询分类信息")
     private Boolean queryCategory = false;

+ 3 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/AlbumCategory.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.yonge.cooleshow.common.enums.ETenantAlbumCategoryType;
 import lombok.Data;
 
 import io.swagger.annotations.ApiModel;
@@ -23,7 +24,7 @@ import java.util.Date;
 public class AlbumCategory implements Serializable {
 
     @ApiModelProperty("主键ID") 
-	    @TableId(value = "id_")
+	    @TableId(value = "id_", type = IdType.AUTO)
 	    private Long id;
 
     @ApiModelProperty("专辑ID") 
@@ -32,7 +33,7 @@ public class AlbumCategory implements Serializable {
 
     @ApiModelProperty("专辑分类类别 类型 CATEGORY_TYPE 级别 CATEGORY_LEVEL") 
 	@TableField(value = "category_type_")
-    private String categoryType;
+    private ETenantAlbumCategoryType categoryType;
 
     @ApiModelProperty("专辑分类名称") 
 	@TableField(value = "name_")

+ 10 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/AlbumCategoryServiceImpl.java

@@ -3,6 +3,10 @@ package com.yonge.cooleshow.biz.dal.service.impl;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.yonge.cooleshow.biz.dal.entity.MusicAlbum;
+import com.yonge.cooleshow.biz.dal.service.MusicAlbumService;
+import com.yonge.toolset.base.exception.BizException;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.beans.BeanUtils;
 import lombok.extern.slf4j.Slf4j;
@@ -20,6 +24,8 @@ import org.springframework.transaction.annotation.Transactional;
 @Service
 public class AlbumCategoryServiceImpl extends ServiceImpl<AlbumCategoryMapper, AlbumCategory> implements AlbumCategoryService {
 
+    @Autowired
+    private MusicAlbumService musicAlbumService;
 
     
     /**
@@ -37,6 +43,10 @@ public class AlbumCategoryServiceImpl extends ServiceImpl<AlbumCategoryMapper, A
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void add(AlbumCategoryWrapper.AddAlbumCategory albumCategory) {
+        MusicAlbum musicAlbum = musicAlbumService.getById(albumCategory.getAlbumId());
+        if (musicAlbum == null) {
+            throw new BizException("专辑不存在");
+        }
         AlbumCategory entity = JSON.parseObject(albumCategory.jsonString(), AlbumCategory.class);
         entity.setUpdateBy(albumCategory.getOperatorId());
         if (entity.getId() == null) {

+ 2 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/AlbumMusicRelateServiceImpl.java

@@ -68,6 +68,8 @@ public class AlbumMusicRelateServiceImpl extends ServiceImpl<AlbumMusicRelateDao
             albumMusicRelate.setAlbumId(albumId);
             albumMusicRelate.setMusicSheetId(albumMusic.getMusicSheetId());
             albumMusicRelate.setSortNumber(albumMusic.getSortNumber());
+            albumMusicRelate.setAlBumCategoryLevelId(albumMusic.getAlBumCategoryLevelId());
+            albumMusicRelate.setAlBumCategoryTypeId(albumMusic.getAlBumCategoryTypeId());
             albumMusicRelate.setCreateTime(new Date());
             albumMusicRelate.setCreateBy(userId);
             return albumMusicRelate;

+ 2 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/wrapper/AlbumCategoryWrapper.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.microsvc.toolkit.common.response.paging.QueryInfo;
+import com.yonge.cooleshow.common.enums.ETenantAlbumCategoryType;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import java.util.Optional;
@@ -103,7 +104,7 @@ public class AlbumCategoryWrapper {
 
         @ApiModelProperty("专辑分类类别 类型 CATEGORY_TYPE 级别 CATEGORY_LEVEL")
         @NotNull(message = "专辑分类类别不能为空")
-        private String categoryType;
+        private ETenantAlbumCategoryType categoryType;
 
         @ApiModelProperty("专辑分类名称")
         @NotNull(message = "名称不能为空")

+ 3 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/AlbumCategoryMapper.xml

@@ -29,6 +29,9 @@
             <if test="param.categoryType != null and param.categoryType != ''">
                 and t.category_type_ = #{param.categoryType}
             </if>
+            <if test="param.keyword != null and param.keyword != ''">
+                and t.name_ like concat('%',#{param.keyword},'%')
+            </if>
         </where>
         order by t.sort_ ,t.id_ desc
 	</select>

+ 6 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/MusicSheetMapper.xml

@@ -345,6 +345,12 @@
             <if test="param.musicSheetName != null and param.musicSheetName != ''">
                 and t.music_sheet_name_ like concat('%',#{param.musicSheetName},'%')
             </if>
+            <if test="param.albumCategoryLevelId != null">
+                and amr.album_category_level_id_ = #{param.albumCategoryLevelId}
+            </if>
+            <if test="param2.albumCategoryTypeId != null">
+                and amr.album_category_type_id_ = #{param2.albumCategoryTypeId}
+            </if>
             <if test="param.search != null and param.search != ''">
                 and (t.cbs_music_sheet_id_ like concat('%',#{param.search},'%') or
                 t.music_sheet_name_ like concat('%',#{param.search},'%'))