Commit 369eece7 authored by chenzhao's avatar chenzhao

bug 3026 【web】日常管理>机场单位,删除有级联数据的部门时,应无法直接删除

parent cbd3eb56
...@@ -10,6 +10,7 @@ import java.util.stream.Collectors; ...@@ -10,6 +10,7 @@ import java.util.stream.Collectors;
import javax.annotation.Resource; import javax.annotation.Resource;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -262,8 +263,14 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire ...@@ -262,8 +263,14 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
*/ */
public void deleteById(Long parent) throws Exception { public void deleteById(Long parent) throws Exception {
// 查询是否有下属队伍 // 查询是否有下属队伍
List<FireTeamDto> fireTeamList = queryForList(null, false, parent); // List<FireTeamDto> fireTeamList = queryForList(null, false, parent);
if (!ValidationUtil.isEmpty(fireTeamList) && fireTeamList.size() > 0) { /*3026 【web】日常管理>机场单位,删除有级联数据的部门时,应无法直接删除 chenzhao 2021-09-28 start*/
LambdaQueryWrapper<FireTeam> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(FireTeam::getParent,parent);
wrapper.eq(BaseEntity::getIsDelete,0);
List<FireTeam> fireTeams = baseMapper.selectList(wrapper);
/*3026 【web】日常管理>机场单位,删除有级联数据的部门时,应无法直接删除 chenzhao 2021-09-28 end*/
if (!ValidationUtil.isEmpty(fireTeams) && fireTeams.size() > 0) {
// 有下属队伍不能删除 // 有下属队伍不能删除
throw new BaseException("该队伍下有下级队伍,不能删除", null, "该队伍下有下级队伍,不能删除"); throw new BaseException("该队伍下有下级队伍,不能删除", null, "该队伍下有下级队伍,不能删除");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment