From ba8f60437c8f3747bbfa69563388d8eb925a0bee Mon Sep 17 00:00:00 2001
From: xieb <vip_xiaobin810@163.com>
Date: Tue, 21 May 2024 17:41:32 +0800
Subject: [PATCH] 行政区划树升级功能

---
 skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sjztmd/controller/AttAdBaseController.java |   72 ++++++++++++++++++++++++++++-------
 1 files changed, 57 insertions(+), 15 deletions(-)

diff --git a/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sjztmd/controller/AttAdBaseController.java b/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sjztmd/controller/AttAdBaseController.java
index 3ee4d3f..2fe03b5 100644
--- a/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sjztmd/controller/AttAdBaseController.java
+++ b/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sjztmd/controller/AttAdBaseController.java
@@ -16,10 +16,8 @@
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.node.ForestNodeMerger;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springblade.core.tool.utils.ObjectUtil;
+import org.springframework.web.bind.annotation.*;
 import springfox.documentation.annotations.ApiIgnore;
 
 import java.util.List;
@@ -41,6 +39,37 @@
 
 	private final IAttAdBaseService attAdBaseService;
 
+	@ApiOperation(value = "中台行政区划-添加", notes = "中台行政区划-添加")
+	@PostMapping(value = "/save")
+	public R add(AttAdBase attAdBase) {
+		return R.data(attAdBaseService.save(attAdBase));
+	}
+
+	@ApiOperation(value = "中台行政区划-修改", notes = "中台行政区划-修改")
+	@PostMapping(value = "/edit")
+	public R edit(AttAdBase attAdBase) {
+		return R.data(attAdBaseService.updateById(attAdBase));
+	}
+
+	@ApiOperation(value = "中台行政区划-添加修改", notes = "中台行政区划-添加修改")
+	@PostMapping(value = "/submit")
+	public R submit(AttAdBase attAdBase) {
+		return R.data(attAdBaseService.saveOrUpdate(attAdBase));
+	}
+
+	@ApiOperation(value = "中台行政区划-删除", notes = "中台行政区划-删除")
+	@GetMapping(value = "/remove")
+	public R edit(String guid) {
+		return R.data(attAdBaseService.removeById(guid));
+	}
+
+	@ApiOperation(value = "中台行政区划-查询详情", notes = "中台行政区划-查询详情")
+	@GetMapping(value = "/getDetail")
+	public R getDetail(AttAdBase attAdBase) {
+		AttAdBaseVO one = attAdBaseService.getDetail(attAdBase);
+		return R.data(one);
+	}
+
 	@ApiOperation(value = "中台行政区划-分页列表查询", notes = "中台行政区划-分页列表查询")
 	@GetMapping(value = "/list")
 	public R queryPageList(AttAdBase attAdBase, Query query) {
@@ -60,6 +89,8 @@
 			obj.put("code",code.substring(0,2));
 		} else if (code.substring(0,6).indexOf("00") > -1) {
 			obj.put("code",code.substring(0,4));
+		}else if (code.substring(0,8).indexOf("00") > -1){
+			obj.put("code",code.substring(0,8));
 		}
 		List<AttAdBaseVO> list = attAdBaseService.lazyTree(parentCode, obj);
 		return R.data(listNodeLazyVO(list));
@@ -72,11 +103,15 @@
 	})
 	@ApiOperation(value = "加载树列表", notes = "传入code")
 	public R<List<AttAdBaseVO>> selectAll(String parentCode, @ApiIgnore @RequestParam Map<String, Object> obj) {
-		String code = obj.get("code").toString();
-		if (code.substring(0,4).indexOf("00") > -1) {
-			obj.put("code",code.substring(0,2));
-		} else if (code.substring(0,6).indexOf("00") > -1) {
-			obj.put("code",code.substring(0,4));
+		if (ObjectUtil.isNotEmpty(obj.get("code"))){
+			String code = obj.get("code").toString();
+			if (code.substring(0,4).indexOf("00") > -1) {
+				obj.put("code",code.substring(0,2));
+			} else if (code.substring(0,6).indexOf("00") > -1) {
+				obj.put("code",code.substring(0,4));
+			} else if (code.substring(0,8).indexOf("00") > -1) {
+				obj.put("code",code.substring(0,6));
+			}
 		}
 		List<AttAdBaseVO> list = attAdBaseService.lazyTreeAll(parentCode, obj);
 		return R.data(listNodeLazyVO(list));
@@ -95,12 +130,12 @@
 	})
 	@ApiOperation(value = "加载树列表", notes = "传入code")
 	public R selectAttAdBaseTree(String parentCode, @ApiIgnore @RequestParam Map<String, Object> obj) {
-		String code = obj.get("code").toString();
-		if (code.substring(0,4).indexOf("00") > -1) {
-			obj.put("code",code.substring(0,2));
-		} else if (code.substring(0,6).indexOf("00") > -1) {
-			obj.put("code",code.substring(0,4));
-		}
+//		String code = obj.get("code").toString();
+//		if (code.substring(0,4).indexOf("00") > -1) {
+//			obj.put("code",code.substring(0,2));
+//		} else if (code.substring(0,6).indexOf("00") > -1) {
+//			obj.put("code",code.substring(0,4));
+//		}
 		// 查询并返回
 		return R.data(attAdBaseService.selectAttAdBaseTree(parentCode, obj));
 	}
@@ -123,4 +158,11 @@
 		return ForestNodeMerger.merge(list);
 	}
 
+
+	@GetMapping("/getYwxtAttadBaseList")
+	public R getYwxtAttadBaseList(String parentId,String isYwxtRegion){
+		List<AttAdBase> attAdBases = attAdBaseService.getYwxtAttadBaseList(parentId,isYwxtRegion);
+		return R.data(attAdBases);
+	}
+
 }

--
Gitblit v1.9.3