|
|
@@ -16,6 +16,7 @@
|
|
|
*/
|
|
|
package org.springblade.client.goods.controller;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
@@ -24,8 +25,11 @@ import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.springblade.client.entity.GoodsDesc;
|
|
|
import org.springblade.client.entity.GoodsType;
|
|
|
+import org.springblade.client.entity.GoodsTypeDesc;
|
|
|
import org.springblade.client.goods.enums.GoodsTypeEnum;
|
|
|
+import org.springblade.client.goods.service.IGoodsTypeDescService;
|
|
|
import org.springblade.client.goods.service.IGoodsTypeService;
|
|
|
import org.springblade.client.vo.GoodsTypeVO;
|
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
|
@@ -54,6 +58,8 @@ public class GoodsTypeController extends BladeController {
|
|
|
|
|
|
private final IGoodsTypeService goodsTypeService;
|
|
|
|
|
|
+ private final IGoodsTypeDescService iGoodsTypeDescService;
|
|
|
+
|
|
|
/**
|
|
|
* 详情
|
|
|
*/
|
|
|
@@ -119,6 +125,12 @@ public class GoodsTypeController extends BladeController {
|
|
|
if (count != null && count > 0) {
|
|
|
return R.fail(500, "存在下级类别不能删除");
|
|
|
}
|
|
|
+ LambdaQueryWrapper<GoodsTypeDesc> lambdaQueryWrapper=new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.eq(GoodsTypeDesc::getGoodsTypeId,goodsType.getId());
|
|
|
+ if(iGoodsTypeDescService.count(lambdaQueryWrapper)>0)
|
|
|
+ {
|
|
|
+ return R.fail(500, "存在绑定商品无法删除");
|
|
|
+ }
|
|
|
goodsType.setIsDeleted(1);
|
|
|
return R.status(goodsTypeService.updateById(goodsType));
|
|
|
}
|