|
@@ -13,12 +13,15 @@ import com.sd.business.entity.artwork.dto.ArtworkLibraryDto;
|
|
|
import com.sd.business.entity.artwork.dto.ArtworkLibrarySelectDto;
|
|
|
import com.sd.business.entity.artwork.po.ArtworkLibrary;
|
|
|
import com.sd.business.entity.artwork.vo.ArtworkLibraryVo;
|
|
|
+import com.sd.business.entity.sku.po.SkuSpec;
|
|
|
import com.sd.business.mapper.artwork.ArtworkLibraryMapper;
|
|
|
import com.sd.business.service.artwork.ArtworkLibraryService;
|
|
|
+import com.sd.business.service.sku.SkuSpecService;
|
|
|
import com.sd.framework.util.Assert;
|
|
|
import com.sd.mq.config.ArtworkConfig;
|
|
|
import com.sd.mq.entity.ArtworkMessage;
|
|
|
import com.sd.mq.util.RabbitMqUtil;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.io.File;
|
|
@@ -35,6 +38,9 @@ import java.util.Collections;
|
|
|
@Service
|
|
|
public class ArtworkLibraryServiceImpl extends ServiceImpl<ArtworkLibraryMapper, ArtworkLibrary> implements ArtworkLibraryService {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SkuSpecService skuSpecService;
|
|
|
+
|
|
|
|
|
|
* 分页
|
|
|
*/
|
|
@@ -118,6 +124,9 @@ public class ArtworkLibraryServiceImpl extends ServiceImpl<ArtworkLibraryMapper,
|
|
|
@DSTransactional
|
|
|
@Override
|
|
|
public void delete(Long id) {
|
|
|
+ long count = skuSpecService.count(q -> q.eq(SkuSpec::getArtworkLibraryId, id).last("limit 1"));
|
|
|
+ Assert.eqZero(count, "sku规格已绑定此图稿,无法删除");
|
|
|
+
|
|
|
ArtworkLibrary artworkLibrary = getById(id);
|
|
|
removeById(id);
|
|
|
ObsFileUtil.removeFile(id);
|