bug78243: 政策法规资料在子目录下创建的数据没有显示在父级目录下修改

This commit is contained in:
wxyclub
2023-11-09 15:02:58 +08:00
parent 2d0c081ddf
commit 9497335f63
5 changed files with 30 additions and 2 deletions
@@ -248,4 +248,7 @@ public class SarLawsInformation extends BasePage implements Serializable {
private Date uploadTimeBegin;
@TableField(exist = false)
private Date uploadTimeEnd;
// 查询使用 所有子节点列表
@TableField(exist = false)
private List<String> treeNodeIdList;
}
@@ -114,6 +114,12 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
page.setSortField("ID");
page.setSortMode("asc");
}
// 查询树节点及其子节点
if (StringUtils.isNotBlank(page.getTreeNodeId())) {
List<String> treeNodeIdList = new ArrayList<>();
treeService.querySubordinateTreeNode(treeNodeIdList, page.getTreeNodeId());
page.setTreeNodeIdList(treeNodeIdList);
}
Integer rowCount = this.baseMapper.queryByPageCount(page);
page.getPager().setRowCount(rowCount);
List<SarLawsInformation> sarLawsInformationList = this.baseMapper.queryByPage(page);
@@ -22,4 +22,6 @@ public interface SarLawsInformationCenterTreeService extends IService<SarLawsInf
List<SarLawsInformationCenterTreeData> getTree();
boolean updateTreeNode(SarLawsInformationCenterTree informationCenterTree);
void querySubordinateTreeNode(List<String> treeNodeIdList, String treeNodeId);
}
@@ -101,6 +101,20 @@ public class SarLawsInformationCenterTreeServiceImpl extends ServiceImpl<SarLaws
return updated > 0;
}
// 递归查询所有子节点
@Override
public void querySubordinateTreeNode(List<String> treeNodeIdList, String treeNodeId) {
treeNodeIdList.add(treeNodeId);
LambdaQueryWrapper<SarLawsInformationCenterTree> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SarLawsInformationCenterTree::getParentId, treeNodeId);
List<SarLawsInformationCenterTree> list = list(wrapper);
if (list.size()>0) {
for (SarLawsInformationCenterTree sarLawsInformationCenterTree : list) {
querySubordinateTreeNode(treeNodeIdList,sarLawsInformationCenterTree.getId());
}
}
}
@Transactional
@Override
public void setResource(SarLawsInformationCenterTree informationCenterTree) {
@@ -59,8 +59,11 @@
<if test="uploadTimeBegin != null and uploadTimeEnd != null">
and UPLOAD_TIME between #{uploadTimeBegin} and ${uploadTimeEnd}
</if>
<if test="treeNodeId != null and treeNodeId != ''">
and TREE_NODE_ID = #{treeNodeId}
<if test="treeNodeIdList != null and treeNodeIdList.size() &gt; 0">
and TREE_NODE_ID in
<foreach collection="treeNodeIdList" item="treeNodeId" index="index" separator="," open="(" close=")">
#{treeNodeId}
</foreach>
</if>
</sql>
<select id="queryByPageCount" resultType="java.lang.Integer">