bug: 修改标准后体系类别关系丢失问题

This commit is contained in:
wxyclub
2023-11-29 21:16:27 +08:00
parent 469db9fb23
commit 076dee1390
3 changed files with 42 additions and 6 deletions
@@ -8,6 +8,7 @@ import com.adc.da.slrs.sarResource.service.ITsResourceService;
import com.adc.da.slrs.sarStandMenu.entity.SarStandMenu;
import com.adc.da.sys.sarMenuStandard.entity.SarMenuStandard;
import com.adc.da.sys.sarMenuStandard.service.ISarMenuStandardService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
@@ -17,6 +18,8 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* <p>
@@ -51,9 +54,23 @@ public class SarBussStandMenuServiceImpl extends ServiceImpl<SarBussStandMenuDao
@Override
public void deleteStandSystemByStandId(String id) {
LambdaUpdateWrapper<SarBussStandMenu> sarStandMenuWrapper = new LambdaUpdateWrapper<>();
sarStandMenuWrapper.eq(SarBussStandMenu::getBussStandId, id);
remove(sarStandMenuWrapper);
LambdaQueryWrapper<SarBussStandMenu> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SarBussStandMenu::getBussStandId, id);
List<SarBussStandMenu> list = list(wrapper);
Set<String> collect = list.stream().map(SarBussStandMenu::getMenuId).collect(Collectors.toSet());
List<String> menuIds = new ArrayList<>();
for (String menuId : collect) {
SarMenuStandard menuStand = iSarMenuStandardService.getById(menuId);
if (menuStand != null) {
menuIds.add(menuStand.getId());
}
}
if (menuIds.size() > 0) {
LambdaUpdateWrapper<SarBussStandMenu> sarStandMenuWrapper = new LambdaUpdateWrapper<>();
sarStandMenuWrapper.eq(SarBussStandMenu::getBussStandId, id);
sarStandMenuWrapper.in(SarBussStandMenu::getMenuId,menuIds);
remove(sarStandMenuWrapper);
}
}
@Override
@@ -1391,6 +1391,8 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
// 处理标准体系字段
Object txlbbuss = sarBussionessStandEO.getAttrInfoMap().get("TXLBBUSS");
if (txlbbuss != null && !Objects.equals(txlbbuss.toString(), "")) {
List<String> list = Arrays.asList(txlbbuss.toString().split("/"));
txlbbuss = list.get(list.size() - 1);
// 配置体系类别
String txlbBussLevel = getParentNodePathRecursive((String) txlbbuss);
sarBussionessStandEO.getAttrInfoCaseMap().put("txlbbuss",txlbBussLevel);
@@ -14,7 +14,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* <p>
@@ -50,9 +53,23 @@ public class SarStandMenuServiceImpl extends ServiceImpl<SarStandMenuDao, SarSta
@Override
public void deleteStandSystemByStandId(String id) {
LambdaUpdateWrapper<SarStandMenu> sarStandMenuWrapper = new LambdaUpdateWrapper<>();
sarStandMenuWrapper.eq(SarStandMenu::getStandId, id);
remove(sarStandMenuWrapper);
LambdaQueryWrapper<SarStandMenu> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SarStandMenu::getStandId, id);
List<SarStandMenu> list = list(wrapper);
Set<String> collect = list.stream().map(SarStandMenu::getMenuId).collect(Collectors.toSet());
List<String> menuIds = new ArrayList<>();
for (String menuId : collect) {
SarMenuStandard menuStand = iSarMenuStandardService.getById(menuId);
if (menuStand != null) {
menuIds.add(menuStand.getId());
}
}
if (menuIds.size() > 0) {
LambdaUpdateWrapper<SarStandMenu> sarStandMenuWrapper = new LambdaUpdateWrapper<>();
sarStandMenuWrapper.eq(SarStandMenu::getStandId, id);
sarStandMenuWrapper.in(SarStandMenu::getMenuId,menuIds);
remove(sarStandMenuWrapper);
}
}
@Override