Jelajahi Sumber

开户行查询接口增加地区和银行名称两个参数

lcl 1 tahun lalu
induk
melakukan
41769330de

+ 12 - 6
Areas/Api/Controllers/v1/MainServer/OpenBankTableController.cs

@@ -36,19 +36,25 @@ namespace MySystem.Areas.Api.Controllers.v1
         {
             JsonData data = JsonMapper.ToObject(value);
             string SearchKey = data["SearchKey"].ToString(); //搜索关键词
-            string Areas = data["Areas"].ToString();
-            string BankName = data["BankName"].ToString();
             int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
             int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
             IQueryable<OpenBankTable> query = maindb.OpenBankTable;
-            if(!string.IsNullOrEmpty(SearchKey))
+            if(!value.Contains("\"Areas\""))
             {
-                query = query.Where(m => m.BankName.Contains(Areas));
+                if(!string.IsNullOrEmpty(data["Areas"].ToString()))
+                {
+                    string Areas = data["Areas"].ToString();
+                    query = query.Where(m => m.BankName.Contains(Areas));
+                }
             }
-            if(!string.IsNullOrEmpty(SearchKey))
+            if(!value.Contains("\"BankName\""))
             {
-                query = query.Where(m => m.BankName.Contains(BankName));
+                if(!string.IsNullOrEmpty(data["BankName"].ToString()))
+                {
+                    string BankName = data["BankName"].ToString();
+                    query = query.Where(m => m.BankName.Contains(BankName));
+                }
             }
             if(!string.IsNullOrEmpty(SearchKey))
             {