|
|
@ -79,19 +79,7 @@ public class SysDictDataService : ISysDictDataService, IDynamicApiController, IT
|
|
|
|
await _sysDictDataRep.InsertAsync(dictData);
|
|
|
|
await _sysDictDataRep.InsertAsync(dictData);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
////设置缓存
|
|
|
|
await CacheData();
|
|
|
|
await _cache.DelAsync(CommonConst.CACHE_KEY_COMMON_DB_DICT_DATA);
|
|
|
|
|
|
|
|
var list = await _sysDictDataRep.AsQueryable().InnerJoin<SysDictType>((d, t) => d.TypeId == t.Id).Where((d, t) => t.Status == CommonStatus.ENABLE && d.Status == CommonStatus.ENABLE).Select((d, t) => new DictDataDto
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Id = d.Id,
|
|
|
|
|
|
|
|
TypeName = t.Name,
|
|
|
|
|
|
|
|
TypeCode = t.Code,
|
|
|
|
|
|
|
|
Value = d.Value,
|
|
|
|
|
|
|
|
Code = d.Code,
|
|
|
|
|
|
|
|
Sort = d.Sort,
|
|
|
|
|
|
|
|
Remark = d.Remark
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
await _cache.SetAllDictData(list);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -110,19 +98,7 @@ public class SysDictDataService : ISysDictDataService, IDynamicApiController, IT
|
|
|
|
await _sysDictDataRep.DeleteAsync(dictData);
|
|
|
|
await _sysDictDataRep.DeleteAsync(dictData);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
////设置缓存
|
|
|
|
await CacheData();
|
|
|
|
await _cache.DelAsync(CommonConst.CACHE_KEY_COMMON_DB_DICT_DATA);
|
|
|
|
|
|
|
|
var list = await _sysDictDataRep.AsQueryable().InnerJoin<SysDictType>((d, t) => d.TypeId == t.Id).Where((d, t) => t.Status == CommonStatus.ENABLE && d.Status == CommonStatus.ENABLE).Select((d, t) => new DictDataDto
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Id = d.Id,
|
|
|
|
|
|
|
|
TypeName = t.Name,
|
|
|
|
|
|
|
|
TypeCode = t.Code,
|
|
|
|
|
|
|
|
Value = d.Value,
|
|
|
|
|
|
|
|
Code = d.Code,
|
|
|
|
|
|
|
|
Sort = d.Sort,
|
|
|
|
|
|
|
|
Remark = d.Remark
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
await _cache.SetAllDictData(list);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -144,19 +120,7 @@ public class SysDictDataService : ISysDictDataService, IDynamicApiController, IT
|
|
|
|
await _sysDictDataRep.AsUpdateable(dictData).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
await _sysDictDataRep.AsUpdateable(dictData).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
////设置缓存
|
|
|
|
await CacheData();
|
|
|
|
await _cache.DelAsync(CommonConst.CACHE_KEY_COMMON_DB_DICT_DATA);
|
|
|
|
|
|
|
|
var list = await _sysDictDataRep.AsQueryable().InnerJoin<SysDictType>((d, t) => d.TypeId == t.Id).Where((d, t) => t.Status == CommonStatus.ENABLE && d.Status == CommonStatus.ENABLE).Select((d, t) => new DictDataDto
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Id = d.Id,
|
|
|
|
|
|
|
|
TypeName = t.Name,
|
|
|
|
|
|
|
|
TypeCode = t.Code,
|
|
|
|
|
|
|
|
Value = d.Value,
|
|
|
|
|
|
|
|
Code = d.Code,
|
|
|
|
|
|
|
|
Sort = d.Sort,
|
|
|
|
|
|
|
|
Remark = d.Remark
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
await _cache.SetAllDictData(list);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -185,19 +149,7 @@ public class SysDictDataService : ISysDictDataService, IDynamicApiController, IT
|
|
|
|
throw Oops.Oh(ErrorCode.D3005);
|
|
|
|
throw Oops.Oh(ErrorCode.D3005);
|
|
|
|
dictData.Status = input.Status;
|
|
|
|
dictData.Status = input.Status;
|
|
|
|
|
|
|
|
|
|
|
|
////设置缓存
|
|
|
|
await CacheData();
|
|
|
|
await _cache.DelAsync(CommonConst.CACHE_KEY_COMMON_DB_DICT_DATA);
|
|
|
|
|
|
|
|
var list = await _sysDictDataRep.AsQueryable().InnerJoin<SysDictType>((d, t) => d.TypeId == t.Id).Where((d, t) => t.Status == CommonStatus.ENABLE && d.Status == CommonStatus.ENABLE).Select((d, t) => new DictDataDto
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Id = d.Id,
|
|
|
|
|
|
|
|
TypeName = t.Name,
|
|
|
|
|
|
|
|
TypeCode = t.Code,
|
|
|
|
|
|
|
|
Value = d.Value,
|
|
|
|
|
|
|
|
Code = d.Code,
|
|
|
|
|
|
|
|
Sort = d.Sort,
|
|
|
|
|
|
|
|
Remark = d.Remark
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
await _cache.SetAllDictData(list);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -226,8 +178,29 @@ public class SysDictDataService : ISysDictDataService, IDynamicApiController, IT
|
|
|
|
{
|
|
|
|
{
|
|
|
|
await _sysDictDataRep.DeleteAsync(u => u.TypeId == dictTypeId);
|
|
|
|
await _sysDictDataRep.DeleteAsync(u => u.TypeId == dictTypeId);
|
|
|
|
|
|
|
|
|
|
|
|
////设置缓存
|
|
|
|
await CacheData();
|
|
|
|
await _cache.DelAsync(CommonConst.CACHE_KEY_COMMON_DB_DICT_DATA);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 根据字典Code返回字典值列表
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="code"></param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
|
|
|
public async Task<List<SysDictData>> GetDictDataByCode(string code)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var payment = await _sysDictDataRep.AsQueryable().InnerJoin<SysDictType>((d, t) => d.TypeId == t.Id).Where((d, t) => t.Code == code).Select<SysDictData>().ToListAsync();
|
|
|
|
|
|
|
|
return payment;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 缓存数据
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
/// <exception cref="System.NotImplementedException"></exception>
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
|
|
|
public async Task CacheData()
|
|
|
|
|
|
|
|
{
|
|
|
|
var list = await _sysDictDataRep.AsQueryable().InnerJoin<SysDictType>((d, t) => d.TypeId == t.Id).Where((d, t) => t.Status == CommonStatus.ENABLE && d.Status == CommonStatus.ENABLE).Select((d, t) => new DictDataDto
|
|
|
|
var list = await _sysDictDataRep.AsQueryable().InnerJoin<SysDictType>((d, t) => d.TypeId == t.Id).Where((d, t) => t.Status == CommonStatus.ENABLE && d.Status == CommonStatus.ENABLE).Select((d, t) => new DictDataDto
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Id = d.Id,
|
|
|
|
Id = d.Id,
|
|
|
@ -242,15 +215,4 @@ public class SysDictDataService : ISysDictDataService, IDynamicApiController, IT
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 根据字典Code返回字典值列表
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="code"></param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
|
|
|
public async Task<List<SysDictData>> GetDictDataByCode(string code)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var payment = await _sysDictDataRep.AsQueryable().InnerJoin<SysDictType>((d, t) => d.TypeId == t.Id).Where((d, t) => t.Code == code).Select<SysDictData>().ToListAsync();
|
|
|
|
|
|
|
|
return payment;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|