|
@@ -265,15 +265,19 @@ public class StructureServiceImpl implements IStructureService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 查询架构路径和路径架构名称
|
|
|
+ * 查询所有架构的路径和路径拼接成的架构名称
|
|
|
*
|
|
|
* @return 返回查询到的数据
|
|
|
*/
|
|
|
@Override
|
|
|
public List<PathStructureNameVO> queryPathStructureName(Integer productId) {
|
|
|
- log.info("开始处理【查询所有架构路径和路径架构名称】的业务");
|
|
|
+ log.info("开始处理【查询所有架构路径和路径架构名称】的业务,参数为:{}", productId);
|
|
|
|
|
|
+ ArrayList<PathStructureNameVO> pathStructureNames = new ArrayList<>();
|
|
|
+
|
|
|
+ log.info("根据产品id查询所有架构数据");
|
|
|
List<StructureVO> structures = structureMapper.selectAllByProductId(productId);
|
|
|
+ //map存储所有架构id(key)和架构名称(value)
|
|
|
HashMap<String, String> map = new HashMap<>();
|
|
|
for (StructureVO structure : structures) {
|
|
|
Integer structureId = structure.getId();
|
|
@@ -281,17 +285,25 @@ public class StructureServiceImpl implements IStructureService {
|
|
|
String structureName = structure.getStructureName();
|
|
|
map.put(structureStrId, structureName);
|
|
|
}
|
|
|
+
|
|
|
for (StructureVO structure : structures) {
|
|
|
String path = structure.getPath();
|
|
|
- path = path.substring(path.indexOf(",") + 1);
|
|
|
- String[] split = path.split(",");
|
|
|
- for (String id : split) {
|
|
|
- map.get(id)
|
|
|
+ //path = path.substring(path.indexOf(",") + 1);
|
|
|
+ String[] pathSplit = path.split(",");
|
|
|
+ //String pathStructureName = "";
|
|
|
+ StringBuilder builder = new StringBuilder();
|
|
|
+ for (int i = 1; i < pathSplit.length; i++) {
|
|
|
+ String structureName = map.get(pathSplit[i]);
|
|
|
+ //pathStructureName = pathStructureName + structureName + "/";
|
|
|
+ builder.append(structureName).append("/");
|
|
|
}
|
|
|
-
|
|
|
+ PathStructureNameVO pathStructureNameVO = new PathStructureNameVO()
|
|
|
+ .setPath(path)
|
|
|
+ .setPathStructureName(builder + "");
|
|
|
+ pathStructureNames.add(pathStructureNameVO);
|
|
|
}
|
|
|
|
|
|
- return null;
|
|
|
+ return pathStructureNames;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -311,11 +323,11 @@ public class StructureServiceImpl implements IStructureService {
|
|
|
throw new XiaoShiException(message);
|
|
|
}
|
|
|
|
|
|
- //根据架构id查询其所有子级架构
|
|
|
ArrayList<Integer> structureIds = new ArrayList<>();
|
|
|
structureIds.add(id);
|
|
|
+ //根据架构路径查询其所有子级架构
|
|
|
String path = queryResult.getPath();
|
|
|
- log.info("根据架构id查询其所有子级架构");
|
|
|
+ log.info("根据架构路径查询其所有子级架构");
|
|
|
List<StructureVO> structures = structureMapper.selectByFindInSetPath(path);
|
|
|
for (StructureVO structure : structures) {
|
|
|
Integer childStructureId = structure.getId();
|
|
@@ -325,29 +337,14 @@ public class StructureServiceImpl implements IStructureService {
|
|
|
//架构和专利关联表删除数据
|
|
|
log.info("架构和专利关联表删除数据");
|
|
|
assoStructurePictureMapper.deleteByIds(structureIds);
|
|
|
-// if (rows != structureIds.size()) {
|
|
|
-// String message = "删除架构失败,架构和专利关联表删除数据失败,服务器忙请稍后再次尝试";
|
|
|
-// log.info("{}", message);
|
|
|
-// throw new XiaoShiException(message);
|
|
|
-// }
|
|
|
|
|
|
//架构和图片关联表删除数据
|
|
|
log.info("架构和图片关联表删除数据");
|
|
|
assoStructurePictureMapper.deleteByStructureIds(structureIds);
|
|
|
-// if (rows != structureIds.size()) {
|
|
|
-// String message = "删除架构失败,架构和图片关联表删除数据失败,服务器忙请稍后再次尝试";
|
|
|
-// log.info("{}", message);
|
|
|
-// throw new XiaoShiException(message);
|
|
|
-// }
|
|
|
|
|
|
//架构表删除数据
|
|
|
log.info("架构表删除数据");
|
|
|
int rows = structureMapper.deleteByIds(structureIds);
|
|
|
- if (rows != structureIds.size()) {
|
|
|
- String message = "删除架构失败,架构表删除数据失败,服务器忙请稍后再次尝试";
|
|
|
- log.info("{}", message);
|
|
|
- throw new XiaoShiException(message);
|
|
|
- }
|
|
|
|
|
|
log.info("删除架构完成");
|
|
|
|