Jelajahi Sumber

Merge branch 'tag_album_20221011'

liujunchi 3 tahun lalu
induk
melakukan
85e0914c2b

+ 2 - 2
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/MusicTagController.java

@@ -57,8 +57,8 @@ public class MusicTagController extends BaseController {
 	 */
 	@GetMapping("/tree")
 	@ApiOperation(value = "查询标签树列表")
-	public HttpResponseResult<List<MusicTagVo>> tree() {
-		List<MusicTagVo> treeList = musicTagService.selectMusicTagTree();
+	public HttpResponseResult<List<MusicTagVo>> tree(String type) {
+		List<MusicTagVo> treeList = musicTagService.selectMusicTagTree(type);
 		return succeed(treeList);
 	}
 

+ 13 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/MusicTagSaveDto.java

@@ -1,5 +1,6 @@
 package com.yonge.cooleshow.biz.dal.dto;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import io.swagger.annotations.ApiModelProperty;
 
 import javax.validation.constraints.NotBlank;
@@ -29,6 +30,18 @@ public class MusicTagSaveDto {
     @NotBlank(message = "标签名称不能为空")
     private String name;
 
+    @NotBlank(message = "标签类型不能为空")
+    @ApiModelProperty("标签类型 MUSIC:曲目 ALBUM:专辑")
+    private String type;
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
     public Long getId() {
         return id;
     }

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

@@ -19,6 +19,17 @@ public class MusicTagSearch extends QueryInfo{
 	@ApiModelProperty("标签状态(0:禁用,1:启用)")
 	private YesOrNoEnum state;
 
+	@ApiModelProperty("标签类型 MUSIC:曲目 ALBUM:专辑")
+	private String type;
+
+	public String getType() {
+		return type;
+	}
+
+	public void setType(String type) {
+		this.type = type;
+	}
+
 	public String getIdAndName() {
 		return idAndName;
 	}

+ 14 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/MusicTag.java

@@ -35,6 +35,10 @@ public class MusicTag implements Serializable {
     @ApiModelProperty(value = "标签状态(0:禁用,1:启用)")
     private YesOrNoEnum state;
 
+    @TableField(value = "type_")
+    @ApiModelProperty("标签类型 MUSIC:曲目 ALBUM:专辑")
+    private String type;
+
 	@TableField(value = "del_flag_")
     @ApiModelProperty(value = "假删标识(0:正常,1:删除)")
     private Boolean delFlag= false;
@@ -59,7 +63,16 @@ public class MusicTag implements Serializable {
     @ApiModelProperty(value = "更新人(后台平台用户)")
     private Long updateBy;  //更新人(老师或者是后台平台用户)
 
-	public Long getId() {
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public Long getId() {
         return id;
     }
 

+ 2 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/MusicTagService.java

@@ -64,8 +64,9 @@ public interface MusicTagService extends IService<MusicTag>  {
 	 * 获取标签树
 	 *
 	 * @return list
+	 * @param type
 	 */
-    List<MusicTagVo> selectMusicTagTree();
+    List<MusicTagVo> selectMusicTagTree(String type);
 
 	/**
 	 * 检查每个二级标签都在不同的一级标签下

+ 1 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/MusicSheetServiceImpl.java

@@ -1026,7 +1026,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
         List<ErrMsg> errMsgList = new ArrayList<>();
         dataList.sort(Comparator.comparingInt(ExcelDataReaderProperty::getRowIndex));
         List<MusicSheetDto> musicSheetDtoList = new ArrayList<>();
-        List<MusicTagVo> musicTagVoList = musicTagService.selectMusicTagTree();
+        List<MusicTagVo> musicTagVoList = musicTagService.selectMusicTagTree("MUSIC");
         List<Subject> subjects = subjectService.subjectSelect(null, null);
         Date date = new Date();
         for (ExcelDataReaderProperty<MusicSheetExport> readerProperty : dataList) {

+ 14 - 6
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/MusicTagServiceImpl.java

@@ -160,7 +160,7 @@ public class MusicTagServiceImpl extends ServiceImpl<MusicTagDao, MusicTag> impl
     @Transactional(rollbackFor = Exception.class)
     public boolean createMusicTag(MusicTagSaveDto musicTagSaveDto) {
 
-        if (checkNameRepeat(musicTagSaveDto.getName(), musicTagSaveDto.getId())) {
+        if (checkNameRepeat(musicTagSaveDto.getName(), musicTagSaveDto.getId(),musicTagSaveDto.getType())) {
             throw new BizException("标签名称重复");
         }
 
@@ -168,6 +168,7 @@ public class MusicTagServiceImpl extends ServiceImpl<MusicTagDao, MusicTag> impl
         MusicTag musicTag = new MusicTag();
         musicTag.setDelFlag(false);
         musicTag.setState(YesOrNoEnum.NO);
+        musicTag.setType(musicTagSaveDto.getType());
         if (musicTagSaveDto.getParentTagId() == null) {
             musicTag.setParentTagId(0L);
         } else {
@@ -186,12 +187,14 @@ public class MusicTagServiceImpl extends ServiceImpl<MusicTagDao, MusicTag> impl
      *
      * @param name 名称
      * @param id 标签id, 更新
+     * @param type
      * @return boolean
      */
-    private boolean checkNameRepeat(String name,Long id) {
+    private boolean checkNameRepeat(String name, Long id, String type) {
         LambdaQueryChainWrapper<MusicTag> eq = this.lambdaQuery()
-                                                   .eq(MusicTag::getDelFlag, YesOrNoEnum.NO.getCode())
-                                                   .eq(MusicTag::getName, name);
+                .eq(MusicTag::getDelFlag, YesOrNoEnum.NO.getCode())
+                .eq(MusicTag::getName, name)
+                .eq(MusicTag::getType,type);
         if (id != null) {
             eq.ne(MusicTag::getId,id);
         }
@@ -202,7 +205,7 @@ public class MusicTagServiceImpl extends ServiceImpl<MusicTagDao, MusicTag> impl
     @Transactional(rollbackFor = Exception.class)
     public boolean updateMusicTag(MusicTagSaveDto musicTagSaveDto) {
 
-        if (checkNameRepeat(musicTagSaveDto.getName(), musicTagSaveDto.getId())) {
+        if (checkNameRepeat(musicTagSaveDto.getName(), musicTagSaveDto.getId(), musicTagSaveDto.getType())) {
             throw new BizException("标签名称重复");
         }
         MusicTag oldTag = super.getById(musicTagSaveDto.getId());
@@ -214,6 +217,7 @@ public class MusicTagServiceImpl extends ServiceImpl<MusicTagDao, MusicTag> impl
         MusicTag musicTag = new MusicTag();
         musicTag.setDelFlag(false);
         musicTag.setId(musicTagSaveDto.getId());
+        musicTag.setType(musicTagSaveDto.getType());
         if (musicTagSaveDto.getParentTagId() == null) {
             musicTag.setParentTagId(0L);
         } else {
@@ -226,10 +230,14 @@ public class MusicTagServiceImpl extends ServiceImpl<MusicTagDao, MusicTag> impl
     }
 
     @Override
-    public List<MusicTagVo> selectMusicTagTree() {
+    public List<MusicTagVo> selectMusicTagTree(String type) {
+        if (StringUtil.isEmpty(type)) {
+            type = "MUSIC";
+        }
         List<MusicTag> list = this.lambdaQuery()
                 .eq(MusicTag::getDelFlag,YesOrNoEnum.NO.getCode())
                 .eq(MusicTag::getState,YesOrNoEnum.YES.getCode())
+                .eq(MusicTag::getType,type)
                 .list();
         if (list == null) {
             return new ArrayList<>();

+ 5 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/MusicTagMapper.xml

@@ -6,6 +6,7 @@
         <result column="parent_tag_id_" property="parentTagId" />
         <result column="name_" property="name" />
         <result column="state_" property="state" />
+        <result column="type_" property="type" />
         <result column="del_flag_" property="delFlag" />
         <result column="create_time_" property="createTime" />
         <result column="update_time_" property="updateTime" />
@@ -19,6 +20,7 @@
         , t.parent_tag_id_ as parentTagId
         , t.name_ as name
         , t.state_ as state
+        , t.type_ as type
         , t.del_flag_ as delFlag
         , t.create_time_ as createTime
         , t.update_time_ as updateTime
@@ -44,6 +46,9 @@
             <if test="param.state != null">
                 and t.state_ = #{param.state}
             </if>
+            <if test="param.type != null and param.type != ''">
+                and t.type_ = #{param.type}
+            </if>
             <if test="param.idAndName != null and param.idAndName != ''">
                 and ( t.id_ like concat( '%',#{param.idAndName},'%') or
                     t.name_ like  concat ('%',#{param.idAndName},'%') or

+ 2 - 2
cooleshow-user/user-student/src/main/java/com/yonge/cooleshow/student/controller/MusicTagController.java

@@ -26,8 +26,8 @@ public class MusicTagController extends BaseController {
 	 */
 	@GetMapping("/tree")
 	@ApiOperation(value = "查询标签树列表")
-	public HttpResponseResult<List<MusicTagVo>> tree() {
-		List<MusicTagVo> treeList = musicTagService.selectMusicTagTree();
+	public HttpResponseResult<List<MusicTagVo>> tree(String type) {
+		List<MusicTagVo> treeList = musicTagService.selectMusicTagTree(type);
 		return succeed(treeList);
 	}
 

+ 2 - 2
cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/MusicTagController.java

@@ -26,8 +26,8 @@ public class MusicTagController extends BaseController {
 	 */
 	@GetMapping("/tree")
 	@ApiOperation(value = "查询标签树列表")
-	public HttpResponseResult<List<MusicTagVo>> tree() {
-		List<MusicTagVo> treeList = musicTagService.selectMusicTagTree();
+	public HttpResponseResult<List<MusicTagVo>> tree(String type) {
+		List<MusicTagVo> treeList = musicTagService.selectMusicTagTree(type);
 		return succeed(treeList);
 	}
 

+ 2 - 2
cooleshow-user/user-website/src/main/java/com/yonge/cooleshow/website/controller/open/OpenMusicTagController.java

@@ -26,8 +26,8 @@ public class OpenMusicTagController extends BaseController {
 	 */
 	@GetMapping("/tree")
 	@ApiOperation(value = "查询标签树列表")
-	public HttpResponseResult<List<MusicTagVo>> tree() {
-		List<MusicTagVo> treeList = musicTagService.selectMusicTagTree();
+	public HttpResponseResult<List<MusicTagVo>> tree(String type) {
+		List<MusicTagVo> treeList = musicTagService.selectMusicTagTree(type);
 		return succeed(treeList);
 	}