From e1e254787f8b9327a4ed47a7559d6b56db13c80b Mon Sep 17 00:00:00 2001
From: xing <xingjs@qq.com>
Date: 星期二, 21 二月 2023 14:52:22 +0800
Subject: [PATCH] 20230221@xingjs@提交官网一张图相关内容接口

---
 src/main/java/com/lf/server/controller/show/OneMapController.java |   12 ++++++++++++
 src/main/java/com/lf/server/mapper/show/OneMapMapper.java         |    8 ++++++++
 src/main/java/com/lf/server/service/show/OneMapService.java       |   11 +++++++++++
 src/main/resources/mapper/show/OneMapMapper.xml                   |   16 ++++++++++++++++
 4 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/lf/server/controller/show/OneMapController.java b/src/main/java/com/lf/server/controller/show/OneMapController.java
index 3cc217f..5a11ffe 100644
--- a/src/main/java/com/lf/server/controller/show/OneMapController.java
+++ b/src/main/java/com/lf/server/controller/show/OneMapController.java
@@ -10,6 +10,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 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 java.util.List;
@@ -174,5 +175,16 @@
         return success(resList);
     }*/
 
+    /**
+     * 鏍规嵁琛ㄥ悕鏌ヨ琛ㄥ瓧娈典俊鎭�
+     * Query table field information according to table name
+     */
+    @ApiOperation(value = "鏍规嵁琛ㄥ悕鏌ヨ琛ㄥ瓧娈典俊鎭�")
+    @GetMapping("/selectTableInfo")
+    public ResponseMsg<Object> selectTableInfo(@RequestParam("tableName") String tableName) {
+        List<String> resList = aMapOfPipelineService.queryTableInfo(tableName);
+        return success(resList);
+    }
+
 
 }
diff --git a/src/main/java/com/lf/server/mapper/show/OneMapMapper.java b/src/main/java/com/lf/server/mapper/show/OneMapMapper.java
index 97b506b..c66738a 100644
--- a/src/main/java/com/lf/server/mapper/show/OneMapMapper.java
+++ b/src/main/java/com/lf/server/mapper/show/OneMapMapper.java
@@ -1,6 +1,7 @@
 package com.lf.server.mapper.show;
 
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
@@ -81,4 +82,11 @@
      * @return {@link List}<{@link String}>
      */
     public List<String> countProjectType1();
+
+    /**
+     * 鏌ヨ琛ㄤ俊鎭�
+     *
+     * @return {@link List}<{@link String}>
+     */
+    public List<String> queryTableInfo(@Param("tableName") String tableName);
 }
diff --git a/src/main/java/com/lf/server/service/show/OneMapService.java b/src/main/java/com/lf/server/service/show/OneMapService.java
index 068cb41..d4f7371 100644
--- a/src/main/java/com/lf/server/service/show/OneMapService.java
+++ b/src/main/java/com/lf/server/service/show/OneMapService.java
@@ -110,4 +110,15 @@
     public List<String> countProjectType1() {
         return aMapOfPipelineMapper.countProjectType1();
     }
+
+
+    /**
+     * 鏌ヨ琛ㄤ俊鎭�
+     *
+     * @return {@link List}<{@link String}>
+     */
+    @Override
+    public List<String> queryTableInfo(String tableName) {
+        return aMapOfPipelineMapper.queryTableInfo(tableName);
+    }
 }
diff --git a/src/main/resources/mapper/show/OneMapMapper.xml b/src/main/resources/mapper/show/OneMapMapper.xml
index 2c2aa17..8ae6c87 100644
--- a/src/main/resources/mapper/show/OneMapMapper.xml
+++ b/src/main/resources/mapper/show/OneMapMapper.xml
@@ -66,6 +66,22 @@
     </select>
 
 
+    <!--  鏌ヨ琛ㄤ俊鎭�  -->
+    <select id="queryTableInfo" resultType="java.util.Map">
+        SELECT a.attnum,
+               a.attname,
+               concat_ws('',t.typname,SUBSTRING(format_type(a.atttypid,a.atttypmod)
+                                                FROM '\(.*\)')) AS type,d.description,typnotnull
+        FROM pg_class c,pg_attribute a,pg_type t,pg_description d
+        WHERE c.relname= '${tableName}'
+          AND a.attnum>0
+          AND a.attrelid=c.oid
+          AND a.atttypid=t.oid
+          AND d.objoid=a.attrelid
+          AND d.objsubid=a.attnum;
+    </select>
+
+
 
 
 

--
Gitblit v1.9.3