he2802 4 лет назад
Родитель
Сommit
3dc334a276

+ 2 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/MajorCategoryServiceImpl.java

@@ -94,10 +94,10 @@ public class MajorCategoryServiceImpl extends ServiceImpl<MajorCategoryMapper, M
      */
     private void validEntityBeforeSave(MajorCategory entity){
         //TODO 做一些数据校验,如唯一约束
-        if(checkMajorCategoryNameUnique(entity)){
+        if(checkMajorCategoryNameUnique(entity)&&Validator.isEmpty(entity.getCategoryId())){
             throw new CustomException("分类名已存在");
         }
-        if(entity.getPId()>0&&!checkMajorCategoryPid(entity)){
+        if(Validator.isNotNull(entity.getPId())&&entity.getPId()>0&&!checkMajorCategoryPid(entity)){
             throw new CustomException("父ID不存在");
         }
     }