|
@@ -143,12 +143,18 @@ public class BaseFacilityTypeServiceImpl extends AbstractCrudService<BaseFacilit
|
|
|
|
|
|
@Override
|
|
|
public boolean remove(Integer id) {
|
|
|
+ BaseFacilityType one = this.getById(id);
|
|
|
+ if(one == null){
|
|
|
+ throw new BusinessException("设施类型不存在");
|
|
|
+ }
|
|
|
+
|
|
|
LambdaQueryWrapper<BaseGgpFacility> queryWrapper1 = Wrappers.lambdaQuery();
|
|
|
- queryWrapper1.eq(BaseGgpFacility::getFacilityType, id);
|
|
|
+ queryWrapper1.eq(BaseGgpFacility::getFacilityType, one.getTypeCode());
|
|
|
int facilityNum = baseGgpFacilityService.getBaseMapper().selectCount(queryWrapper1);
|
|
|
if (facilityNum>0) {
|
|
|
- throw new BusinessException("设施类型删除失败,该设施类型下有设施绑定");
|
|
|
+ throw new BusinessException("当前类型已有关联设施,不可删除");
|
|
|
}
|
|
|
+
|
|
|
return this.removeById(id);
|
|
|
}
|
|
|
}
|