From 98a9ae17d5c68f94e7bcf7fd852a65e4288c7d03 Mon Sep 17 00:00:00 2001 From: linbangquan <1437892690@qq.com> Date: Mon, 6 Nov 2023 19:57:15 +0800 Subject: [PATCH 1/2] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E9=87=8D=E5=BB=BA?= =?UTF-8?q?=E5=B7=A6=E5=8F=B3=E7=BC=96=E7=A0=81=E6=8E=A5=E5=8F=A3=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=8A=A8=E6=80=81=E8=AE=BE=E7=BD=AE=E6=8E=92=E5=BA=8F?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1018910025940992]重建左右编码接口增加动态设置排序字段 http://192.168.0.96:8090/demo/rdm.html#/story-detail/939050947543040/939050947543042/1018910025940992 --- .../framework/lrcode/LRCodeManager.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main/java/neatlogic/framework/lrcode/LRCodeManager.java b/src/main/java/neatlogic/framework/lrcode/LRCodeManager.java index 7d11b3226..f81eea365 100644 --- a/src/main/java/neatlogic/framework/lrcode/LRCodeManager.java +++ b/src/main/java/neatlogic/framework/lrcode/LRCodeManager.java @@ -212,24 +212,32 @@ public class LRCodeManager { treeMapper.batchUpdateTreeNodeRightCode(tableName, treeNodeVo.getLft(), -step, condition); } + public static void rebuildLeftRightCodeOrderBySortKey(String tableName, String idKey, String parentIdKey, String sortKey) { + rebuildLeftRightCode(tableName, idKey, parentIdKey, null, 1, null, sortKey); + } + + public static void rebuildLeftRightCodeOrderBySortKey(String tableName, String idKey, String parentIdKey, String condition, String sortKey) { + rebuildLeftRightCode(tableName, idKey, parentIdKey, null, 1, condition, sortKey); + } + public static void rebuildLeftRightCode(String tableName, String idKey, String parentIdKey) { - rebuildLeftRightCode(tableName, idKey, parentIdKey, null, 1, null); + rebuildLeftRightCode(tableName, idKey, parentIdKey, null, 1, null, null); } public static void rebuildLeftRightCode(String tableName, String idKey, String parentIdKey, String condition) { - rebuildLeftRightCode(tableName, idKey, parentIdKey, null, 1, condition); + rebuildLeftRightCode(tableName, idKey, parentIdKey, null, 1, condition, null); } - private static Integer rebuildLeftRightCode(String tableName, String idKey, String parentIdKey, Object parentIdValue, int parentLft, String condition) { - List catalogList = treeMapper.getTreeNodeListByParentId(tableName, idKey, parentIdKey, parentIdValue, condition); + private static Integer rebuildLeftRightCode(String tableName, String idKey, String parentIdKey, Object parentIdValue, int parentLft, String condition, String sortKey) { + List catalogList = treeMapper.getTreeNodeListByParentId(tableName, idKey, parentIdKey, parentIdValue, condition, sortKey); for (TreeNodeVo catalog : catalogList) { if (catalog.getChildrenCount() == 0) { treeMapper.updateTreeNodeLeftRightCodeById(tableName, idKey, catalog.getIdValue(), parentLft + 1, parentLft + 2); parentLft += 2; } else { int lft = parentLft + 1; - parentLft = rebuildLeftRightCode(tableName, idKey, parentIdKey, catalog.getIdValue(), lft, condition); + parentLft = rebuildLeftRightCode(tableName, idKey, parentIdKey, catalog.getIdValue(), lft, condition, sortKey); treeMapper.updateTreeNodeLeftRightCodeById(tableName, idKey, catalog.getIdValue(), lft, parentLft + 1); parentLft += 1; } -- Gitee From c3b4f8b72e7af0e9a7e7d72cb2a5b3e37f964492 Mon Sep 17 00:00:00 2001 From: linbangquan <1437892690@qq.com> Date: Mon, 6 Nov 2023 19:58:44 +0800 Subject: [PATCH 2/2] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E9=87=8D=E5=BB=BA?= =?UTF-8?q?=E5=B7=A6=E5=8F=B3=E7=BC=96=E7=A0=81=E6=8E=A5=E5=8F=A3=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=8A=A8=E6=80=81=E8=AE=BE=E7=BD=AE=E6=8E=92=E5=BA=8F?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1018910025940992]重建左右编码接口增加动态设置排序字段 http://192.168.0.96:8090/demo/rdm.html#/story-detail/939050947543040/939050947543042/1018910025940992 --- .../neatlogic/framework/lrcode/dao/mapper/TreeMapper.java | 2 +- .../neatlogic/framework/lrcode/dao/mapper/TreeMapper.xml | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/neatlogic/framework/lrcode/dao/mapper/TreeMapper.java b/src/main/java/neatlogic/framework/lrcode/dao/mapper/TreeMapper.java index 6f1a17a06..8f3537b1d 100644 --- a/src/main/java/neatlogic/framework/lrcode/dao/mapper/TreeMapper.java +++ b/src/main/java/neatlogic/framework/lrcode/dao/mapper/TreeMapper.java @@ -65,7 +65,7 @@ public interface TreeMapper { * @Returns:java.lang.Object **/ // public Object checkLeafNodeLeftRightCodeAreNotContinuous(@Param("tableName")String tableName, @Param("idKey") String idKey, @Param("parentIdKey") String parentIdKey); - public List getTreeNodeListByParentId(@Param("tableName") String tableName, @Param("idKey") String idKey, @Param("parentIdKey") String parentIdKey, @Param("parentIdValue") Object parentIdValue, @Param("condition") String condition); + public List getTreeNodeListByParentId(@Param("tableName") String tableName, @Param("idKey") String idKey, @Param("parentIdKey") String parentIdKey, @Param("parentIdValue") Object parentIdValue, @Param("condition") String condition, @Param("sortKey") String sortKey); public int updateTreeNodeLeftRightCodeById(@Param("tableName") String tableName, @Param("idKey") String idKey, @Param("idValue") Object idValue, @Param("lft") int lft, @Param("rht") int rht); diff --git a/src/main/java/neatlogic/framework/lrcode/dao/mapper/TreeMapper.xml b/src/main/java/neatlogic/framework/lrcode/dao/mapper/TreeMapper.xml index 0f61c7f34..0d1995e72 100644 --- a/src/main/java/neatlogic/framework/lrcode/dao/mapper/TreeMapper.xml +++ b/src/main/java/neatlogic/framework/lrcode/dao/mapper/TreeMapper.xml @@ -72,7 +72,9 @@ and ${condition} - ORDER BY a.`lft` + + ORDER BY a.`${sortKey}` + @@ -146,4 +148,4 @@ WHERE `lft` >= #{lft} AND `rht` <= #{rht} - \ No newline at end of file + -- Gitee