fix: 修复上一提交导致的字典服务错误
This commit is contained in:
@@ -66,7 +66,7 @@ public interface ISysDictService
|
||||
/// <summary>
|
||||
/// 从缓存/数据库获取自定义配置列表
|
||||
/// </summary>
|
||||
/// <returns>自定义配置列表</returns
|
||||
/// <returns>自定义配置列表</returns>
|
||||
Task<IDictionary<string, SysDict>> GetDefineConfigAsync();
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -241,15 +241,15 @@ public class SysDictService : BaseService<SysDict>, ISysDictService
|
||||
/// 从缓存/数据库获取系统配置列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<IDictionary<string,SysDict>> GetDefineConfigAsync()
|
||||
public async Task<IDictionary<string, SysDict>> GetDefineConfigAsync()
|
||||
{
|
||||
var key = $"{CacheConst.Cache_SysDict}{DictTypeEnum.Define}";//系统配置key
|
||||
var sysDicts = NetCoreApp.CacheService.HashGetAll<SysDict>(key);
|
||||
if (sysDicts == null)
|
||||
if (sysDicts.Count == 0)
|
||||
{
|
||||
using var db = GetDB();
|
||||
sysDicts = (await db.Queryable<SysDict>().Where(a => a.DictType == DictTypeEnum.Define).ToListAsync()).ToDictionary(a=>
|
||||
$"{a.Category}:sysdict:{a.Name}",a=>a);
|
||||
sysDicts = (await db.Queryable<SysDict>().Where(a => a.DictType == DictTypeEnum.Define).ToListAsync()).ToDictionary(a =>
|
||||
$"{a.Category}:sysdict:{a.Name}", a => a);
|
||||
NetCoreApp.CacheService.Set(key, sysDicts);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
AllowResizing="true" IsFixedHeader=true IsMultipleSelect=true SearchModel=SearchModel
|
||||
ShowExtendButtons=true
|
||||
OnQueryAsync="OnQueryAsync" IsPagination=true
|
||||
OnSaveAsync="SysDictService.SaveDictAsync" OnDeleteAsync="@(a=>SysDictService.DeleteDictAsync(a.Select(a=>a.Id)))">
|
||||
OnSaveAsync="SaveDictAsync" OnDeleteAsync="@(a=>DeleteDictAsync(a.Select(a=>a.Id)))">
|
||||
|
||||
</AdminTable>
|
||||
</div>
|
||||
|
||||
@@ -31,4 +31,34 @@ public partial class SysDictPage
|
||||
}
|
||||
|
||||
#endregion 查询
|
||||
|
||||
#region 修改
|
||||
|
||||
private async Task<bool> DeleteDictAsync(IEnumerable<long> ids)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await SysDictService.DeleteDictAsync(ids);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await ToastService.Warning(null, $"{ex.Message}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<bool> SaveDictAsync(SysDict input, ItemChangedType type)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await SysDictService.SaveDictAsync(input, type);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await ToastService.Warning(null, $"{ex.Message}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion 修改
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Version>6.0.4.49</Version>
|
||||
<Version>6.0.4.50</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user