duhongyu лет назад: 3
Родитель
Сommit
a2a7e05c00

+ 1 - 0
RMYY_CallCenter_Api.Bll/RMYY_CallCenter_Api.Bll.csproj

@@ -75,6 +75,7 @@
75 75
     <Compile Include="T_QC_IndexRes.cs" />
76 76
     <Compile Include="T_Sys_Accessories.cs" />
77 77
     <Compile Include="T_Sys_Class.cs" />
78
+    <Compile Include="T_Sys_CustomFiled.cs" />
78 79
     <Compile Include="T_Sys_Department.cs" />
79 80
     <Compile Include="T_Sys_DictionaryBase.cs" />
80 81
     <Compile Include="T_Sys_DictionaryValue.cs" />

+ 159 - 0
RMYY_CallCenter_Api.Bll/T_Sys_CustomFiled.cs

@@ -0,0 +1,159 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Data;
4
+using System.Linq;
5
+using System.Text;
6
+using System.Threading.Tasks;
7
+
8
+namespace RMYY_CallCenter_Api.Bll
9
+{
10
+    /// <summary>
11
+    /// T_Sys_CustomFiled
12
+    /// </summary>
13
+    public partial class T_Sys_CustomFiled
14
+    {
15
+        private readonly RMYY_CallCenter_Api.Dal .T_Sys_CustomFiled dal = new RMYY_CallCenter_Api.Dal.T_Sys_CustomFiled();
16
+        public T_Sys_CustomFiled()
17
+        { }
18
+        #region  BasicMethod
19
+
20
+        /// <summary>
21
+        /// 得到最大ID
22
+        /// </summary>
23
+        public int GetMaxId()
24
+        {
25
+            return dal.GetMaxId();
26
+        }
27
+
28
+        /// <summary>
29
+        /// 是否存在该记录
30
+        /// </summary>
31
+        public bool Exists(int F_Id)
32
+        {
33
+            return dal.Exists(F_Id);
34
+        }
35
+
36
+        /// <summary>
37
+        /// 增加一条数据
38
+        /// </summary>
39
+        public int Add(RMYY_CallCenter_Api.Model.T_Sys_CustomFiled model)
40
+        {
41
+            return dal.Add(model);
42
+        }
43
+
44
+        /// <summary>
45
+        /// 更新一条数据
46
+        /// </summary>
47
+        public bool Update(RMYY_CallCenter_Api.Model.T_Sys_CustomFiled model)
48
+        {
49
+            return dal.Update(model);
50
+        }
51
+
52
+        /// <summary>
53
+        /// 删除一条数据
54
+        /// </summary>
55
+        public bool Delete(int F_Id)
56
+        {
57
+
58
+            return dal.Delete(F_Id);
59
+        }
60
+        /// <summary>
61
+        /// 删除一条数据
62
+        /// </summary>
63
+        public bool DeleteList(string F_Idlist)
64
+        {
65
+            return dal.DeleteList(F_Idlist);
66
+        }
67
+
68
+        /// <summary>
69
+        /// 得到一个对象实体
70
+        /// </summary>
71
+        public RMYY_CallCenter_Api.Model.T_Sys_CustomFiled GetModel(int F_Id)
72
+        {
73
+
74
+            return dal.GetModel(F_Id);
75
+        }
76
+
77
+        /// <summary>
78
+       
79
+
80
+        /// <summary>
81
+        /// 获得数据列表
82
+        /// </summary>
83
+        public DataSet GetList(string strWhere)
84
+        {
85
+            return dal.GetList(strWhere);
86
+        }
87
+        /// <summary>
88
+        /// 获得前几行数据
89
+        /// </summary>
90
+        public DataSet GetList(int Top, string strWhere, string filedOrder)
91
+        {
92
+            return dal.GetList(Top, strWhere, filedOrder);
93
+        }
94
+        /// <summary>
95
+        /// 获得数据列表
96
+        /// </summary>
97
+        public List<RMYY_CallCenter_Api.Model.T_Sys_CustomFiled> GetModelList(string strWhere)
98
+        {
99
+            DataSet ds = dal.GetList(strWhere);
100
+            return DataTableToList(ds.Tables[0]);
101
+        }
102
+        /// <summary>
103
+        /// 获得数据列表
104
+        /// </summary>
105
+        public List<RMYY_CallCenter_Api.Model.T_Sys_CustomFiled> DataTableToList(DataTable dt)
106
+        {
107
+            List<RMYY_CallCenter_Api.Model.T_Sys_CustomFiled> modelList = new List<RMYY_CallCenter_Api.Model.T_Sys_CustomFiled>();
108
+            int rowsCount = dt.Rows.Count;
109
+            if (rowsCount > 0)
110
+            {
111
+                RMYY_CallCenter_Api.Model.T_Sys_CustomFiled model;
112
+                for (int n = 0; n < rowsCount; n++)
113
+                {
114
+                    model = dal.DataRowToModel(dt.Rows[n]);
115
+                    if (model != null)
116
+                    {
117
+                        modelList.Add(model);
118
+                    }
119
+                }
120
+            }
121
+            return modelList;
122
+        }
123
+
124
+        /// <summary>
125
+        /// 获得数据列表
126
+        /// </summary>
127
+        public DataSet GetAllList()
128
+        {
129
+            return GetList("");
130
+        }
131
+
132
+        /// <summary>
133
+        /// 分页获取数据列表
134
+        /// </summary>
135
+        public int GetRecordCount(string strWhere)
136
+        {
137
+            return dal.GetRecordCount(strWhere);
138
+        }
139
+        /// <summary>
140
+        /// 分页获取数据列表
141
+        /// </summary>
142
+        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
143
+        {
144
+            return dal.GetListByPage(strWhere, orderby, startIndex, endIndex);
145
+        }
146
+        /// <summary>
147
+        /// 分页获取数据列表
148
+        /// </summary>
149
+        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
150
+        //{
151
+        //return dal.GetList(PageSize,PageIndex,strWhere);
152
+        //}
153
+
154
+        #endregion  BasicMethod
155
+        #region  ExtensionMethod
156
+
157
+        #endregion  ExtensionMethod
158
+    }
159
+}

+ 1 - 0
RMYY_CallCenter_Api.Dal/RMYY_CallCenter_Api.Dal.csproj

@@ -73,6 +73,7 @@
73 73
     <Compile Include="T_QC_IndexRes.cs" />
74 74
     <Compile Include="T_Sys_Accessories.cs" />
75 75
     <Compile Include="T_Sys_Class.cs" />
76
+    <Compile Include="T_Sys_CustomFiled.cs" />
76 77
     <Compile Include="T_Sys_Department.cs" />
77 78
     <Compile Include="T_Sys_DictionaryBase.cs" />
78 79
     <Compile Include="T_Sys_DictionaryValue.cs" />

+ 337 - 0
RMYY_CallCenter_Api.Dal/T_Sys_CustomFiled.cs

@@ -0,0 +1,337 @@
1
+using RMYY_CallCenter_Api.DB;
2
+using System;
3
+using System.Collections.Generic;
4
+using System.Data;
5
+using System.Data.SqlClient;
6
+using System.Linq;
7
+using System.Text;
8
+using System.Threading.Tasks;
9
+
10
+namespace RMYY_CallCenter_Api.Dal
11
+{
12
+    /// <summary>
13
+    /// 数据访问类:T_Sys_CustomFiled
14
+    /// </summary>
15
+    public partial class T_Sys_CustomFiled
16
+    {
17
+        public T_Sys_CustomFiled()
18
+        { }
19
+        #region  BasicMethod
20
+
21
+        /// <summary>
22
+        /// 得到最大ID
23
+        /// </summary>
24
+        public int GetMaxId()
25
+        {
26
+            return DbHelperSQL.GetMaxID("F_Id", "T_Sys_CustomFiled");
27
+        }
28
+
29
+        /// <summary>
30
+        /// 是否存在该记录
31
+        /// </summary>
32
+        public bool Exists(int F_Id)
33
+        {
34
+            StringBuilder strSql = new StringBuilder();
35
+            strSql.Append("select count(1) from T_Sys_CustomFiled");
36
+            strSql.Append(" where F_Id=SQL2012F_Id");
37
+            SqlParameter[] parameters = {
38
+                    new SqlParameter("SQL2012F_Id", SqlDbType.Int,4)
39
+            };
40
+            parameters[0].Value = F_Id;
41
+
42
+            return DbHelperSQL.Exists(strSql.ToString(), parameters);
43
+        }
44
+
45
+
46
+        /// <summary>
47
+        /// 增加一条数据
48
+        /// </summary>
49
+        public int Add(RMYY_CallCenter_Api.Model.T_Sys_CustomFiled model)
50
+        {
51
+            StringBuilder strSql = new StringBuilder();
52
+            strSql.Append("insert into T_Sys_CustomFiled(");
53
+            strSql.Append("F_TableId,F_Fileds,F_FiledNames,F_CreateUser,F_CreateTime)");
54
+            strSql.Append(" values (");
55
+            strSql.Append("SQL2012F_TableId,SQL2012F_Fileds,SQL2012F_FiledNames,SQL2012F_CreateUser,SQL2012F_CreateTime)");
56
+            strSql.Append(";select @@IDENTITY");
57
+            SqlParameter[] parameters = {
58
+                    new SqlParameter("SQL2012F_TableId", SqlDbType.NVarChar,50),
59
+                    new SqlParameter("SQL2012F_Fileds", SqlDbType.NVarChar,-1),
60
+                    new SqlParameter("SQL2012F_FiledNames", SqlDbType.NVarChar,-1),
61
+                    new SqlParameter("SQL2012F_CreateUser", SqlDbType.NVarChar,50),
62
+                    new SqlParameter("SQL2012F_CreateTime", SqlDbType.DateTime)};
63
+            parameters[0].Value = model.F_TableId;
64
+            parameters[1].Value = model.F_Fileds;
65
+            parameters[2].Value = model.F_FiledNames;
66
+            parameters[3].Value = model.F_CreateUser;
67
+            parameters[4].Value = model.F_CreateTime;
68
+
69
+            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
70
+            if (obj == null)
71
+            {
72
+                return 0;
73
+            }
74
+            else
75
+            {
76
+                return Convert.ToInt32(obj);
77
+            }
78
+        }
79
+        /// <summary>
80
+        /// 更新一条数据
81
+        /// </summary>
82
+        public bool Update(RMYY_CallCenter_Api.Model.T_Sys_CustomFiled model)
83
+        {
84
+            StringBuilder strSql = new StringBuilder();
85
+            strSql.Append("update T_Sys_CustomFiled set ");
86
+            strSql.Append("F_TableId=SQL2012F_TableId,");
87
+            strSql.Append("F_Fileds=SQL2012F_Fileds,");
88
+            strSql.Append("F_FiledNames=SQL2012F_FiledNames,");
89
+            strSql.Append("F_CreateUser=SQL2012F_CreateUser,");
90
+            strSql.Append("F_CreateTime=SQL2012F_CreateTime");
91
+            strSql.Append(" where F_Id=SQL2012F_Id");
92
+            SqlParameter[] parameters = {
93
+                    new SqlParameter("SQL2012F_TableId", SqlDbType.NVarChar,50),
94
+                    new SqlParameter("SQL2012F_Fileds", SqlDbType.NVarChar,-1),
95
+                    new SqlParameter("SQL2012F_FiledNames", SqlDbType.NVarChar,-1),
96
+                    new SqlParameter("SQL2012F_CreateUser", SqlDbType.NVarChar,50),
97
+                    new SqlParameter("SQL2012F_CreateTime", SqlDbType.DateTime),
98
+                    new SqlParameter("SQL2012F_Id", SqlDbType.Int,4)};
99
+            parameters[0].Value = model.F_TableId;
100
+            parameters[1].Value = model.F_Fileds;
101
+            parameters[2].Value = model.F_FiledNames;
102
+            parameters[3].Value = model.F_CreateUser;
103
+            parameters[4].Value = model.F_CreateTime;
104
+            parameters[5].Value = model.F_Id;
105
+
106
+            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
107
+            if (rows > 0)
108
+            {
109
+                return true;
110
+            }
111
+            else
112
+            {
113
+                return false;
114
+            }
115
+        }
116
+
117
+        /// <summary>
118
+        /// 删除一条数据
119
+        /// </summary>
120
+        public bool Delete(int F_Id)
121
+        {
122
+
123
+            StringBuilder strSql = new StringBuilder();
124
+            strSql.Append("delete from T_Sys_CustomFiled ");
125
+            strSql.Append(" where F_Id=SQL2012F_Id");
126
+            SqlParameter[] parameters = {
127
+                    new SqlParameter("SQL2012F_Id", SqlDbType.Int,4)
128
+            };
129
+            parameters[0].Value = F_Id;
130
+
131
+            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
132
+            if (rows > 0)
133
+            {
134
+                return true;
135
+            }
136
+            else
137
+            {
138
+                return false;
139
+            }
140
+        }
141
+        /// <summary>
142
+        /// 批量删除数据
143
+        /// </summary>
144
+        public bool DeleteList(string F_Idlist)
145
+        {
146
+            StringBuilder strSql = new StringBuilder();
147
+            strSql.Append("delete from T_Sys_CustomFiled ");
148
+            strSql.Append(" where F_Id in (" + F_Idlist + ")  ");
149
+            int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
150
+            if (rows > 0)
151
+            {
152
+                return true;
153
+            }
154
+            else
155
+            {
156
+                return false;
157
+            }
158
+        }
159
+
160
+
161
+        /// <summary>
162
+        /// 得到一个对象实体
163
+        /// </summary>
164
+        public RMYY_CallCenter_Api.Model.T_Sys_CustomFiled GetModel(int F_Id)
165
+        {
166
+
167
+            StringBuilder strSql = new StringBuilder();
168
+            strSql.Append("select  top 1 F_Id,F_TableId,F_Fileds,F_FiledNames,F_CreateUser,F_CreateTime from T_Sys_CustomFiled ");
169
+            strSql.Append(" where F_Id=SQL2012F_Id");
170
+            SqlParameter[] parameters = {
171
+                    new SqlParameter("SQL2012F_Id", SqlDbType.Int,4)
172
+            };
173
+            parameters[0].Value = F_Id;
174
+
175
+            RMYY_CallCenter_Api.Model.T_Sys_CustomFiled model = new RMYY_CallCenter_Api.Model.T_Sys_CustomFiled();
176
+            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
177
+            if (ds.Tables[0].Rows.Count > 0)
178
+            {
179
+                return DataRowToModel(ds.Tables[0].Rows[0]);
180
+            }
181
+            else
182
+            {
183
+                return null;
184
+            }
185
+        }
186
+
187
+
188
+        /// <summary>
189
+        /// 得到一个对象实体
190
+        /// </summary>
191
+        public RMYY_CallCenter_Api.Model.T_Sys_CustomFiled DataRowToModel(DataRow row)
192
+        {
193
+            RMYY_CallCenter_Api.Model.T_Sys_CustomFiled model = new RMYY_CallCenter_Api.Model.T_Sys_CustomFiled();
194
+            if (row != null)
195
+            {
196
+                if (row["F_Id"] != null && row["F_Id"].ToString() != "")
197
+                {
198
+                    model.F_Id = int.Parse(row["F_Id"].ToString());
199
+                }
200
+                if (row["F_TableId"] != null)
201
+                {
202
+                    model.F_TableId = row["F_TableId"].ToString();
203
+                }
204
+                if (row["F_Fileds"] != null)
205
+                {
206
+                    model.F_Fileds = row["F_Fileds"].ToString();
207
+                }
208
+                if (row["F_FiledNames"] != null)
209
+                {
210
+                    model.F_FiledNames = row["F_FiledNames"].ToString();
211
+                }
212
+                if (row["F_CreateUser"] != null)
213
+                {
214
+                    model.F_CreateUser = row["F_CreateUser"].ToString();
215
+                }
216
+                if (row["F_CreateTime"] != null && row["F_CreateTime"].ToString() != "")
217
+                {
218
+                    model.F_CreateTime = DateTime.Parse(row["F_CreateTime"].ToString());
219
+                }
220
+            }
221
+            return model;
222
+        }
223
+
224
+        /// <summary>
225
+        /// 获得数据列表
226
+        /// </summary>
227
+        public DataSet GetList(string strWhere)
228
+        {
229
+            StringBuilder strSql = new StringBuilder();
230
+            strSql.Append("select F_Id,F_TableId,F_Fileds,F_FiledNames,F_CreateUser,F_CreateTime ");
231
+            strSql.Append(" FROM T_Sys_CustomFiled ");
232
+            if (strWhere.Trim() != "")
233
+            {
234
+                strSql.Append(" where " + strWhere);
235
+            }
236
+            return DbHelperSQL.Query(strSql.ToString());
237
+        }
238
+
239
+        /// <summary>
240
+        /// 获得前几行数据
241
+        /// </summary>
242
+        public DataSet GetList(int Top, string strWhere, string filedOrder)
243
+        {
244
+            StringBuilder strSql = new StringBuilder();
245
+            strSql.Append("select ");
246
+            if (Top > 0)
247
+            {
248
+                strSql.Append(" top " + Top.ToString());
249
+            }
250
+            strSql.Append(" F_Id,F_TableId,F_Fileds,F_FiledNames,F_CreateUser,F_CreateTime ");
251
+            strSql.Append(" FROM T_Sys_CustomFiled ");
252
+            if (strWhere.Trim() != "")
253
+            {
254
+                strSql.Append(" where " + strWhere);
255
+            }
256
+            strSql.Append(" order by " + filedOrder);
257
+            return DbHelperSQL.Query(strSql.ToString());
258
+        }
259
+
260
+        /// <summary>
261
+        /// 获取记录总数
262
+        /// </summary>
263
+        public int GetRecordCount(string strWhere)
264
+        {
265
+            StringBuilder strSql = new StringBuilder();
266
+            strSql.Append("select count(1) FROM T_Sys_CustomFiled ");
267
+            if (strWhere.Trim() != "")
268
+            {
269
+                strSql.Append(" where " + strWhere);
270
+            }
271
+            object obj = DbHelperSQL.GetSingle(strSql.ToString());
272
+            if (obj == null)
273
+            {
274
+                return 0;
275
+            }
276
+            else
277
+            {
278
+                return Convert.ToInt32(obj);
279
+            }
280
+        }
281
+        /// <summary>
282
+        /// 分页获取数据列表
283
+        /// </summary>
284
+        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
285
+        {
286
+            StringBuilder strSql = new StringBuilder();
287
+            strSql.Append("SELECT * FROM ( ");
288
+            strSql.Append(" SELECT ROW_NUMBER() OVER (");
289
+            if (!string.IsNullOrEmpty(orderby.Trim()))
290
+            {
291
+                strSql.Append("order by T." + orderby);
292
+            }
293
+            else
294
+            {
295
+                strSql.Append("order by T.F_Id desc");
296
+            }
297
+            strSql.Append(")AS Row, T.*  from T_Sys_CustomFiled T ");
298
+            if (!string.IsNullOrEmpty(strWhere.Trim()))
299
+            {
300
+                strSql.Append(" WHERE " + strWhere);
301
+            }
302
+            strSql.Append(" ) TT");
303
+            strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
304
+            return DbHelperSQL.Query(strSql.ToString());
305
+        }
306
+
307
+        /*
308
+		/// <summary>
309
+		/// 分页获取数据列表
310
+		/// </summary>
311
+		public DataSet GetList(int PageSize,int PageIndex,string strWhere)
312
+		{
313
+			SqlParameter[] parameters = {
314
+					new SqlParameter("SQL2012tblName", SqlDbType.VarChar, 255),
315
+					new SqlParameter("SQL2012fldName", SqlDbType.VarChar, 255),
316
+					new SqlParameter("SQL2012PageSize", SqlDbType.Int),
317
+					new SqlParameter("SQL2012PageIndex", SqlDbType.Int),
318
+					new SqlParameter("SQL2012IsReCount", SqlDbType.Bit),
319
+					new SqlParameter("SQL2012OrderType", SqlDbType.Bit),
320
+					new SqlParameter("SQL2012strWhere", SqlDbType.VarChar,1000),
321
+					};
322
+			parameters[0].Value = "T_Sys_CustomFiled";
323
+			parameters[1].Value = "F_Id";
324
+			parameters[2].Value = PageSize;
325
+			parameters[3].Value = PageIndex;
326
+			parameters[4].Value = 0;
327
+			parameters[5].Value = 0;
328
+			parameters[6].Value = strWhere;	
329
+			return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
330
+		}*/
331
+
332
+        #endregion  BasicMethod
333
+        #region  ExtensionMethod
334
+
335
+        #endregion  ExtensionMethod
336
+    }
337
+}

+ 1 - 0
RMYY_CallCenter_Api.Model/RMYY_CallCenter_Api.Model.csproj

@@ -74,6 +74,7 @@
74 74
     <Compile Include="T_QC_IndexRes.cs" />
75 75
     <Compile Include="T_Sys_Accessories.cs" />
76 76
     <Compile Include="T_Sys_Class.cs" />
77
+    <Compile Include="T_Sys_CustomFiled.cs" />
77 78
     <Compile Include="T_Sys_Department.cs" />
78 79
     <Compile Include="T_Sys_DictionaryBase.cs" />
79 80
     <Compile Include="T_Sys_DictionaryValue.cs" />

+ 75 - 0
RMYY_CallCenter_Api.Model/T_Sys_CustomFiled.cs

@@ -0,0 +1,75 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace RMYY_CallCenter_Api.Model
8
+{
9
+    /// <summary>
10
+    /// T_Sys_CustomFiled:实体类(属性说明自动提取数据库字段的描述信息)
11
+    /// </summary>
12
+    [Serializable]
13
+    public partial class T_Sys_CustomFiled
14
+    {
15
+        public T_Sys_CustomFiled()
16
+        { }
17
+        #region Model
18
+        private int _f_id;
19
+        private string _f_tableid;
20
+        private string _f_fileds;
21
+        private string _f_filednames;
22
+        private string _f_createuser;
23
+        private DateTime? _f_createtime;
24
+        /// <summary>
25
+        /// id
26
+        /// </summary>
27
+        public int F_Id
28
+        {
29
+            set { _f_id = value; }
30
+            get { return _f_id; }
31
+        }
32
+        /// <summary>
33
+        /// 自定义列表id
34
+        /// </summary>
35
+        public string F_TableId
36
+        {
37
+            set { _f_tableid = value; }
38
+            get { return _f_tableid; }
39
+        }
40
+        /// <summary>
41
+        /// 自定义列
42
+        /// </summary>
43
+        public string F_Fileds
44
+        {
45
+            set { _f_fileds = value; }
46
+            get { return _f_fileds; }
47
+        }
48
+        /// <summary>
49
+        /// 自定义列名
50
+        /// </summary>
51
+        public string F_FiledNames
52
+        {
53
+            set { _f_filednames = value; }
54
+            get { return _f_filednames; }
55
+        }
56
+        /// <summary>
57
+        /// 创建人
58
+        /// </summary>
59
+        public string F_CreateUser
60
+        {
61
+            set { _f_createuser = value; }
62
+            get { return _f_createuser; }
63
+        }
64
+        /// <summary>
65
+        /// 创建时间
66
+        /// </summary>
67
+        public DateTime? F_CreateTime
68
+        {
69
+            set { _f_createtime = value; }
70
+            get { return _f_createtime; }
71
+        }
72
+        #endregion Model
73
+
74
+    }
75
+}

+ 168 - 0
RMYY_CallCenter_Api/Controllers/CustomFiledController.cs

@@ -0,0 +1,168 @@
1
+using RMYY_CallCenter_Api.Utility;
2
+using System;
3
+using System.Collections.Generic;
4
+using System.Data;
5
+using System.Linq;
6
+using System.Web;
7
+using System.Web.Mvc;
8
+
9
+namespace RMYY_CallCenter_Api.Controllers
10
+{
11
+    public class CustomFiledController : BaseController
12
+    {
13
+        /// <summary>
14
+        /// 添加自定义显示列
15
+        /// </summary>
16
+        /// <param name="input"></param>
17
+        /// <returns></returns>
18
+        [HttpPost]
19
+        public ActionResult AddFiled()
20
+        {
21
+
22
+            int id = RequestString.GetInt("id", 0);
23
+            string TableId = RequestString.GetFormString("TableId");
24
+            string Fileds = RequestString.GetFormString("Fileds");
25
+            string FiledNames = RequestString.GetFormString("FiledNames");
26
+            Model.T_Sys_CustomFiled dModel = new Model.T_Sys_CustomFiled();
27
+            if (id == 0)
28
+            {
29
+                var list = new Bll.T_Sys_CustomFiled().GetModelList(" F_CreateUser='" + User .F_UserCode  + "' and F_TableId='"+ TableId + "' ");
30
+                if (list!=null&&list.Count > 0)
31
+                {
32
+                    dModel = list.FirstOrDefault();
33
+                    dModel.F_TableId = TableId;
34
+                    dModel.F_Fileds = Fileds;
35
+                    dModel.F_FiledNames = FiledNames;
36
+                    dModel.F_CreateUser = User.F_UserCode;
37
+                    dModel.F_CreateTime = DateTime.Now;
38
+                    int n = new Bll.T_Sys_CustomFiled().Add(dModel);
39
+                    if (new Bll.T_Sys_CustomFiled().Update(dModel))
40
+                        return Success("修改成功");
41
+                    else
42
+                        return Error("修改失败");
43
+                }
44
+                else
45
+                {
46
+                    dModel.F_TableId = TableId;
47
+                    dModel.F_Fileds = Fileds;
48
+                    dModel.F_FiledNames = FiledNames;
49
+                    dModel.F_CreateUser = User.F_UserCode;
50
+                    dModel.F_CreateTime = DateTime.Now;
51
+                    int n = new Bll.T_Sys_CustomFiled().Add(dModel);
52
+                    if (n > 0)
53
+                        return Success("添加成功", n);
54
+                    else
55
+                        return Error("添加失败");
56
+                }
57
+            }
58
+            else
59
+            {
60
+                dModel = new Bll.T_Sys_CustomFiled().GetModel(id);
61
+                if (dModel != null)
62
+                {
63
+                    dModel.F_TableId = TableId;
64
+                    dModel.F_Fileds = Fileds;
65
+                    dModel.F_FiledNames = FiledNames;
66
+                    dModel.F_CreateUser = User.F_UserCode;
67
+                    dModel.F_CreateTime = DateTime.Now;
68
+                    int n = new Bll.T_Sys_CustomFiled().Add(dModel);
69
+                    if (new Bll.T_Sys_CustomFiled().Update(dModel))
70
+                        return Success("修改成功");
71
+                    else
72
+                        return Error("修改失败");
73
+                }
74
+                else
75
+                {
76
+                    return Error("修改失败");
77
+                }
78
+            }
79
+        }
80
+
81
+
82
+        /// <summary>
83
+        /// 删除
84
+        /// </summary>
85
+        /// <param name="ids"></param>
86
+        /// <returns></returns>
87
+        public ActionResult Del(string TableId)
88
+        {
89
+            if (string .IsNullOrEmpty ( TableId) )
90
+            {
91
+                return Error("请选择要删除的自定义列");
92
+            }
93
+            var modellist = new Bll.T_Sys_CustomFiled().GetModelList("F_CreateUser='" + User.F_UserCode + "' and F_TableId='" + TableId + "'");
94
+            if (modellist!=null&& modellist.Count >0)
95
+            {
96
+                var n = new Bll.T_Sys_CustomFiled().DeleteList(string.Join(",", modellist.Select(x => x.F_Id)));
97
+                if (n)
98
+                    return Success("删除成功");
99
+            }
100
+            else
101
+            {
102
+                return Error("该自定义列不存在");
103
+            }
104
+         
105
+            return Error("删除失败");
106
+        }
107
+
108
+
109
+        /// <summary>
110
+        /// 获取自定义列
111
+        /// </summary>
112
+        /// <param name="ids"></param>
113
+        /// <returns></returns>
114
+        public ActionResult GetTab(string TableId)
115
+        {
116
+            if (string.IsNullOrEmpty(TableId))
117
+            {
118
+                return Error("请选择自定义列");
119
+            }
120
+            var modellist = new Bll.T_Sys_CustomFiled().GetModelList("F_CreateUser='" + User.F_UserCode + "' and F_TableId='" + TableId + "'");
121
+            if (modellist != null && modellist.Count > 0)
122
+            {
123
+                return Success("获取成功", modellist.FirstOrDefault());
124
+            }
125
+            else
126
+            {
127
+                return Error("该自定义列不存在");
128
+            }
129
+
130
+           
131
+        }
132
+
133
+        /// <summary>
134
+        /// 导出公共方法
135
+        /// </summary>
136
+        /// <param name="Name"></param>
137
+        /// <param name="TableId"></param>
138
+        /// <param name="dt"></param>
139
+        /// <param name="usercode"></param>
140
+        /// <returns></returns>
141
+        public bool ExportToExcel(string Name,string TableId, DataTable dt,string usercode)
142
+        {
143
+            var modellist = new Bll.T_Sys_CustomFiled().GetModelList("F_CreateUser='" + usercode + "' and F_TableId='" + TableId + "'");
144
+
145
+            if (modellist != null && modellist.Count > 0) { }
146
+            else
147
+            {
148
+                modellist= new Bll.T_Sys_CustomFiled().GetModelList("F_CreateUser='系统默认' and F_TableId='" + TableId + "'");
149
+               
150
+            }
151
+            if(modellist!=null && modellist.Count > 0)
152
+            {
153
+                string[] cols = modellist.FirstOrDefault().F_FiledNames.Split(',');
154
+                DataTable newTable = dt.DefaultView.ToTable(false, modellist.FirstOrDefault().F_Fileds.Split(','));
155
+                var npoi = new NPOIHelper().ExportToExcel(Name, newTable, cols);
156
+                if (npoi == "")
157
+                    return true;
158
+                else
159
+                    return false;
160
+            }
161
+            else
162
+            {
163
+                return false;
164
+            }
165
+        }
166
+
167
+    }
168
+}

+ 2 - 0
RMYY_CallCenter_Api/RMYY_CallCenter_Api.csproj

@@ -135,6 +135,7 @@
135 135
     <Compile Include="Controllers\CarManage\T_Car_MessageController.cs" />
136 136
     <Compile Include="Controllers\CarManage\T_Car_WorkOrderController.cs" />
137 137
     <Compile Include="Controllers\ClassController.cs" />
138
+    <Compile Include="Controllers\CustomFiledController.cs" />
138 139
     <Compile Include="Controllers\FaultRepairController.cs" />
139 140
     <Compile Include="Controllers\GroupClassController.cs" />
140 141
     <Compile Include="Controllers\information\NoticeController.cs" />
@@ -221,6 +222,7 @@
221 222
   </ItemGroup>
222 223
   <ItemGroup>
223 224
     <Folder Include="App_Data\" />
225
+    <Folder Include="Views\CustomFiled\" />
224 226
     <Folder Include="Views\WorkOrderBase\" />
225 227
   </ItemGroup>
226 228
   <ItemGroup>