检查客户信息是否重复

dev
嵇文龙 2 months ago
parent 2a68b0b06b
commit af8512c383

@ -554,8 +554,13 @@ public class ClientInfoService : ServiceBase, IClientInfoService
/// <returns></returns>
public async Task<DataResult> IsAvailableAsync(ClientInfoReq req)
{
req.ShortName = req.ShortName.Trim();
req.Description = req.Description.Trim();
TenantDb.QueryFilter.ClearAndBackup<IOrgId>();
TenantDb.QueryFilter.ClearAndBackup<ISharedOrgId>();
var expr = Expressionable.Create<InfoClient>()
.And(x => x.ShortName == req.ShortName.Trim() && x.Description == req.Description.Trim())
.And(x => x.ShortName == req.ShortName && x.Description == req.Description)
.AndIF(req.Id > 0, x => x.Id != req.Id);
var client = await TenantDb.Queryable<InfoClient>().Where(expr.ToExpression()).Select(x => new
@ -571,6 +576,7 @@ public class ClientInfoService : ServiceBase, IClientInfoService
result.Data = client;
}
TenantDb.QueryFilter.Restore();
return DataResult.Success;
}

Loading…
Cancel
Save