fix(文档拆分): 80780

This commit is contained in:
yjz
2024-01-17 15:19:58 +08:00
parent f7903bacc7
commit 08a20d3398
3 changed files with 26 additions and 2 deletions
@@ -203,4 +203,10 @@ public interface DocumentSplitMapper {
* @param idList
*/
List<LawsDocumentSplit> queryLawsDocumentSplitInIds(List<String> idList);
/**
* 文档拆分详情-查询menuId分组数量
* @param infoId
*/
List<String> queryLawsDocumentSplitGroupByMenuId(@Param("infoId") String infoId);
}
@@ -256,6 +256,16 @@
</foreach>
</select>
<select id="queryLawsDocumentSplitGroupByMenuId" resultType="java.lang.String">
SELECT *
FROM (SELECT menu_id, COUNT(*) count
FROM laws_document_split
WHERE info_id = #{infoId}
GROUP BY menu_id
ORDER BY count DESC) t
WHERE count > 1
</select>
<update id="editDocumentSplitDetail">
UPDATE laws_document_split
@@ -727,8 +727,16 @@ public class DocumentSplitServiceImpl implements IDocumentSplitService {
.collect(Collectors.toList());
if (!menuIdList.isEmpty()){
// 删除旧数据
documentSplitMapper.sarFileSplitMenuDeleteByIdList(menuIdList);
// 判断被合并条款之前有没有复制过,复制过则不删除相关目录
List<LawsDocumentSplit> lawsDocumentSplits = documentSplitMapper.queryLawsDocumentSplitInIds(Collections.singletonList((String) firstData.get(ID)));
List<String> menuIds = documentSplitMapper.queryLawsDocumentSplitGroupByMenuId(lawsDocumentSplits.get(0).getInfoId());
if (CollectionUtils.isNotEmpty(menuIds)){
menuIdList = menuIdList.stream().filter(v -> !menuIds.contains(v)).collect(Collectors.toList());
}
if (!menuIdList.isEmpty()){
// 删除旧数据
documentSplitMapper.sarFileSplitMenuDeleteByIdList(menuIdList);
}
}
// 修改条目