From e528a85aa9f2a179017dafa37319757a53752564 Mon Sep 17 00:00:00 2001 From: "java_cuibaocheng@163.com" Date: Sat, 4 Nov 2023 15:26:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=81=E4=BB=B6=E5=8F=B7?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=20,=20=E4=BA=BA=E5=8F=A3=E5=BD=95=E5=85=A5?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=B8=83=E5=B1=80=20,=20=E5=B9=B4=E9=BE=84?= =?UTF-8?q?=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/api/areatree/AreaTreeController.java | 2 +- .../app/api/areatree/AreaTreeAppController.java | 12 ++++++++++-- src/main/resources/templates/cult/save.html | 2 +- src/main/resources/templates/cult/update.html | 2 +- src/main/resources/templates/dispute/save.html | 2 +- src/main/resources/templates/dispute/update.html | 2 +- .../resources/templates/populationinfo/save.html | 6 +++--- .../resources/templates/populationinfo/update.html | 8 ++++---- src/main/resources/templates/security/save.html | 2 +- src/main/resources/templates/security/update.html | 2 +- 10 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/cm/population/controller/api/areatree/AreaTreeController.java b/src/main/java/com/cm/population/controller/api/areatree/AreaTreeController.java index 04096a8..24c56f7 100644 --- a/src/main/java/com/cm/population/controller/api/areatree/AreaTreeController.java +++ b/src/main/java/com/cm/population/controller/api/areatree/AreaTreeController.java @@ -133,7 +133,7 @@ public class AreaTreeController extends AbstractController { for(AreaZtreeDTO dto : list) { ArrayList names = new ArrayList<>(); names.add(dto.getName()); - getParent(names, dto.getpId()); + getParentBaoTou(names, dto.getpId()); dto.setTitle(StringUtils.join(names, "/")); } return list; diff --git a/src/main/java/com/cm/population/controller/app/api/areatree/AreaTreeAppController.java b/src/main/java/com/cm/population/controller/app/api/areatree/AreaTreeAppController.java index 98af0da..fdf6522 100644 --- a/src/main/java/com/cm/population/controller/app/api/areatree/AreaTreeAppController.java +++ b/src/main/java/com/cm/population/controller/app/api/areatree/AreaTreeAppController.java @@ -91,7 +91,7 @@ public class AreaTreeAppController extends AbstractController { * @return */ @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) - @GetMapping("tree") + @PostMapping("tree") public List tree(String id) { String parentId = id; if (StringUtils.isEmpty(id)) { @@ -101,7 +101,7 @@ public class AreaTreeAppController extends AbstractController { for(AreaZtreeDTO dto : list) { ArrayList names = new ArrayList<>(); names.add(dto.getName()); - getParent(names, dto.getpId()); + getParentBaoTou(names, dto.getpId()); dto.setTitle(StringUtils.join(names, "/")); } return list; @@ -137,4 +137,12 @@ public class AreaTreeAppController extends AbstractController { } } + public void getParentBaoTou(ArrayList names, String pId) { + DataAreaDTO areaDTO = iPopulationInfoService.getAreaById(pId); + if(areaDTO != null && !areaDTO.getAreaLevel().equals("1") && !areaDTO.getAreaLevel().equals("0") ) { + names.add(0, areaDTO.getAreaName()); + getParentBaoTou(names, areaDTO.getAreaParentId()); + } + } + } \ No newline at end of file diff --git a/src/main/resources/templates/cult/save.html b/src/main/resources/templates/cult/save.html index b100f61..612d700 100644 --- a/src/main/resources/templates/cult/save.html +++ b/src/main/resources/templates/cult/save.html @@ -166,7 +166,7 @@ callback : { onClick : function (e, treeId, treeNode) { var count = treeNode.title.split('/').length -1; - if (count > 1) { + if (count > 0) { $('#' + name + "AreaName").val(treeNode.title); $('#' + name + "AreaCode").val(treeNode.areaCode); hideMenu(); diff --git a/src/main/resources/templates/cult/update.html b/src/main/resources/templates/cult/update.html index bff8ca3..0660ac0 100644 --- a/src/main/resources/templates/cult/update.html +++ b/src/main/resources/templates/cult/update.html @@ -162,7 +162,7 @@ callback : { onClick : function (e, treeId, treeNode) { var count = treeNode.title.split('/').length -1; - if (count > 1) { + if (count > 0) { $('#' + name + "AreaName").val(treeNode.title); $('#' + name + "AreaCode").val(treeNode.areaCode); hideMenu(); diff --git a/src/main/resources/templates/dispute/save.html b/src/main/resources/templates/dispute/save.html index 4d489f2..ed9e3ad 100644 --- a/src/main/resources/templates/dispute/save.html +++ b/src/main/resources/templates/dispute/save.html @@ -750,7 +750,7 @@ callback : { onClick : function (e, treeId, treeNode) { var count = treeNode.title.split('/').length -1; - if (count > 1) { + if (count > 0) { $('#' + name + "AreaName").val(treeNode.title); $('#' + name + "AreaCode").val(treeNode.areaCode); hideMenu(); diff --git a/src/main/resources/templates/dispute/update.html b/src/main/resources/templates/dispute/update.html index d914918..3cbc5b4 100644 --- a/src/main/resources/templates/dispute/update.html +++ b/src/main/resources/templates/dispute/update.html @@ -754,7 +754,7 @@ callback : { onClick : function (e, treeId, treeNode) { var count = treeNode.title.split('/').length -1; - if (count > 1) { + if (count > 0) { $('#' + name + "AreaName").val(treeNode.title); $('#' + name + "AreaCode").val(treeNode.areaCode); hideMenu(); diff --git a/src/main/resources/templates/populationinfo/save.html b/src/main/resources/templates/populationinfo/save.html index edb8ff9..64c6d58 100644 --- a/src/main/resources/templates/populationinfo/save.html +++ b/src/main/resources/templates/populationinfo/save.html @@ -345,7 +345,7 @@
-
+
@@ -362,7 +362,7 @@
-
+
@@ -933,7 +933,7 @@ callback : { onClick : function (e, treeId, treeNode) { var count = treeNode.title.split('/').length -1; - if (count > 1) { + if (count > 0) { $('#' + name + "AreaName").val(treeNode.title); $('#' + name + "AreaCode").val(treeNode.areaCode); hideMenu(); diff --git a/src/main/resources/templates/populationinfo/update.html b/src/main/resources/templates/populationinfo/update.html index 547500a..6f8f25f 100644 --- a/src/main/resources/templates/populationinfo/update.html +++ b/src/main/resources/templates/populationinfo/update.html @@ -344,7 +344,7 @@
-
+
@@ -361,7 +361,7 @@
-
+
@@ -877,7 +877,7 @@ callback : { onClick : function (e, treeId, treeNode) { var count = treeNode.title.split('/').length -1; - if (count > 1) { + if (count > 0) { $('#' + name + "AreaName").val(treeNode.title); $('#' + name + "AreaCode").val(treeNode.areaCode); hideMenu(); @@ -908,7 +908,7 @@ callback : { onClick : function (e, treeId, treeNode) { var count = treeNode.title.split('/').length -1; - if (count > 1) { + if (count > 0) { $('#' + name + "AreaName").val(treeNode.title); $('#' + name + "AreaCode").val(treeNode.areaCode); hideMenu(); diff --git a/src/main/resources/templates/security/save.html b/src/main/resources/templates/security/save.html index 5e64e69..3c2be45 100644 --- a/src/main/resources/templates/security/save.html +++ b/src/main/resources/templates/security/save.html @@ -243,7 +243,7 @@ callback : { onClick : function (e, treeId, treeNode) { var count = treeNode.title.split('/').length -1; - if (count > 1) { + if (count > 0) { $('#' + name + "AreaName").val(treeNode.title); $('#' + name + "AreaCode").val(treeNode.areaCode); hideMenu(); diff --git a/src/main/resources/templates/security/update.html b/src/main/resources/templates/security/update.html index 18a0170..775e6e2 100644 --- a/src/main/resources/templates/security/update.html +++ b/src/main/resources/templates/security/update.html @@ -245,7 +245,7 @@ callback : { onClick : function (e, treeId, treeNode) { var count = treeNode.title.split('/').length -1; - if (count > 1) { + if (count > 0) { $('#' + name + "AreaName").val(treeNode.title); $('#' + name + "AreaCode").val(treeNode.areaCode); hideMenu();