|
|
@@ -64,6 +64,9 @@ public class SysDictDataService : IDynamicApiController, ITransient
|
|
|
var isExist = await _sysDictDataRep.IsAnyAsync(u => u.Value == input.Value && u.DictTypeId == input.DictTypeId);
|
|
|
if (isExist) throw Oops.Oh(ErrorCodeEnum.D3003);
|
|
|
|
|
|
+ var dictType = await _sysDictDataRep.Change<SysDictType>().GetByIdAsync(input.DictTypeId);
|
|
|
+ if (dictType.SysFlag == YesNoEnum.Y && !_userManager.SuperAdmin) throw Oops.Oh(ErrorCodeEnum.D3010);
|
|
|
+
|
|
|
var dictTypeCode = await _sysDictDataRep.AsQueryable().Where(u => u.DictTypeId == input.DictTypeId).Select(u => u.DictType.Code).FirstAsync();
|
|
|
_sysCacheService.RemoveByPrefixKey($"{CacheConst.KeyDict}{dictTypeCode}");
|
|
|
|
|
|
@@ -86,6 +89,9 @@ public class SysDictDataService : IDynamicApiController, ITransient
|
|
|
isExist = await _sysDictDataRep.IsAnyAsync(u => u.Value == input.Value && u.DictTypeId == input.DictTypeId && u.Id != input.Id);
|
|
|
if (isExist) throw Oops.Oh(ErrorCodeEnum.D3003);
|
|
|
|
|
|
+ var dictType = await _sysDictDataRep.Change<SysDictType>().GetByIdAsync(input.DictTypeId);
|
|
|
+ if (dictType.SysFlag == YesNoEnum.Y && !_userManager.SuperAdmin) throw Oops.Oh(ErrorCodeEnum.D3010);
|
|
|
+
|
|
|
var dictTypeCode = await _sysDictDataRep.AsQueryable().Where(u => u.DictTypeId == input.DictTypeId).Select(u => u.DictType.Code).FirstAsync();
|
|
|
_sysCacheService.RemoveByPrefixKey($"{CacheConst.KeyDict}{dictTypeCode}");
|
|
|
|
|
|
@@ -107,6 +113,9 @@ public class SysDictDataService : IDynamicApiController, ITransient
|
|
|
var dictTypeCode = await _sysDictDataRep.AsQueryable().Where(u => u.DictTypeId == dictData.Id).Select(u => u.DictType.Code).FirstAsync();
|
|
|
_sysCacheService.RemoveByPrefixKey($"{CacheConst.KeyDict}{dictTypeCode}");
|
|
|
|
|
|
+ var dictType = await _sysDictDataRep.Change<SysDictType>().GetByIdAsync(dictData.DictTypeId);
|
|
|
+ if (dictType.SysFlag == YesNoEnum.Y && !_userManager.SuperAdmin) throw Oops.Oh(ErrorCodeEnum.D3010);
|
|
|
+
|
|
|
await _sysDictDataRep.DeleteAsync(dictData);
|
|
|
}
|
|
|
|