From ef8f08ff763cae09314fa90e0582f8f120c62ff1 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期一, 31 七月 2023 10:51:40 +0800
Subject: [PATCH] #

---
 src/main/resources/datav/sql/1.sql                       |    1 +
 src/main/java/com/zy/crm/common/web/DatavController.java |   57 +++++++++++++++++++++++++++++++++------------------------
 src/main/resources/application.yml                       |    2 +-
 3 files changed, 35 insertions(+), 25 deletions(-)

diff --git a/src/main/java/com/zy/crm/common/web/DatavController.java b/src/main/java/com/zy/crm/common/web/DatavController.java
index 4994858..ee065f0 100644
--- a/src/main/java/com/zy/crm/common/web/DatavController.java
+++ b/src/main/java/com/zy/crm/common/web/DatavController.java
@@ -1,8 +1,13 @@
 package com.zy.crm.common.web;
 
 import com.core.common.R;
+import org.springframework.core.io.ClassPathResource;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.PostConstruct;
+import java.io.IOException;
+import java.io.InputStream;
 
 /**
  * Created by vincent on 2023/7/25
@@ -10,32 +15,36 @@
 @RestController
 public class DatavController {
 
+    private String sql1;
+
+    @PostConstruct
+    public void init() throws IOException {
+        this.sql1 = read(new ClassPathResource("datav/sql/1.sql").getInputStream());
+    }
+
     @GetMapping("/1test")
     public R test1() {
-        /**
-         * select
-         * (case  when A.org='1002208180000267' then '鍢夊杽'
-         *        when A.org='1002208180000506' then '骞垮痉'
-         * 	   else '' end) as 缁勭粐,
-         * A.DocNo as 鍗曞彿,A3.Code as 椤圭洰鍙�,
-         * (case  when A.DocState='0' then '寮�绔�'
-         *        when A.DocState='1' then '宸插鏍�'
-         * 	   when A.DocState='2' then '寮�宸�'
-         * 	   when A.DocState='3' then '瀹屽伐'
-         * 	   when A.DocState='4' then '鏍稿噯涓�'
-         * 	   ELSE''  end) as 鐘舵��,
-         * A.StartDate as 璁″垝寮�宸ユ棩,
-         * A.CompleteDate as 璁″垝瀹屽伐鏃�,A2.Code as 鏂欏彿,A2.name as 鍝佸悕,A2.SPECS as 瑙勬牸 , a.ProductQty as 鐢熶骇鏁伴噺,TotalCompleteQty as 瀹屽伐鏁伴噺
-         * from MO_MO as A
-         * left join CBO_ItemMaster as A2 on (A.ItemMaster = A2.ID)
-         * left join CBO_Project as A3 on (A.Project = A3.ID)
-         * where
-         * A.MODocType != '1002306121624435'  --杩囨护鍐呴儴鐮斿彂椤圭洰
-         * and A.IsWBSTask!=1                 --杩囨护鐜板満鏂藉伐浠诲姟
-         * and A.DocState != '3'              --杩囨护瀹屽伐鐘舵�佺殑璁㈠崟
-         * ORDER BY A.CompleteDate
-         */
-        return R.ok();
+        return R.ok(this.sql1);
+    }
+
+    public static String read(InputStream inputStream) {
+        StringBuilder stringBuilder = new StringBuilder();
+        byte[] buffer = new byte[1024];
+        try {
+            int bytesRead;
+            while ((bytesRead = inputStream.read(buffer)) != -1) {
+                stringBuilder.append(new String(buffer, 0, bytesRead));
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                inputStream.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return stringBuilder.toString();
     }
 
 }
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 29da18b..e941b4d 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -1,5 +1,5 @@
 server:
-  port: 9528
+  port: 9529
   servlet:
 #    context-path: /crm
     context-path:
diff --git a/src/main/resources/datav/sql/1.sql b/src/main/resources/datav/sql/1.sql
new file mode 100644
index 0000000..f2ba8f8
--- /dev/null
+++ b/src/main/resources/datav/sql/1.sql
@@ -0,0 +1 @@
+abc
\ No newline at end of file

--
Gitblit v1.9.1