feat(singer): 添加歌手类型相关功能
- 在 pom.xml 中添加 Hutool 工具库依赖 - 优化前端 Singer.vue 中的歌手数据处理逻辑 - 在后端 SingerServiceImpl 中添加默认歌手类型设置功能
This commit is contained in:
@@ -97,6 +97,13 @@
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Hutool工具库 -->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.8.22</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 工具类 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.test.musichouduan.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.test.musichouduan.dto.PageResult;
|
||||
import com.test.musichouduan.dto.SingerDTO;
|
||||
import com.test.musichouduan.dto.MusicDTO;
|
||||
@@ -225,6 +227,12 @@ public class SingerServiceImpl implements SingerService {
|
||||
singer.setAvatar(avatarUrl);
|
||||
singer.setIntroduction(singerDTO.getIntroduction());
|
||||
singer.setCollectCount(0);
|
||||
// 设置默认歌手类型
|
||||
if (ObjectUtil.isEmpty(singerDTO.getTypeId())){
|
||||
SingerType defaultType = singerTypeRepository.findById(1L)
|
||||
.orElseThrow(() -> new BusinessException("默认歌手类型不存在"));
|
||||
singer.setType(defaultType);
|
||||
}
|
||||
|
||||
// 设置歌手类型
|
||||
if (singerDTO.getTypeId() != null) {
|
||||
|
||||
Reference in New Issue
Block a user