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 |  116 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 111 insertions(+), 5 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 a1d5a1e..1c9ac49 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,10 @@
 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.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;
@@ -118,14 +122,14 @@
     }
 
     @SysLog()
-    @ApiOperation(value = "妯$硦鎼滅储")
+    @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 = "/selectFuzzy")
-    public ResponseMsg<List<String>> selectFuzzy(String name, String field, String value) {
+    @GetMapping(value = "/selectFieldFuzzy")
+    public ResponseMsg<List<String>> selectFieldFuzzy(String name, String field, String value) {
         try {
             BasicMapper baseMapper = baseQueryService.getBasicMapper(name);
             if (baseMapper == null) {
@@ -139,13 +143,115 @@
             if (StringHelper.isEmpty(field) || StringHelper.isSqlInjection(field)) {
                 return fail("鏌ヨ瀛楁涓嶆纭�", null);
             }
+            if (!StringHelper.isEmpty(value)) {
+                value = value.trim().replace("'", "");
+            }
 
-            value = value == null ? StringHelper.getLikeStr("") : StringHelper.getLikeStr(value.replace("'", ""));
-            List<String> rs = baseMapper.selectFuzzy(tab, field, value);
+            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