From 40154d1c7f35eb62e19e1c5901cfb288213980e3 Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期三, 18 六月 2025 20:25:19 +0800
Subject: [PATCH] 添加通用查询方法(一次查询多表)

---
 WebAPI/Controllers/XSGL/Xs_SellOutBillList_SecController.cs |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/WebAPI/Controllers/XSGL/Xs_SellOutBillList_SecController.cs b/WebAPI/Controllers/XSGL/Xs_SellOutBillList_SecController.cs
index e6589be..7657c08 100644
--- a/WebAPI/Controllers/XSGL/Xs_SellOutBillList_SecController.cs
+++ b/WebAPI/Controllers/XSGL/Xs_SellOutBillList_SecController.cs
@@ -116,6 +116,62 @@
         }
         #endregion
 
+        #region 閫氱敤鏌ヨ鏂规硶(涓�娆℃煡璇㈠琛�)
+        [Route("CommonModel/searchMethodList")]
+        [HttpGet]
+        public object searchMethodList(string sql, string user, string ModRightNameCheck)
+        {
+            try
+            {
+
+                //鍒ゆ柇鏌ヨ鏉冮檺
+                if (ModRightNameCheck != null && ModRightNameCheck != "")
+                {
+                    if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, user))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鏃犳潈闄愭煡璇�!";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+
+                ds = oCN.RunProcReturn(sql, sql);
+                //鑾峰彇澶氫釜琛ㄥ垪鍚�
+                List<object> columnNameLists = new List<object>();
+                for (int i = 0; i < ds.Tables.Count; i++)
+                {
+                    //鑾峰彇鍒椾俊鎭�
+                    List<object> columnNameList = new List<object>(); //瀹氫箟澹版槑鍙橀噺 锛屾妸閫氳繃 new List<object>()鍒涘缓鐨� 瀹炰緥锛岃祴鍊肩粰鍙橀噺
+                    foreach (DataColumn col in ds.Tables[i].Columns)//閬嶅巻ds涓涓�涓〃锛圱ables[0]锛夌殑鎵�鏈夊垪锛圕olumns锛夋瘡娆″惊鐜腑锛宑ol鍙橀噺浼氭寔鏈夊綋鍓嶅垪鐨勫紩鐢�
+                    {
+                        Type dataType = col.DataType; //鑾峰彇褰撳墠鏁版嵁绫诲瀷浼犲叆 鑷畾涔夊彉閲廳atadataType
+                        string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; //瀛楃涓叉嫾鎺�         // 灏嗗垪鍚嶅拰鏁版嵁绫诲瀷淇℃伅鎷兼帴鎴愪竴涓狫SON鏍煎紡鐨勫瓧绗︿覆
+                        columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                    }
+                    columnNameLists.Add(columnNameList);
+                }
+                
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds;
+                objJsonResult.list = columnNameLists;//灏哻olumnNameList璧嬪�肩粰objJsonResult鐨刲ist灞炴��
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
         #region 鍔犲叆鍗曟嵁鍒板緟鏍搁攢闃熷垪
         [Route("Xs_SellOutBillList_Sec/addBillToWaitSecList")]
         [HttpGet]

--
Gitblit v1.9.1