|
@@ -3,6 +3,10 @@ package com.yonge.cooleshow.biz.dal.service.impl;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
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.stereotype.Service;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -20,6 +24,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|
@Service
|
|
@Service
|
|
public class AlbumCategoryServiceImpl extends ServiceImpl<AlbumCategoryMapper, AlbumCategory> implements AlbumCategoryService {
|
|
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
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public void add(AlbumCategoryWrapper.AddAlbumCategory albumCategory) {
|
|
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);
|
|
AlbumCategory entity = JSON.parseObject(albumCategory.jsonString(), AlbumCategory.class);
|
|
entity.setUpdateBy(albumCategory.getOperatorId());
|
|
entity.setUpdateBy(albumCategory.getOperatorId());
|
|
if (entity.getId() == null) {
|
|
if (entity.getId() == null) {
|