update 完成片区新增

This commit is contained in:
2021-06-01 10:54:07 +08:00
parent 08e4573e19
commit 483b15c013
17 changed files with 756 additions and 75 deletions

View File

@@ -28,6 +28,11 @@ namespace Ewide.Core.Service
/// </summary>
public string Value { get; set; }
/// <summary>
/// 类型
/// </summary>
public int Type { get; set; }
/// <summary>
/// 排序,越小优先级越高
/// </summary>

View File

@@ -125,12 +125,10 @@ namespace Ewide.Core.Service
[HttpPost("/sysOrg/add")]
public async Task AddOrg(AddOrgInput input)
{
if (!string.IsNullOrEmpty(input.Code))
{
var isExist = await _sysOrgRep.DetachedEntities.AnyAsync(u => u.Code == input.Code);
if (isExist)
throw Oops.Oh(ErrorCode.D2002);
}
var isExist = await _sysOrgRep.DetachedEntities
.AnyAsync(u => (u.Pid == input.Pid && u.Name == input.Name) || (!string.IsNullOrEmpty(input.Code) && u.Code == input.Code));
if (isExist)
throw Oops.Oh(ErrorCode.D2002);
if (!_userManager.SuperAdmin)
{
@@ -239,12 +237,10 @@ namespace Ewide.Core.Service
if (!_userManager.SuperAdmin && (dataScopes.Count < 1 || !dataScopes.Contains(sysOrg.Id)))
throw Oops.Oh(ErrorCode.D2003);
if (!string.IsNullOrEmpty(input.Code))
{
var isExist = await _sysOrgRep.DetachedEntities.AnyAsync(u => u.Code == input.Code && u.Id != sysOrg.Id);
if (isExist)
throw Oops.Oh(ErrorCode.D2002);
}
var isExist = await _sysOrgRep.DetachedEntities
.AnyAsync(u => ((u.Pid == input.Pid && u.Name == input.Name) || (!string.IsNullOrEmpty(input.Code) && u.Code == input.Code)) && u.Id != sysOrg.Id);
if (isExist)
throw Oops.Oh(ErrorCode.D2002);
// 如果名称有变化,则修改对应员工的机构相关信息
if (!sysOrg.Name.Equals(input.Name))
@@ -309,6 +305,7 @@ namespace Ewide.Core.Service
Id = u.Id,
ParentId = u.Pid,
Title = u.Name,
Type = u.Type,
Value = u.Id.ToString(),
Weight = u.Sort
}).ToListAsync();