fix: 删除分类改为直接删除
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Agent
2026-03-31 16:01:47 +00:00
parent e39643fdb7
commit 18832cf72d

View File

@@ -68,16 +68,9 @@ public class ProductServiceImpl implements ProductService {
/**
* 删除分类
* 检查是否有商品使用该分类,存在则不允许删除
*/
@Override
public void deleteCategory(String id) {
// 检查是否有商品使用该分类
Long count = productMapper.selectCount(new LambdaQueryWrapper<Product>()
.eq(Product::getCategoryId, id));
if (count > 0) {
throw new RuntimeException("该分类下有商品,无法删除");
}
categoryMapper.deleteById(id);
}