修复删除字典表数据

Uat_Study
hang 2022-04-08 16:06:23 +08:00
parent 6fe823ec7a
commit 2a1f15996d
7 changed files with 50 additions and 13 deletions

View File

@ -337,6 +337,7 @@
不带Token 访问 页面获取项目基本信息 和参与情况 (已经确认了 就不允许再次确认) Id: TrialExternalUserId/TrialSiteSurveyUserId
</summary>
<param name="id"></param>
<param name="isExternalUser"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.TrialExternalUserService.UserConfirmJoinTrial(System.Guid,System.Guid)">
@ -1662,18 +1663,21 @@
</member>
<member name="M:IRaCIS.Application.Services.DictionaryService.AddOrUpdateBasicDic(IRaCIS.Application.Contracts.AddOrEditBasicDic)">
<summary>
New
添加和编辑
</summary>
<param name="addOrEditBasic"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Application.Services.DictionaryService.GetChildList(System.Guid)">
<summary>
New
获取子项数组
</summary>
<param name="parentId"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Application.Services.DictionaryService.DeleteDictionary(System.Guid)">
<summary> 删除字典数据 </summary>
</member>
<member name="M:IRaCIS.Application.Services.DictionaryService.GetBasicDataSelect(System.String[])">
<summary>
传递父亲 code 字符串 数组 返回多个下拉框数据

View File

@ -58,12 +58,10 @@ namespace IRaCIS.Application.Contracts
public class BasicDicSelect
{
public Guid Id { get; set; }
public string KeyName { get; set; } = string.Empty;
public string ValueCN { get; set; } = string.Empty;
public string Value { get; set; } = string.Empty;
public string Code { get; set; } = string.Empty;
public string ChildGroup { get; set; } = string.Empty;
public int ShowOrder { get; set; }

View File

@ -1,9 +1,7 @@
using IRaCIS.Core.Infrastructure.ExpressionExtend;
using IRaCIS.Application.Interfaces;
using IRaCIS.Application.Interfaces;
using IRaCIS.Application.Contracts;
using IRaCIS.Core.Infra.EFCore;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Panda.DynamicWebApi.Attributes;
namespace IRaCIS.Application.Services
{
@ -21,7 +19,7 @@ namespace IRaCIS.Application.Services
private readonly IRepository<Trial> _trialRepository;
public DictionaryService(IRepository<Dictionary> sysDicRepository, IRepository<DoctorDictionary> doctorDictionaryRepository, IRepository<TrialDictionary> trialDictionaryRepository,
IRepository<Doctor> doctorRepository, IRepository<Trial> trialRepository)
IRepository<Doctor> doctorRepository, IRepository<Trial> trialRepository)
{
_dicRepository = sysDicRepository;
_doctorDictionaryRepository = doctorDictionaryRepository;
@ -31,6 +29,7 @@ namespace IRaCIS.Application.Services
}
/// <summary>
/// New 查询条件 IsConfig 代表是字典类型配置项 否就是我们普通的项 和普通项的子项
/// </summary>
@ -53,7 +52,7 @@ namespace IRaCIS.Application.Services
/// <summary>
/// New
/// 添加和编辑
/// </summary>
/// <param name="addOrEditBasic"></param>
/// <returns></returns>
@ -68,7 +67,7 @@ namespace IRaCIS.Application.Services
/// <summary>
/// New
/// 获取子项数组
/// </summary>
/// <param name="parentId"></param>
/// <returns></returns>
@ -80,6 +79,29 @@ namespace IRaCIS.Application.Services
}
/// <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>
/// 传递父亲 code 字符串 数组 返回多个下拉框数据
/// </summary>
@ -103,6 +125,14 @@ namespace IRaCIS.Application.Services
}
[AllowAnonymous]
public async Task<Dictionary<string, List<BasicDicSelect>>> GetBasicDataAllSelect()
{
var searchList = await _dicRepository.Where(t => t.ParentId != null && t.IsEnable).ProjectTo<BasicDicSelect>(_mapper.ConfigurationProvider).ToListAsync();
return searchList.GroupBy(t => t.ParentCode).ToDictionary(g => g.Key, g => g.ToList());
}
}
}

View File

@ -18,6 +18,8 @@ namespace IRaCIS.Core.Application.Contracts
public DateTime CreateTime { get; set; }
public DateTime UpdateTime { get; set; }
public string FileType { get; set; } = string.Empty;
public List<NeedConfirmedUserTypeView> NeedConfirmedUserTypeList { get; set; }=new List<NeedConfirmedUserTypeView>();
}

View File

@ -21,6 +21,8 @@ namespace IRaCIS.Core.Application.Contracts
public DateTime UpdateTime { get; set; }
public Guid UpdateUserId { get; set; }
public string FileType { get; set; } = string.Empty;
public List<NeedConfirmedUserTypeView> NeedConfirmedUserTypeList { get; set; } = new List<NeedConfirmedUserTypeView>();

View File

@ -14,10 +14,11 @@ namespace IRaCIS.Core.Application.Service
var userId = Guid.Empty;
var token = string.Empty;
CreateMap<SystemDocument, SystemDocumentView>()
//.ForMember(d => d.UserConfirmInfo, u => u.MapFrom(s => s.SystemDocConfirmedUserList.FirstOrDefault(t=>t.ConfirmUserId==userId)))
.ForMember(d => d.FileType, u => u.MapFrom(s => s.FileType.Value))
.ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path + "?access_token=" + token));
CreateMap<TrialDocument, TrialDocumentView>()
.ForMember(d => d.FileType, u => u.MapFrom(s => s.FileType.Value))
.ForMember(d => d.IsSomeUserSigned, u => u.MapFrom(s => s.TrialDocConfirmedUserList.Any()))
.ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path + "?access_token=" + token));

View File

@ -616,11 +616,11 @@ namespace IRaCIS.Core.Application.Service
}
/// <summary>
/// 不带Token 访问 页面获取项目基本信息 和参与情况 (已经确认了 就不允许再次确认) Id: TrialExternalUserId/TrialSiteSurveyUserId
/// </summary>
/// <param name="id"></param>
/// <param name="isExternalUser"></param>
/// <returns></returns>
[AllowAnonymous]
public async Task<TrialInfoWithPreparationInfo> JoinBasicInfo(Guid id, bool isExternalUser)