|
|
@@ -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不存在");
|
|
|
}
|
|
|
}
|