修改警告
This commit is contained in:
@@ -15,7 +15,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
public string FileType { get; set; } = String.Empty;
|
||||
public string ModuleType { get; set; } = String.Empty;
|
||||
|
||||
public string FullFilePath { get; set; }
|
||||
public string FullFilePath { get; set; } = String.Empty;
|
||||
|
||||
|
||||
public DateTime? DeletedTime { get; set; }
|
||||
|
||||
@@ -13,9 +13,9 @@ namespace IRaCIS.Application.Contracts
|
||||
public DateTime UpdateTime { get; set; }
|
||||
public Guid UpdateUserId { get; set; }
|
||||
|
||||
public string ConfigType { get; set; }
|
||||
public string ConfigType { get; set; } = String.Empty;
|
||||
|
||||
public string ConfigTypeDes { get; set; }
|
||||
public string ConfigTypeDes { get; set; } = String.Empty;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -104,208 +104,5 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
|
||||
|
||||
#region old 待废弃
|
||||
|
||||
/// <summary>
|
||||
/// 获取项目多选字典
|
||||
/// </summary>
|
||||
/// <param name="searchArray">Title、Department、Rank、Position、ReadingType、Subspeciality Sponsor CROCompany ReadingStandard ReviewMode ReviewType ProjectState</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public DicResultDTO GetDictionary(string[] searchArray)
|
||||
{
|
||||
var doctorViewList = _dicRepository.ProjectTo<DicViewModelDTO>(_mapper.ConfigurationProvider).OrderBy(t => t.KeyName)
|
||||
.ThenBy(t => t.ShowOrder).ToList();
|
||||
|
||||
var projectDicResult = new DicResultDTO();
|
||||
foreach (var searchItem in searchArray)
|
||||
{
|
||||
var item = searchItem.Trim();
|
||||
var tempDic = new Dictionary<Guid, string>();
|
||||
doctorViewList.Where(o => o.KeyName == item).ToList().ForEach(o => tempDic.Add(o.Id!.Value, o.Value));
|
||||
projectDicResult.DicList.Add(item, tempDic);
|
||||
}
|
||||
return projectDicResult;
|
||||
}
|
||||
|
||||
|
||||
public DicResultDTO GetAllDictionary()
|
||||
{
|
||||
var list = _dicRepository.ProjectTo<DicViewModelDTO>(_mapper.ConfigurationProvider).OrderBy(t => t.KeyName)
|
||||
.ThenBy(t => t.ShowOrder).ToList();
|
||||
|
||||
var types = list.Select(u => u.KeyName).Distinct();
|
||||
|
||||
var projectDicResult = new DicResultDTO();
|
||||
foreach (var type in types)
|
||||
{
|
||||
var tempDic = new Dictionary<Guid, string>();
|
||||
|
||||
//list.Where(o => o.KeyName == type).ToList().ForEach(o => tempDic.Add(o.Id, string.IsNullOrEmpty(o.ValueCN)?o.Value: o.Value + " / " + o.ValueCN));
|
||||
list.Where(o => o.KeyName == type).ToList().ForEach(o => tempDic.Add(o.Id!.Value, o.Value));
|
||||
|
||||
projectDicResult.DicList.Add(type, tempDic);
|
||||
}
|
||||
|
||||
// //用户类型从字典表 移到另外的表了,现在为了前端不变,在这里获取,给出数据
|
||||
|
||||
//var userTypes= _userTypeRoleRepository.GetAll().OrderBy(t => t.Order).Select(t => new {t.Id, t.UserType}).ToList();
|
||||
//var userTypeDic = new Dictionary<Guid, string>();
|
||||
//userTypes.ForEach(o => userTypeDic.Add(o.Id, o.UserType));
|
||||
|
||||
// projectDicResult.DicList.Add("UserType", userTypeDic);
|
||||
|
||||
|
||||
return projectDicResult;
|
||||
}
|
||||
|
||||
/// <summary> 根据Key,获取单个字典数组 </summary>
|
||||
[HttpPost]
|
||||
public PageOutput<DicViewModelDTO> getDictionarySelectList(DicQueryDTO dicSearchModel)
|
||||
{
|
||||
|
||||
|
||||
var dicQueryable = _dicRepository
|
||||
.WhereIf(!string.IsNullOrEmpty(dicSearchModel.KeyName), t => t.KeyName == dicSearchModel.KeyName && t.Value != "")
|
||||
.ProjectTo<DicViewModelDTO>(_mapper.ConfigurationProvider);
|
||||
|
||||
var pageList = dicQueryable.ToPagedList(dicSearchModel.PageIndex, dicSearchModel.PageSize, dicSearchModel.SortField, dicSearchModel.Asc);
|
||||
|
||||
return pageList;
|
||||
|
||||
}
|
||||
|
||||
/// <summary> 根据Type、Key 获取字典 树结构 </summary>
|
||||
public List<DictionaryTreeNode> GetDicTree()
|
||||
{
|
||||
var keyNameTypeDistinctList = _dicRepository.Where(t => t.ParentId != null)
|
||||
.ProjectTo<KeyNameType>(_mapper.ConfigurationProvider).Distinct().ToList();
|
||||
|
||||
var treeNodeList = new List<DictionaryTreeNode>();
|
||||
var group = keyNameTypeDistinctList.GroupBy(t => t.Type);
|
||||
foreach (var groupItem in group)
|
||||
{
|
||||
var node = new DictionaryTreeNode()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
KeyName = groupItem.Key,
|
||||
Type = groupItem.Key,
|
||||
Children = keyNameTypeDistinctList.Where(t => t.Type == groupItem.Key).Select(t =>
|
||||
new DictionaryTreeNode()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
KeyName = t.KeyName,
|
||||
Type = t.Type,
|
||||
Children = new List<DictionaryTreeNode>()
|
||||
}).ToList()
|
||||
};
|
||||
treeNodeList.Add(node);
|
||||
}
|
||||
return treeNodeList;
|
||||
}
|
||||
|
||||
|
||||
/// <summary> 添加或更新字典数据 </summary>
|
||||
//[HttpPost]
|
||||
//public IResponseOutput AddOrUpdateDictionary(AddOrUpdateDicDTO viewModel)
|
||||
//{
|
||||
// #region 封装前
|
||||
// //if (viewModel.Id == null)
|
||||
// //{
|
||||
// // var existItem = _dicRepository.FirstOrDefault(dic => dic.KeyName.Equals(viewModel.KeyName) && dic.Value.Equals(viewModel.Value));
|
||||
// // if (existItem != null)
|
||||
// // {
|
||||
// // return ResponseOutput.NotOk("The added item has the same name as a sub-item of current categpry. Please modify the name.");
|
||||
// // }
|
||||
// // var result = _dicRepository.Add(_mapper.Map<Dictionary>(viewModel));
|
||||
// // var success = _dicRepository.SaveChanges();
|
||||
// // return ResponseOutput.Result(success);
|
||||
// //}
|
||||
// //else
|
||||
// //{
|
||||
// // var existItem = _dicRepository.FirstOrDefault(dic => dic.KeyName.Equals(viewModel.KeyName) && dic.Value.Equals(viewModel.Value));
|
||||
// // if (existItem != null && existItem.Id != viewModel.Id)
|
||||
// // {
|
||||
// // return ResponseOutput.NotOk("The updated item has the same name as a sub-item of current categpry. Please modify the name.");
|
||||
// // }
|
||||
// // var updateItem = _dicRepository.FirstOrDefault(t => t.Id == viewModel.Id);
|
||||
// // _mapper.Map(viewModel, updateItem);
|
||||
// // var success = _dicRepository.SaveChanges();
|
||||
// // return ResponseOutput.Result(success);
|
||||
// //}
|
||||
// #endregion
|
||||
|
||||
// var exp = new EntityVerifyExp<Dictionary>()
|
||||
// {
|
||||
// VerifyExp = dic => dic.KeyName.Equals(viewModel.KeyName) && dic.Value.Equals(viewModel.Value),
|
||||
// VerifyMsg = "The item has the same name as a sub-item of current categpry"
|
||||
// };
|
||||
|
||||
// //var entity = _dicRepository.UseMapper(_mapper).InsertOrUpdate(viewModel, true, exp);
|
||||
|
||||
// return ResponseOutput.Ok(entity.Id);
|
||||
|
||||
//}
|
||||
|
||||
|
||||
/// <summary> 删除字典数据 </summary>
|
||||
[HttpDelete("{id:guid}")]
|
||||
public async Task<IResponseOutput> DeleteDictionary(Guid id)
|
||||
{
|
||||
if ((await _doctorDictionaryRepository.AnyAsync(t => t.DictionaryId == id)) ||
|
||||
(await _doctorRepository.AnyAsync(t => t.SpecialityId == id|| t.PositionId == id|| t.DepartmentId == id|| t.RankId == id))
|
||||
|
||||
)
|
||||
{
|
||||
return ResponseOutput.NotOk("This item is referenced by content of the reviewer's resume.");
|
||||
}
|
||||
|
||||
if (await _trialDictionaryRepository.AnyAsync(t => t.DictionaryId == id) ||
|
||||
await _trialRepository.AnyAsync(t => t.ReviewModeId == id))
|
||||
{
|
||||
return ResponseOutput.NotOk("This item is referenced by content of the trial infomation.");
|
||||
}
|
||||
|
||||
var success = await _dicRepository.DeleteFromQueryAsync(t => t.Id == id);
|
||||
return ResponseOutput.Result(success);
|
||||
}
|
||||
|
||||
/// <summary> 获取所有字典数据 </summary>
|
||||
public async Task<IEnumerable<string>> getDictionarySelect()
|
||||
{
|
||||
return await _dicRepository.Select(t => t.KeyName).Distinct().ToListAsync();
|
||||
}
|
||||
|
||||
//[Obsolete]
|
||||
[NonDynamicMethod]
|
||||
public DicViewModelDTO GetDetailById(Guid id)
|
||||
{
|
||||
var result = _dicRepository.ProjectTo<DicViewModelDTO>(_mapper.ConfigurationProvider).FirstOrDefault(u => u.Id == id).IfNullThrowException();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public TrialDicSelect GetGenerateTrialCodeDic()
|
||||
{
|
||||
var list = _dicRepository.Where(t => t.KeyName == "Phase" || t.KeyName == "IndicationType" || t.KeyName == "DeclarationType").ProjectTo<TrialDictionaryView>(_mapper.ConfigurationProvider).ToList();
|
||||
|
||||
return new TrialDicSelect()
|
||||
{
|
||||
Phase = list.Where(t => t.KeyName == "Phase").OrderBy(t => t.ShowOrder).ToArray(),
|
||||
IndicationType = list.Where(t => t.KeyName == "IndicationType").OrderBy(t => t.ShowOrder).ToArray(),
|
||||
DeclarationType = list.Where(t => t.KeyName == "DeclarationType").OrderBy(t => t.ShowOrder).ToArray()
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,18 +9,6 @@ namespace IRaCIS.Application.Interfaces
|
||||
public interface IDictionaryService
|
||||
{
|
||||
|
||||
Task<IEnumerable<string>> getDictionarySelect();
|
||||
PageOutput<DicViewModelDTO> getDictionarySelectList(DicQueryDTO dicSearchModel);
|
||||
|
||||
Task<IResponseOutput> DeleteDictionary(Guid id);
|
||||
DicResultDTO GetDictionary(string[] searchArray);
|
||||
DicResultDTO GetAllDictionary();
|
||||
//IResponseOutput AddOrUpdateDictionary(AddOrUpdateDicDTO viewModel);
|
||||
|
||||
[EasyCachingAble(Expiration = 10)]
|
||||
List<DictionaryTreeNode> GetDicTree();
|
||||
DicViewModelDTO GetDetailById(Guid Id);
|
||||
|
||||
TrialDicSelect GetGenerateTrialCodeDic();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace IRaCIS.Core.Application.Services
|
||||
[HttpGet("{code}")]
|
||||
public async Task<SystemBasicDataView> GetSystemBasicData(string code)
|
||||
{
|
||||
return await _repository.Where<SystemBasicData>(t => t.Code == code).ProjectTo<SystemBasicDataView>(_mapper.ConfigurationProvider).FirstOrDefaultAsync();
|
||||
return (await _repository.Where<SystemBasicData>(t => t.Code == code).ProjectTo<SystemBasicDataView>(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user