空号不能重复判断

This commit is contained in:
何美荣 2026-04-16 10:09:31 +08:00
parent b2e17409a8
commit 67312a9ff7

View File

@ -557,14 +557,14 @@ namespace APT.FM.WebApi.Controllers.Api.FM
if (entity.Nav_Person.POST_ID == null) if (entity.Nav_Person.POST_ID == null)
{ {
throw new Exception("岗位不允许为空!"); throw new Exception("岗位不允许为空!");
} }
var isRepeat = allUsers.FirstOrDefault(t => t.CODE == entity.CODE);
if (isRepeat != null)
this.ThrowError("050001");
if (isAdd == null) if (isAdd == null)
{ {
userList = this.GetEntities<T_FM_USER>(t => (t.CODE == entity.CODE || t.APPROVE_ROLE_ID == entity.APPROVE_ROLE_ID) && t.ORG_ID == entity.ORG_ID, null, "Nav_Department").ToList(); userList = this.GetEntities<T_FM_USER>(t => (t.CODE == entity.CODE || t.APPROVE_ROLE_ID == entity.APPROVE_ROLE_ID) && t.ORG_ID == entity.ORG_ID, null, "Nav_Department").ToList();
var isRepeat = userList.FirstOrDefault(t => t.CODE == entity.CODE);
if (isRepeat != null)
this.ThrowError("050001");
if (entity.ORG_ID != Guid.Parse("b043b28b-bbc3-c452-6052-4fba1457abfa")) if (entity.ORG_ID != Guid.Parse("b043b28b-bbc3-c452-6052-4fba1457abfa"))
{ {
#region // #region //
@ -681,9 +681,9 @@ namespace APT.FM.WebApi.Controllers.Api.FM
{ {
dbRuleStr = string.Join(',', isAdd.Nav_BelongRoles.OrderBy(x => x.BELONG_ROLE_ID).Select(x => x.BELONG_ROLE_ID).Distinct().ToList()); dbRuleStr = string.Join(',', isAdd.Nav_BelongRoles.OrderBy(x => x.BELONG_ROLE_ID).Select(x => x.BELONG_ROLE_ID).Distinct().ToList());
userList = this.GetEntities<T_FM_USER>(t => (t.CODE == entity.CODE || t.APPROVE_ROLE_ID == entity.APPROVE_ROLE_ID) && t.ID != entity.ID && t.ORG_ID == entity.ORG_ID, null, "Nav_Department").ToList(); userList = this.GetEntities<T_FM_USER>(t => (t.CODE == entity.CODE || t.APPROVE_ROLE_ID == entity.APPROVE_ROLE_ID) && t.ID != entity.ID && t.ORG_ID == entity.ORG_ID, null, "Nav_Department").ToList();
var isRepeat = userList.FirstOrDefault(t => t.CODE == entity.CODE); //var isRepeat = userList.FirstOrDefault(t => t.CODE == entity.CODE);
if (isRepeat != null) //if (isRepeat != null)
this.ThrowError("050001"); // this.ThrowError("050001");
} }
if (entity.DEPARTMENT_ID == null) if (entity.DEPARTMENT_ID == null)
{ {