字典值不允许重复问题

optimize
wanghaomei 2 years ago
parent 49fd73074f
commit e413959eae

@ -72,7 +72,7 @@ public class SysDictDataService : ISysDictDataService, IDynamicApiController, IT
[HttpPost("/sysDictData/add")]
public async Task AddDictData(AddDictDataInput input)
{
var isExist = await _sysDictDataRep.AnyAsync(u => (u.Code == input.Code || u.Value == input.Value) && u.TypeId == input.TypeId);
var isExist = await _sysDictDataRep.AnyAsync(u => u.Code == input.Code && u.TypeId == input.TypeId);
if (isExist) throw Oops.Oh(ErrorCode.D3003);
var dictData = input.Adapt<SysDictData>();
@ -199,7 +199,7 @@ public class SysDictDataService : ISysDictDataService, IDynamicApiController, IT
/// <returns></returns>
/// <exception cref="System.NotImplementedException"></exception>
[NonAction]
public async Task CacheData(bool falg=false)
public async Task CacheData(bool falg = false)
{
if (falg)
{
@ -218,7 +218,9 @@ public class SysDictDataService : ISysDictDataService, IDynamicApiController, IT
}).ToListAsync();
await _cache.SetAllDictData(list);
}
} else {
}
else
{
var list = await _sysDictDataRep.AsQueryable().InnerJoin<SysDictType>((d, t) => d.TypeId == t.Id).Filter(null, true).Where((d, t) => t.Status == CommonStatus.ENABLE && d.Status == CommonStatus.ENABLE).Select((d, t) => new DictDataDto
{
Id = d.Id,
@ -232,10 +234,10 @@ public class SysDictDataService : ISysDictDataService, IDynamicApiController, IT
}).ToListAsync();
await _cache.SetAllDictData(list);
}
}
}

Loading…
Cancel
Save