|
|
@ -2,6 +2,7 @@ package com.qs.serve.modules.bms.service.impl; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.qs.serve.modules.bms.entity.BmsSubject; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -9,6 +10,8 @@ import com.qs.serve.modules.bms.entity.BmsCostCenter; |
|
|
|
import com.qs.serve.modules.bms.service.BmsCostCenterService; |
|
|
|
import com.qs.serve.modules.bms.mapper.BmsCostCenterMapper; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
/** |
|
|
|
* 成本中心 服务实现类 |
|
|
|
* @author YenHex |
|
|
@ -33,5 +36,23 @@ public class BmsCostCenterServiceImpl extends ServiceImpl<BmsCostCenterMapper,Bm |
|
|
|
return this.getOne(lqw,true); |
|
|
|
} |
|
|
|
|
|
|
|
private List<BmsCostCenter> listChild(Long pid) { |
|
|
|
LambdaQueryWrapper<BmsCostCenter> lqw = new LambdaQueryWrapper<>(); |
|
|
|
lqw.eq(BmsCostCenter::getPid,pid); |
|
|
|
return this.list(lqw); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public boolean removeSelfAndChildById(Long id) { |
|
|
|
List<BmsCostCenter> list = listChild(id); |
|
|
|
for(BmsCostCenter subject:list){ |
|
|
|
boolean result = removeSelfAndChildById(subject.getId()); |
|
|
|
if(!result){ |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
return this.removeById(id); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|