|
|
@@ -63,15 +63,15 @@ namespace CallCenterApi.Interface.Controllers.customer
|
|
63
|
63
|
|
|
64
|
64
|
//搜索
|
|
65
|
65
|
List<string> customerIdList = new List<string>();
|
|
66
|
|
- DataTable dt1 = null;
|
|
|
66
|
+ DataTable dt1 = new DataTable();
|
|
67
|
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
|
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
|
77
|
foreach (DataRow row in dt1.Rows)
|
|
|
@@ -79,16 +79,22 @@ namespace CallCenterApi.Interface.Controllers.customer
|
|
79
|
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
|
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
|
86
|
//获取主表数据ID
|
|
87
|
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
|
99
|
List<CustomerDto> dataList = new List<CustomerDto>();
|
|
94
|
100
|
foreach (var c in customerList)
|
|
|
@@ -108,6 +114,13 @@ namespace CallCenterApi.Interface.Controllers.customer
|
|
108
|
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
|
125
|
strList1.AddRange(strList2);
|
|
113
|
126
|
model.dataarr = strList1;
|