|
@@ -99,12 +99,13 @@ public class TopInstCategoryServiceImpl extends ServiceImpl<TopInstCategoryMappe
|
|
|
*/
|
|
|
private void validEntityBeforeSave(TopInstCategory entity){
|
|
|
//TODO 做一些数据校验,如唯一约束
|
|
|
+ if(iTopCostInstTpItemService.count(new LambdaQueryWrapper<TopCostInstTpItem>()
|
|
|
+ .eq(TopCostInstTpItem::getCostCatId, entity.getCostCatId())
|
|
|
+ .ne(TopCostInstTpItem::getStatus, -1))>0){
|
|
|
+ throw new CustomException("该分类已被使用,无法编辑和删除");
|
|
|
+ }
|
|
|
if(Validator.isNotEmpty(entity.getStatus())&&entity.getStatus()==-1){
|
|
|
- if(iTopCostInstTpItemService.count(new LambdaQueryWrapper<TopCostInstTpItem>()
|
|
|
- .eq(TopCostInstTpItem::getCostCatId, entity.getCostCatId())
|
|
|
- .ne(TopCostInstTpItem::getStatus, -1))>0){
|
|
|
- throw new CustomException("该分类已被使用,无法编辑和删除");
|
|
|
- }
|
|
|
+
|
|
|
}else{
|
|
|
if(checkNameUnique(entity)){
|
|
|
throw new CustomException("名称重复");
|