From e54ef5e185c46a35641dce47b792c4f20b98879a Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期三, 02 十一月 2022 19:08:25 +0800
Subject: [PATCH] 1

---
 src/main/java/com/lf/server/controller/all/BaseQueryController.java |  158 ++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 150 insertions(+), 8 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 86d8f1f..1c9ac49 100644
--- a/src/main/java/com/lf/server/controller/all/BaseQueryController.java
+++ b/src/main/java/com/lf/server/controller/all/BaseQueryController.java
@@ -1,15 +1,18 @@
 package com.lf.server.controller.all;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.OrderItem;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.lf.server.aspect.SysLog;
 import com.lf.server.entity.all.ResponseMsg;
-import com.lf.server.entity.bd.DlgAgnpEntity;
+import com.lf.server.entity.ctrl.IdNameEntity;
+import com.lf.server.entity.ctrl.TabEntity;
+import com.lf.server.entity.data.DictEntity;
+import com.lf.server.entity.data.DomainEntity;
 import com.lf.server.helper.AesHelper;
 import com.lf.server.helper.StringHelper;
+import com.lf.server.mapper.all.BasicMapper;
 import com.lf.server.mapper.all.GeomBaseMapper;
 import com.lf.server.service.all.BaseQueryService;
 import io.swagger.annotations.ApiImplicitParam;
@@ -32,14 +35,14 @@
     @ApiOperation(value = "鏌ヨ璁板綍鏁�")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "name", value = "鏄犲皠鍚嶇О", dataType = "String", paramType = "query", example = "dlgAgnp"),
-            @ApiImplicitParam(name = "filter", value = "杩囨护鏉′欢", dataType = "String", paramType = "query", example = ""),
-            @ApiImplicitParam(name = "wkt", value = "WKT锛堣憲鍚嶆枃鏈級", dataType = "String", paramType = "query", example = ""),
+            @ApiImplicitParam(name = "filter", value = "杩囨护鏉′欢", dataType = "String", paramType = "query", example = "gid >= 50 and name like '鍘�' and objectid < 5000.0"),
+            @ApiImplicitParam(name = "wkt", value = "WKT锛堣憲鍚嶆枃鏈級", dataType = "String", paramType = "query", example = "gAPpDbZ53XfoQfvT8dj/uhBWX5os8kBJQ1LrNvH3VX7byFQdUJMPiEr8Fkj0q2i1pw+L8KFrvR0MLXq2xaO21nlQQXmEPofJxpDQZwEWUIFZsToXo1kLRD3t6WQezxWB8YTzXHM20Ba73x/ZuuezVhOFOq1U8HKf1dXQdv7gBzEB6fWMmFDc3FuH8GDDHv3LfT86Gio9VgMO6ohlrUdf3ZKtTHeLSuzGF4t0RZuX97YBNo25IIzpeTfRTXBxfdxA"),
             @ApiImplicitParam(name = "srid", value = "绌洪棿寮曠敤鏍囪瘑绗�", dataType = "Integer", paramType = "query", example = "4326")
     })
     @GetMapping({"/selectCount"})
     public ResponseMsg<Long> selectCount(String name, String filter, String wkt, Integer srid) {
         try {
-            BaseMapper baseMapper = baseQueryService.getBaseMapper(name);
+            BasicMapper baseMapper = baseQueryService.getBasicMapper(name);
             if (baseMapper == null) {
                 return fail("鏌ヨ瀵硅薄涓嶅瓨鍦�", null);
             }
@@ -60,7 +63,7 @@
     @ApiOperation(value = "鍒嗛〉鏌ヨ")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "name", value = "鏄犲皠鍚嶇О", dataType = "String", paramType = "query", example = "dlgAgnp"),
-            @ApiImplicitParam(name = "filter", value = "杩囨护鏉′欢", dataType = "String", paramType = "query", example = "1=1 and 2>=1"),
+            @ApiImplicitParam(name = "filter", value = "杩囨护鏉′欢", dataType = "String", paramType = "query", example = ""),
             @ApiImplicitParam(name = "wkt", value = "WKT锛堣憲鍚嶆枃鏈級", dataType = "String", paramType = "query", example = ""),
             @ApiImplicitParam(name = "srid", value = "绌洪棿寮曠敤鏍囪瘑绗�", dataType = "Integer", paramType = "query", example = "4326"),
             @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1"),
@@ -69,7 +72,7 @@
     @GetMapping(value = "/selectByPage")
     public ResponseMsg<List<Object>> selectByPage(String name, String filter, String wkt, Integer srid, Integer pageIndex, Integer pageSize) {
         try {
-            BaseMapper baseMapper = baseQueryService.getBaseMapper(name);
+            BasicMapper baseMapper = baseQueryService.getBasicMapper(name);
             if (baseMapper == null) {
                 return fail("鏌ヨ瀵硅薄涓嶅瓨鍦�", null);
             }
@@ -102,7 +105,12 @@
                 return fail("鏌ヨ瀵硅薄涓嶅瓨鍦�", null);
             }
 
-            String wkt = baseMapper.selectWktById(gid);
+            String tab = baseQueryService.getTabName(baseMapper);
+            if (StringHelper.isNull(tab)) {
+                return fail("鏌ヨ瀵硅薄涓嶅瓨鍦�", null);
+            }
+
+            String wkt = baseMapper.selectWktById(tab, gid);
             if (!StringHelper.isEmpty(wkt)) {
                 wkt = AesHelper.encrypt(wkt);
             }
@@ -112,4 +120,138 @@
             return fail(ex.getMessage(), null);
         }
     }
+
+    @SysLog()
+    @ApiOperation(value = "妯$硦鎼滅储瀛楁")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "name", value = "鏄犲皠鍚嶇О", dataType = "String", paramType = "query", example = "dlgAgnp"),
+            @ApiImplicitParam(name = "field", value = "瀛楁", dataType = "String", paramType = "query", example = "name"),
+            @ApiImplicitParam(name = "value", value = "鍊�", dataType = "String", paramType = "query", example = "'鍘�'")
+    })
+    @GetMapping(value = "/selectFieldFuzzy")
+    public ResponseMsg<List<String>> selectFieldFuzzy(String name, String field, String value) {
+        try {
+            BasicMapper baseMapper = baseQueryService.getBasicMapper(name);
+            if (baseMapper == null) {
+                return fail("鏌ヨ瀵硅薄涓嶅瓨鍦�", null);
+            }
+
+            String tab = baseQueryService.getTabName(baseMapper);
+            if (StringHelper.isNull(tab)) {
+                return fail("鏌ヨ瀵硅薄涓嶅瓨鍦�", null);
+            }
+            if (StringHelper.isEmpty(field) || StringHelper.isSqlInjection(field)) {
+                return fail("鏌ヨ瀛楁涓嶆纭�", null);
+            }
+            if (!StringHelper.isEmpty(value)) {
+                value = value.trim().replace("'", "");
+            }
+
+            value = StringHelper.getLikeStr2(value);
+            List<String> rs = baseMapper.selectFieldFuzzy(tab, field, value);
+
+            return success(rs);
+        } catch (Exception ex) {
+            return fail(ex.getMessage(), null);
+        }
+    }
+
+    @SysLog()
+    @ApiOperation(value = "妯$硦鎼滅储鐢ㄦ埛")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "name", value = "鐢ㄦ埛鍚�", dataType = "String", paramType = "query", example = "瀹�")
+    })
+    @GetMapping(value = "/selectUserFuzzy")
+    public ResponseMsg<List<IdNameEntity>> selectUserFuzzy(String name) {
+        try {
+            List<IdNameEntity> rs = baseQueryService.selectUserFuzzy(name);
+
+            return success(rs);
+        } catch (Exception ex) {
+            return fail(ex.getMessage(), null);
+        }
+    }
+
+    @SysLog()
+    @ApiOperation(value = "妯$硦鎼滅储鍗曚綅")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "name", value = "鍗曚綅鍚�", dataType = "String", paramType = "query", example = "鍙�")
+    })
+    @GetMapping(value = "/selectDepFuzzy")
+    public ResponseMsg<List<IdNameEntity>> selectDepFuzzy(String name) {
+        try {
+            List<IdNameEntity> rs = baseQueryService.selectDepFuzzy(name);
+
+            return success(rs);
+        } catch (Exception ex) {
+            return fail(ex.getMessage(), null);
+        }
+    }
+
+    @SysLog()
+    @ApiOperation(value = "鏌ヨ鎵�鏈夎〃")
+    @GetMapping(value = "/selectTabs")
+    public ResponseMsg<List<TabEntity>> selectTabs() {
+        try {
+            List<TabEntity> list = baseQueryService.selectTabs();
+
+            return success(list);
+        } catch (Exception ex) {
+            return fail(ex.getMessage(), null);
+        }
+    }
+
+    @SysLog()
+    @ApiOperation(value = "鏌ヨ瀛楁淇℃伅")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "name", value = "鏄犲皠鍚嶇О", dataType = "String", paramType = "query", example = "dlgAgnp")
+    })
+    @GetMapping(value = "/selectFields")
+    public ResponseMsg<List<DictEntity>> selectFields(String name) {
+        try {
+            BasicMapper baseMapper = baseQueryService.getBasicMapper(name);
+            if (baseMapper == null) {
+                return fail("鏌ヨ瀵硅薄涓嶅瓨鍦�", null);
+            }
+
+            String tabName = baseQueryService.getTabName(baseMapper);
+            if (tabName == null) {
+                return null;
+            }
+
+            String[] strs = tabName.split(".");
+            List<DictEntity> list = baseQueryService.selectFields(strs[0], strs[1]);
+
+            return success(list);
+        } catch (Exception ex) {
+            return fail(ex.getMessage(), null);
+        }
+    }
+
+    @SysLog()
+    @ApiOperation(value = "鏌ヨ鍊煎煙淇℃伅")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "name", value = "鏄犲皠鍚嶇О", dataType = "String", paramType = "query", example = "dlgAgnp")
+    })
+    @GetMapping(value = "/selectDomains")
+    public ResponseMsg<List<DomainEntity>> selectDomains(String name) {
+        try {
+            BasicMapper baseMapper = baseQueryService.getBasicMapper(name);
+            if (baseMapper == null) {
+                return fail("鏌ヨ瀵硅薄涓嶅瓨鍦�", null);
+            }
+
+            String tabName = baseQueryService.getTabName(baseMapper);
+            if (tabName == null) {
+                return null;
+            }
+
+            String[] strs = tabName.split(".");
+            List<DomainEntity> list = baseQueryService.selectDomains(strs[0], strs[1]);
+
+            return success(list);
+        } catch (Exception ex) {
+            return fail(ex.getMessage(), null);
+        }
+    }
 }

--
Gitblit v1.9.3