【修复】CRM 分类删除时,判断商品数量是否为空不正确的问题,导致无法删除分类

This commit is contained in:
YunaiV 2024-04-24 21:08:53 +08:00
parent 6f42da1b77
commit 53db8309e9
2 changed files with 3 additions and 3 deletions

View File

@ -87,7 +87,7 @@ public interface ErrorCodeConstants {
ErrorCode PRODUCT_CATEGORY_USED = new ErrorCode(1_020_009_002, "产品分类已关联产品"); ErrorCode PRODUCT_CATEGORY_USED = new ErrorCode(1_020_009_002, "产品分类已关联产品");
ErrorCode PRODUCT_CATEGORY_PARENT_NOT_EXISTS = new ErrorCode(1_020_009_003, "父分类不存在"); ErrorCode PRODUCT_CATEGORY_PARENT_NOT_EXISTS = new ErrorCode(1_020_009_003, "父分类不存在");
ErrorCode PRODUCT_CATEGORY_PARENT_NOT_FIRST_LEVEL = new ErrorCode(1_020_009_004, "父分类不能是二级分类"); ErrorCode PRODUCT_CATEGORY_PARENT_NOT_FIRST_LEVEL = new ErrorCode(1_020_009_004, "父分类不能是二级分类");
ErrorCode product_CATEGORY_EXISTS_CHILDREN = new ErrorCode(1_020_009_005, "存在子分类,无法删除"); ErrorCode PRODUCT_CATEGORY_EXISTS_CHILDREN = new ErrorCode(1_020_009_005, "存在子分类,无法删除");
// ========== 商机状态 1_020_010_000 ========== // ========== 商机状态 1_020_010_000 ==========
ErrorCode BUSINESS_STATUS_TYPE_NOT_EXISTS = new ErrorCode(1_020_010_000, "商机状态组不存在"); ErrorCode BUSINESS_STATUS_TYPE_NOT_EXISTS = new ErrorCode(1_020_010_000, "商机状态组不存在");

View File

@ -110,10 +110,10 @@ public class CrmProductCategoryServiceImpl implements CrmProductCategoryService
validateProductCategoryExists(id); validateProductCategoryExists(id);
// 1.2 校验是否还有子分类 // 1.2 校验是否还有子分类
if (productCategoryMapper.selectCountByParentId(id) > 0) { if (productCategoryMapper.selectCountByParentId(id) > 0) {
throw exception(product_CATEGORY_EXISTS_CHILDREN); throw exception(PRODUCT_CATEGORY_EXISTS_CHILDREN);
} }
// 1.3 校验是否被产品使用 // 1.3 校验是否被产品使用
if (crmProductService.getProductByCategoryId(id) !=null) { if (crmProductService.getProductByCategoryId(id) > 0) {
throw exception(PRODUCT_CATEGORY_USED); throw exception(PRODUCT_CATEGORY_USED);
} }
// 2. 删除 // 2. 删除