From 552da0d21c1203d5ac8ae6e3c82f4989b8845679 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期一, 19 十二月 2022 10:54:24 +0800
Subject: [PATCH] 1

---
 src/main/java/com/lf/server/service/show/DataLibService.java |   71 +++++++++++++++++++++++++++++++++++
 1 files changed, 71 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/lf/server/service/show/DataLibService.java b/src/main/java/com/lf/server/service/show/DataLibService.java
index 0e3c79e..646bd9a 100644
--- a/src/main/java/com/lf/server/service/show/DataLibService.java
+++ b/src/main/java/com/lf/server/service/show/DataLibService.java
@@ -1,9 +1,19 @@
 package com.lf.server.service.show;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.lf.server.entity.sys.UserEntity;
+import com.lf.server.helper.ClassHelper;
 import com.lf.server.helper.PathHelper;
+import com.lf.server.helper.StringHelper;
+import com.lf.server.mapper.all.GeomBaseMapper;
+import com.lf.server.service.all.BaseQueryService;
 import com.lf.server.service.data.DownloadService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * 璧勬枡棣�
@@ -15,5 +25,66 @@
     PathHelper pathHelper;
 
     @Autowired
+    BaseQueryService baseQueryService;
+
+    @Autowired
     DownloadService downloadService;
+
+    /**
+     * 鍒涘缓Zip鍖�
+     */
+    public String createZipFile(UserEntity ue, List<String> entities, String wkt, String pwd) {
+        Map<String, List<?>> map = queryData(entities, wkt);
+        if (map.size() == 0) {
+            return null;
+        }
+
+        return null;
+    }
+
+    /**
+     * 鏌ヨ鏁版嵁
+     */
+    private Map<String, List<?>> queryData(List<String> entities, String wkt) {
+        Map<String, List<?>> map = new HashMap<>(5);
+        for (String enity : entities) {
+            try {
+                GeomBaseMapper baseMapper = ClassHelper.getGeoBaseMapper(enity);
+                if (null == baseMapper) {
+                    continue;
+                }
+
+                String tab = BaseQueryService.getTabName(baseMapper);
+                if (StringHelper.isNull(tab)) {
+                    continue;
+                }
+
+                QueryWrapper wrapper = createWrapper(baseMapper, wkt);
+                List<?> list = baseMapper.selectList(wrapper);
+                if (null == list || list.size() == 0) {
+                    continue;
+                }
+
+                if (!map.containsKey(tab)) {
+                    map.put(tab, list);
+                }
+            } catch (Exception ex) {
+                //
+            }
+        }
+
+        return map;
+    }
+
+    /**
+     * 鍒涘缓QueryWrapper
+     */
+    private QueryWrapper createWrapper(GeomBaseMapper baseMapper, String wkt) {
+        QueryWrapper wrapper = new QueryWrapper();
+        wrapper.select("ST_AsText(geom) as geom");
+        Integer srid = baseQueryService.getSrid(baseMapper);
+        wrapper.apply(String.format("ST_Intersects(ST_PolygonFromText('%s', %d), geom)", wkt, srid));
+
+        return wrapper;
+    }
 }

--
Gitblit v1.9.3