From cb9fbcd27a288d0c61d85fa13ff5fc8eb1f4deab Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期六, 18 三月 2023 16:44:56 +0800
Subject: [PATCH] 1

---
 src/main/java/com/lf/server/controller/all/BaseQueryController.java |  112 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 106 insertions(+), 6 deletions(-)

diff --git a/src/main/java/com/lf/server/controller/all/BaseQueryController.java b/src/main/java/com/lf/server/controller/all/BaseQueryController.java
index ac96d80..f0c8be9 100644
--- a/src/main/java/com/lf/server/controller/all/BaseQueryController.java
+++ b/src/main/java/com/lf/server/controller/all/BaseQueryController.java
@@ -6,6 +6,7 @@
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.lf.server.annotation.SysLog;
 import com.lf.server.entity.all.ResponseMsg;
+import com.lf.server.entity.all.StaticData;
 import com.lf.server.entity.ctrl.DownloadReqEntity;
 import com.lf.server.entity.ctrl.IdNameEntity;
 import com.lf.server.entity.ctrl.KeyValueEntity;
@@ -141,6 +142,45 @@
     }
 
     @SysLog()
+    @ApiOperation(value = "缂撳啿鍖烘煡璇�")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "name", value = "鏄犲皠鍚嶇О", dataType = "String", paramType = "query", example = "dlgagnp"),
+            @ApiImplicitParam(name = "wkt", value = "WKT锛堣憲鍚嶆枃鏈級", dataType = "String", paramType = "query", example = ""),
+            @ApiImplicitParam(name = "buffer", value = "缂撳啿鍖哄ぇ灏�", dataType = "Double", paramType = "query", example = "10"),
+            @ApiImplicitParam(name = "limit", value = "闄愬埗鏉℃暟", dataType = "Integer", paramType = "query", example = "20")
+    })
+    @GetMapping(value = "/selectByBuffer")
+    public ResponseMsg<List<?>> selectByBuffer(String name, String wkt, Double buffer, Integer limit) {
+        try {
+            if (StringHelper.isEmpty(wkt)) {
+                return fail("WKT涓嶈兘涓虹┖", null);
+            }
+            if (null == limit || limit < 1 || limit > StaticData.ONE_HUNDRED) {
+                limit = 20;
+            }
+            if (null == buffer || buffer < 0 || buffer > StaticData.ONE_HUNDRED_THOUSAND) {
+                buffer = 10.0;
+            }
+
+            GeomBaseMapper baseMapper = ClassHelper.getGeoBaseMapper(name);
+            if (baseMapper == null) {
+                return fail("鏌ヨ瀵硅薄涓嶅瓨鍦�", null);
+            }
+
+            QueryWrapper wrapper = new QueryWrapper();
+            wrapper.select("ST_AsText(geom) as geom, *");
+            baseQueryService.addBufferWrapper(baseMapper, wrapper, wkt, buffer);
+            wrapper.last("limit " + limit);
+
+            List<?> list = baseMapper.selectList(wrapper);
+
+            return success(null == list ? 0 : list.size(), list);
+        } catch (Exception ex) {
+            return fail(ex, null);
+        }
+    }
+
+    @SysLog()
     @ApiOperation(value = "鏍规嵁鐖禝D鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "metaid", value = "鐖禝D", dataType = "String", paramType = "query", example = "0"),
@@ -196,6 +236,53 @@
             }
 
             return success(wkt);
+        } catch (Exception ex) {
+            return fail(ex, null);
+        }
+    }
+
+    @SysLog()
+    @ApiOperation(value = "鏍规嵁GID鏌ヨ")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "name", value = "鏄犲皠鍚嶇О", dataType = "String", paramType = "query", example = "dlgagnp"),
+            @ApiImplicitParam(name = "gid", value = "GID", dataType = "int", paramType = "query", example = "1")
+    })
+    @GetMapping(value = "/selectByGid")
+    public ResponseMsg<Object> selectByGid(String name, int gid) {
+        try {
+            GeomBaseMapper baseMapper = ClassHelper.getGeoBaseMapper(name);
+            if (baseMapper == null) {
+                return fail("鏌ヨ瀵硅薄涓嶅瓨鍦�", null);
+            }
+
+            QueryWrapper wrapper = new QueryWrapper();
+            wrapper.select("ST_AsText(geom) as geom, *");
+            wrapper.eq("gid", gid);
+
+            Object obj = baseMapper.selectOne(wrapper);
+
+            return success(null == obj ? 0 : 1, obj);
+        } catch (Exception ex) {
+            return fail(ex, null);
+        }
+    }
+
+    @SysLog()
+    @ApiOperation(value = "鏍规嵁瀹炰綋鍚嶆煡璇㈣〃鍚�")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "name", value = "鏄犲皠鍚嶇О", dataType = "String", paramType = "query", example = "dlgagnp")
+    })
+    @GetMapping(value = "/selectTabByEntity")
+    public ResponseMsg<Object> selectTabByEntity(String name) {
+        try {
+            BasicMapper baseMapper = ClassHelper.getBasicMapper(name);
+            if (baseMapper == null) {
+                return fail("鏌ヨ瀵硅薄涓嶅瓨鍦�", null);
+            }
+
+            String tab = BaseQueryService.getTabName(baseMapper);
+
+            return success(tab);
         } catch (Exception ex) {
             return fail(ex, null);
         }
@@ -271,12 +358,13 @@
     @SysLog()
     @ApiOperation(value = "鏌ヨ鎵�鏈夎〃")
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "鐐�")
+            @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "鐐�"),
+            @ApiImplicitParam(name = "hasGeom", value = "鍚湁Geom瀛楁", dataType = "Boolean", paramType = "query", example = "false")
     })
     @GetMapping(value = "/selectTabs")
-    public ResponseMsg<List<TabEntity>> selectTabs(String name) {
+    public ResponseMsg<List<TabEntity>> selectTabs(String name, Boolean hasGeom) {
         try {
-            List<TabEntity> list = dictService.selectDictTab(name);
+            List<TabEntity> list = dictService.selectDictTab(name, null == hasGeom || !hasGeom ? "gid" : "geom");
 
             return success(list);
         } catch (Exception ex) {
@@ -291,10 +379,11 @@
             @ApiImplicitParam(name = "depcode", value = "鍗曚綅缂栫爜", dataType = "String", paramType = "query", example = "00"),
             @ApiImplicitParam(name = "dirs", value = "鐩綍缂栫爜", dataType = "String", paramType = "query", example = "00,01"),
             @ApiImplicitParam(name = "tab", value = "琛ㄥ悕", dataType = "String", paramType = "query", example = "dlg_"),
+            @ApiImplicitParam(name = "hasGeom", value = "鍚湁Geom瀛楁", dataType = "Boolean", paramType = "query", example = "false"),
             @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"),
             @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1")
     })
-    public ResponseMsg<Object> selectTabsByPage(String depcode, String dirs, String tab, Integer pageSize, Integer pageIndex) {
+    public ResponseMsg<Object> selectTabsByPage(String depcode, String dirs, String tab, Boolean hasGeom, Integer pageSize, Integer pageIndex) {
         try {
             if (pageSize < 1 || pageIndex < 1) {
                 return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null);
@@ -312,12 +401,13 @@
                 filters += String.format(" and (%s)", dirs);
             }
 
-            int count = baseQueryService.selectTabsForCount(tab);
+            String field = null == hasGeom || !hasGeom ? "gid" : "geom";
+            int count = baseQueryService.selectTabsForCount(tab, field);
             if (count == 0) {
                 return success(0, null);
             }
 
-            List<TabEntity> rs = baseQueryService.selectTabsByPage(tab, filters, pageSize, pageSize * (pageIndex - 1));
+            List<TabEntity> rs = baseQueryService.selectTabsByPage(tab, field, filters, pageSize, pageSize * (pageIndex - 1));
 
             return success(count, rs);
         } catch (Exception ex) {
@@ -556,6 +646,16 @@
     }
 
     @SysLog()
+    @ApiOperation(value = "鏌ョ湅鏂囦欢")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "guid", value = "闄勪欢Guid", dataType = "String", paramType = "body")
+    })
+    @GetMapping(value = "/downloadForView")
+    public void downloadForView(String guid, HttpServletResponse res) {
+        metaService.downloadForView(guid, true, res);
+    }
+
+    @SysLog()
     @ApiOperation(value = "鍒嗛〉鏌ヨ涓嬭浇鏂囦欢")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""),

--
Gitblit v1.9.3