zhengbingbing лет назад: 7
Родитель
Сommit
e16cb295a2

+ 12 - 1
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/SysConfigController.cs

@@ -89,6 +89,8 @@ namespace CallCenterApi.Interface.Controllers
89 89
             if (Request.IsAuthenticated)
90 90
             {
91 91
                 var sysConfig = new Model.T_Sys_SystemConfig();
92
+                if (IsExistCode(input.Code, 0))
93
+                    return Error("参数名称不能重复,请修改后重新提交");
92 94
                 sysConfig.F_ParamCode = input.Code;
93 95
                 sysConfig.F_ParamValue = input.Value;
94 96
                 sysConfig.F_ParamDes = input.Des;
@@ -100,7 +102,14 @@ namespace CallCenterApi.Interface.Controllers
100 102
             }
101 103
             return res;
102 104
         }
103
-
105
+        private bool IsExistCode(string code, int id)
106
+        {
107
+            string sql = " and F_ParamCode='" + code + "'";
108
+            if (id > 0)
109
+                sql += " and F_ParamId <>" + id;
110
+            int c = sysConfigBLL.GetRecordCount(" 1=1 " + sql);
111
+            return c > 0;
112
+        }
104 113
         /// <summary>
105 114
         /// 修改基础数据
106 115
         /// </summary>
@@ -114,6 +123,8 @@ namespace CallCenterApi.Interface.Controllers
114 123
                 if (input.Id <= 0) return Error("不存在此条数据");
115 124
                 var sysConfig = sysConfigBLL.GetModel(input.Id);
116 125
                 if (sysConfig == null) return Error("不存在此条数据");
126
+                if (IsExistCode(input.Code, input.Id))
127
+                    return Error("参数名称不能重复,请修改后重新提交");
117 128
                 sysConfig.F_ParamCode = input.Code;
118 129
                 sysConfig.F_ParamValue = input.Value;
119 130
                 sysConfig.F_ParamDes = input.Des;

+ 7 - 4
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/UserAccountController.cs

@@ -188,7 +188,7 @@ namespace CallCenterApi.Interface.Controllers
188 188
                 Model.T_Sys_UserAccount userAccountModel = new Model.T_Sys_UserAccount();
189 189
                 if (input.Usercode != null)
190 190
                 {
191
-                    if(IsExistUsercode(input.Usercode))
191
+                    if(IsExistUsercode(input.Usercode,0))
192 192
                     {
193 193
                         return Error("已存在此工号,请重新输入!");
194 194
                     }
@@ -268,9 +268,12 @@ namespace CallCenterApi.Interface.Controllers
268 268
             return res;
269 269
         }
270 270
 
271
-        private bool IsExistUsercode(string usercode)
271
+        private bool IsExistUsercode(string usercode,int userid)
272 272
         {
273
-            int c=sysUserAccountBll.GetRecordCount(" F_UserCode='"+usercode+"'");
273
+            string sql = " and F_UserCode='" + usercode + "'";
274
+            if (userid > 0)
275
+                sql += " and F_UserId <>" + userid;
276
+            int c = sysUserAccountBll.GetRecordCount(" 1=1 " + sql);
274 277
             return c > 0;
275 278
         }
276 279
 
@@ -286,7 +289,7 @@ namespace CallCenterApi.Interface.Controllers
286 289
                     return Error("获取用户失败");
287 290
                 if (input.Usercode != null)
288 291
                 {
289
-                    if (IsExistUsercode(input.Usercode))
292
+                    if (IsExistUsercode(input.Usercode, input.UserId))
290 293
                     {
291 294
                         return Error("已存在此工号,请重新输入!");
292 295
                     }