|
|
@@ -19,6 +19,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.BeanUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import io.swagger.annotations.Api;
|
|
|
@@ -29,6 +30,7 @@ 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.IGoodsDescService;
|
|
|
import org.springblade.client.goods.service.IGoodsTypeDescService;
|
|
|
import org.springblade.client.goods.service.IGoodsTypeService;
|
|
|
import org.springblade.client.vo.GoodsTypeVO;
|
|
|
@@ -38,6 +40,7 @@ import org.springblade.core.mp.support.Query;
|
|
|
import org.springblade.core.secure.BladeUser;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
+import org.springblade.core.tool.utils.BeanUtil;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
@@ -60,6 +63,8 @@ public class GoodsTypeController extends BladeController {
|
|
|
|
|
|
private final IGoodsTypeDescService iGoodsTypeDescService;
|
|
|
|
|
|
+ private final IGoodsDescService goodsDescService;
|
|
|
+
|
|
|
/**
|
|
|
* 详情
|
|
|
*/
|
|
|
@@ -125,9 +130,11 @@ 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)
|
|
|
+ LambdaQueryWrapper<GoodsDesc> lambdaQueryWrapper=new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.apply("find_in_set('"+goodsType.getId()+"',goods_type_id)")
|
|
|
+ .eq(GoodsDesc::getTenantId,AuthUtil.getTenantId())
|
|
|
+ .eq(GoodsDesc::getIsDeleted,0);
|
|
|
+ if(goodsDescService.count(lambdaQueryWrapper)>0)
|
|
|
{
|
|
|
return R.fail(500, "存在绑定商品无法删除");
|
|
|
}
|
|
|
@@ -148,7 +155,7 @@ public class GoodsTypeController extends BladeController {
|
|
|
if (StringUtils.isBlank(goodsType.getCname())) {
|
|
|
return R.fail(500, "名称不能为空");
|
|
|
}
|
|
|
- goodsTypeService.selectGoodsTypeCname(goodsType);
|
|
|
+ //goodsTypeService.selectGoodsTypeCname(goodsType);
|
|
|
goodsType.setType(GoodsTypeEnum.GOODS.getType());
|
|
|
return R.data(goodsTypeService.saveMessage(goodsType));
|
|
|
}
|