yuqian 8 anos atrás
pai
commit
fc2a92f8a6

Diferenças do arquivo suprimidas por serem muito extensas
+ 1 - 1
CallCenterApi/CallCenterApi.DAL/T_Cus_CustomerBase.cs


+ 22 - 9
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/customer/CustomerController.cs

63
 
63
 
64
             //搜索
64
             //搜索
65
             List<string> customerIdList = new List<string>();
65
             List<string> customerIdList = new List<string>();
66
-            DataTable dt1 = null;
66
+            DataTable dt1 = new DataTable();
67
             if (!string.IsNullOrWhiteSpace(sb.ToString()))
67
             if (!string.IsNullOrWhiteSpace(sb.ToString()))
68
             {
68
             {
69
-                dt1 = DbHelperSQL.Query($"select F_CustomerId FROM T_Cus_CustomerExpand where {sql}  and  {sb.ToString()}").Tables[0];
69
+                dt1 = DbHelperSQL.Query($"select F_CustomerId FROM T_Cus_CustomerExpand where {sb.ToString()}").Tables[0];
70
 
70
 
71
             }
71
             }
72
             else
72
             else
73
             {
73
             {
74
-                dt1 = DbHelperSQL.Query($"select F_CustomerId FROM T_Cus_CustomerExpand where {sql}").Tables[0];
74
+                dt1 = DbHelperSQL.Query($"select F_CustomerId FROM T_Cus_CustomerExpand ").Tables[0];
75
             }
75
             }
76
 
76
 
77
             foreach (DataRow row in dt1.Rows)
77
             foreach (DataRow row in dt1.Rows)
79
                 customerIdList.Add(row["F_CustomerId"].ToString());
79
                 customerIdList.Add(row["F_CustomerId"].ToString());
80
             }
80
             }
81
             //获取主表数据
81
             //获取主表数据
82
-            var customerListAll = customerBaseBLL.DataTableToList(customerBaseBLL.GetList("").Tables[0]);
82
+            var customerListAll = customerBaseBLL.DataTableToList(customerBaseBLL.GetList(sql).Tables[0]);
83
             var customerList = customerListAll.Where(x => customerIdList.Contains(x.F_Id))
83
             var customerList = customerListAll.Where(x => customerIdList.Contains(x.F_Id))
84
-                .Skip(filter.PageIndex * filter.PageSize).Take(filter.PageSize).ToList();
84
+                .Skip((filter.PageIndex - 1) * filter.PageSize).Take(filter.PageSize).ToList();
85
 
85
 
86
             //获取主表数据ID
86
             //获取主表数据ID
87
             var customerIdArr = customerList.OrderByDescending(x => x.F_AddTime).Select(x => "'" + x.F_Id + "'").ToArray();
87
             var customerIdArr = customerList.OrderByDescending(x => x.F_AddTime).Select(x => "'" + x.F_Id + "'").ToArray();
88
-            //根据主表数据ID获取自定义字段数据
89
-            var customerExpandList = DbHelperSQL.Query($"select F_CustomerId, {string.Join(",", customerColumnArr)} from T_Cus_CustomerExpand where   F_CustomerId IN ({string.Join(",", customerIdArr)}) ").Tables[0];
90
-
91
-
88
+            DataTable customerExpandList = new DataTable();
89
+            if (customerIdArr.Length > 0)
90
+            {
91
+                //根据主表数据ID获取自定义字段数据
92
+                customerExpandList = DbHelperSQL.Query($"select F_CustomerId, {string.Join(",", customerColumnArr)} from T_Cus_CustomerExpand where   F_CustomerId IN ({string.Join(",", customerIdArr)}) ").Tables[0];
93
+            }
94
+            else
95
+            {
96
+                customerExpandList = DbHelperSQL.Query("SET FMTONLY ON;SELECT * FROM T_Cus_CustomerExpand ;SET FMTONLY OFF; ").Tables[0];
97
+            }
92
             //组织数据
98
             //组织数据
93
             List<CustomerDto> dataList = new List<CustomerDto>();
99
             List<CustomerDto> dataList = new List<CustomerDto>();
94
             foreach (var c in customerList)
100
             foreach (var c in customerList)
108
                         strList2.Add(e[0][item].ToString());
114
                         strList2.Add(e[0][item].ToString());
109
                     }
115
                     }
110
                 }
116
                 }
117
+                else
118
+                {
119
+                    foreach (var item in customerColumnArr)
120
+                    {
121
+                        strList2.Add("");
122
+                    }
123
+                }
111
 
124
 
112
                 strList1.AddRange(strList2);
125
                 strList1.AddRange(strList2);
113
                 model.dataarr = strList1;
126
                 model.dataarr = strList1;

+ 2 - 2
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Models/Filter/FilterCustomer.cs

15
         public int? CusType { get; set; }
15
         public int? CusType { get; set; }
16
         public string Remark { get; set; }
16
         public string Remark { get; set; }
17
         public int? YHFKId { get; set; }
17
         public int? YHFKId { get; set; }
18
-        public string[] Fields { get; set; }
19
-        public string[] FieldValues { get; set; }
18
+        public string[] Fields { get; set; } = { };
19
+        public string[] FieldValues { get; set; } = { };
20
 
20
 
21
     }
21
     }
22
 }
22
 }