update 登录页背景, 组织机构code非必填, dapper查询优化

This commit is contained in:
2021-05-31 13:45:55 +08:00
parent ccd914fb81
commit 074ff51e86
12 changed files with 34 additions and 23 deletions

View File

@@ -65,11 +65,6 @@ namespace Ewide.Core.Service
[Required(ErrorMessage = "机构名称不能为空")]
public override string Name { get; set; }
/// <summary>
/// 编码
/// </summary>
[Required(ErrorMessage = "机构编码不能为空")]
public override string Code { get; set; }
/// <summary>
/// 机构所在区域
/// </summary>

View File

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