修改
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
699f79278b
commit
12f2c2becb
|
@ -28,9 +28,9 @@ public class TrialNormalRecordAddOrEdit
|
||||||
public int? ReviewerFileType { get; set; }
|
public int? ReviewerFileType { get; set; }
|
||||||
|
|
||||||
public int State { get; set; }
|
public int State { get; set; }
|
||||||
|
|
||||||
public Guid TrialFileRecordId { get; set; }
|
public TrialFile TrialFileRecord { get; set; }
|
||||||
|
|
||||||
public Guid TrialFileTypeId { get; set; }
|
public Guid TrialFileTypeId { get; set; }
|
||||||
|
|
||||||
public Guid TrialId { get; set; }
|
public Guid TrialId { get; set; }
|
||||||
|
@ -43,9 +43,9 @@ public class TrialNormalRecordQuery : PageInput
|
||||||
public int? ReviewerFileType { get; set; }
|
public int? ReviewerFileType { get; set; }
|
||||||
|
|
||||||
public int? State { get; set; }
|
public int? State { get; set; }
|
||||||
|
|
||||||
public Guid? TrialFileRecordId { get; set; }
|
public string? FileName { get; set; }
|
||||||
|
|
||||||
public Guid? TrialFileTypeId { get; set; }
|
public Guid? TrialFileTypeId { get; set; }
|
||||||
|
|
||||||
public Guid? TrialId { get; set; }
|
public Guid? TrialId { get; set; }
|
||||||
|
|
|
@ -22,32 +22,46 @@ namespace IRaCIS.Core.Application.Service;
|
||||||
/// <param name="_localizer"></param>
|
/// <param name="_localizer"></param>
|
||||||
[ApiExplorerSettings(GroupName = "FileRecord")]
|
[ApiExplorerSettings(GroupName = "FileRecord")]
|
||||||
public class TrialNormalRecordService(IRepository<TrialNormalRecord> _trialNormalRecordRepository,
|
public class TrialNormalRecordService(IRepository<TrialNormalRecord> _trialNormalRecordRepository,
|
||||||
|
IRepository<TrialFile> _trialFileRepository,
|
||||||
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ITrialNormalRecordService
|
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ITrialNormalRecordService
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<PageOutput<TrialNormalRecordView>> GetTrialNormalRecordList(TrialNormalRecordQuery inQuery)
|
public async Task<PageOutput<TrialNormalRecordView>> GetTrialNormalRecordList(TrialNormalRecordQuery inDto)
|
||||||
{
|
{
|
||||||
|
|
||||||
var trialNormalRecordQueryable = _trialNormalRecordRepository
|
var trialNormalRecordQueryable = _trialNormalRecordRepository
|
||||||
.ProjectTo<TrialNormalRecordView>(_mapper.ConfigurationProvider);
|
.Where(x => x.TrialFileTypeId == inDto.TrialFileTypeId)
|
||||||
|
.WhereIf(inDto.FileName.IsNotNullOrEmpty(), x => x.TrialFileRecord.FileName.Contains(inDto.FileName))
|
||||||
|
.ProjectTo<TrialNormalRecordView>(_mapper.ConfigurationProvider);
|
||||||
|
|
||||||
var pageList = await trialNormalRecordQueryable.ToPagedListAsync(inQuery);
|
var pageList = await trialNormalRecordQueryable.ToPagedListAsync(inDto);
|
||||||
|
|
||||||
return pageList;
|
return pageList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public async Task<IResponseOutput> AddOrUpdateTrialNormalRecord(TrialNormalRecordAddOrEdit addOrEditTrialNormalRecord)
|
public async Task<IResponseOutput> AddOrUpdateTrialNormalRecord(TrialNormalRecordAddOrEdit inDto)
|
||||||
{
|
{
|
||||||
// 在此处拷贝automapper 映射
|
if (inDto.TrialFileRecord != null) inDto.TrialFileRecord.TrialFileTypeId = inDto.TrialFileTypeId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var entity = await _trialNormalRecordRepository.InsertOrUpdateAsync(addOrEditTrialNormalRecord, true);
|
if (inDto.Id != null)
|
||||||
|
{
|
||||||
|
var trialFinalRecord = await _trialNormalRecordRepository.Where(x => x.Id == inDto.Id.Value).FirstNotNullAsync();
|
||||||
|
|
||||||
|
List<Guid?> ids = new List<Guid?>() {
|
||||||
|
trialFinalRecord.TrialFileRecordId,
|
||||||
|
};
|
||||||
|
|
||||||
|
var fileIds = ids.Where(x => x != null).Select(x => (Guid)x).ToList();
|
||||||
|
await _trialFileRepository.BatchDeleteNoTrackingAsync(x => fileIds.Contains(x.Id));
|
||||||
|
}
|
||||||
|
|
||||||
|
var entity = await _trialNormalRecordRepository.InsertOrUpdateAsync(inDto, true);
|
||||||
|
|
||||||
|
|
||||||
return ResponseOutput.Ok(entity.Id.ToString());
|
return ResponseOutput.Ok(entity.Id.ToString());
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,14 @@ public class TrialNormalRecord : BaseFullAuditEntity
|
||||||
{
|
{
|
||||||
public Guid TrialId { get; set; }
|
public Guid TrialId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
[ForeignKey("TrialFileRecordId")]
|
||||||
|
public TrialFile TrialFileRecord { get; set; }
|
||||||
|
|
||||||
[Comment("关联项目文件类型")]
|
[Comment("关联项目文件类型")]
|
||||||
public Guid TrialFileTypeId { get; set; }
|
public Guid TrialFileTypeId { get; set; }
|
||||||
|
|
||||||
|
@ -106,7 +114,7 @@ public class TrialNormalRecord : BaseFullAuditEntity
|
||||||
|
|
||||||
|
|
||||||
[Comment("关联具体的文件记录,记录里面有大小,格式,名称")]
|
[Comment("关联具体的文件记录,记录里面有大小,格式,名称")]
|
||||||
public Guid TrialFileRecordId { get; set; }
|
public Guid? TrialFileRecordId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue