添加分割绑定
continuous-integration/drone/push Build is passing

This commit is contained in:
Hewt
2026-03-19 15:24:34 +08:00
parent 67216d1c92
commit c84fed8af1
9 changed files with 22295 additions and 0 deletions
@@ -0,0 +1,56 @@
//--------------------------------------------------------------------
// 此代码由liquid模板自动生成 byzhouhang 20240909
// 生成时间 2026-03-19 07:13:41Z
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//--------------------------------------------------------------------
using System;
using IRaCIS.Core.Domain.Share;
using System.Collections.Generic;
namespace IRaCIS.Core.Application.ViewModel;
public class SegmentBindingView : SegmentBindingAddOrEdit
{
public DateTime CreateTime { get; set; }
public DateTime UpdateTime { get; set; }
}
public class SegmentBindingAddOrEdit
{
public Guid? Id { get; set; }
public Guid? QuestionId { get; set; }
public Guid? RowId { get; set; }
public Guid SegmentId { get; set; }
public Guid SegmentationId { get; set; }
public Guid? TableQuestionId { get; set; }
public Guid VisitTaskId { get; set; }
}
public class SegmentBindingQuery:PageInput
{
public Guid? QuestionId { get; set; }
public Guid? RowId { get; set; }
public Guid? SegmentId { get; set; }
public Guid? SegmentationId { get; set; }
public Guid? TableQuestionId { get; set; }
public Guid? VisitTaskId { get; set; }
}
@@ -25,6 +25,12 @@ public interface ISegmentationService
Task<IResponseOutput> AddOrUpdateSegment(SegmentAddOrEdit addOrEditSegment);
Task<IResponseOutput> DeleteSegment(Guid segmentId);
Task<PageOutput<SegmentBindingView>> GetSegmentBindingList(SegmentBindingQuery inQuery);
Task<IResponseOutput> AddOrUpdateSegmentBinding(SegmentBindingAddOrEdit addOrEditSegmentBinding);
Task<IResponseOutput> DeleteSegmentBinding(Guid segmentBindingId);
}
@@ -22,6 +22,7 @@ namespace IRaCIS.Core.Application.Service;
/// <param name="_localizer"></param>
[ ApiExplorerSettings(GroupName = "Reading")]
public class SegmentationService(IRepository<Segmentation> _segmentationRepository,
IRepository<SegmentBinding> _segmentBindingRepository,
IRepository<Segment> _segmentRepository,
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer): BaseService, ISegmentationService
{
@@ -134,6 +135,61 @@ public class SegmentationService(IRepository<Segmentation> _segmentationReposito
return ResponseOutput.Ok();
}
/// <summary>
/// 获取分割绑定
/// </summary>
/// <param name="inQuery"></param>
/// <returns></returns>
[HttpPost]
public async Task<PageOutput<SegmentBindingView>> GetSegmentBindingList(SegmentBindingQuery inQuery)
{
var segmentBindingQueryable = _segmentBindingRepository
.WhereIf(inQuery.QuestionId != null, x => x.QuestionId == inQuery.QuestionId)
.WhereIf(inQuery.RowId != null, x => x.RowId == inQuery.RowId)
.WhereIf(inQuery.SegmentId != null, x => x.SegmentId == inQuery.SegmentId)
.WhereIf(inQuery.SegmentationId != null, x => x.SegmentationId == inQuery.SegmentationId)
.WhereIf(inQuery.TableQuestionId != null, x => x.TableQuestionId == inQuery.TableQuestionId)
.WhereIf(inQuery.VisitTaskId != null, x => x.VisitTaskId == inQuery.VisitTaskId)
.ProjectTo<SegmentBindingView>(_mapper.ConfigurationProvider);
var pageList = await segmentBindingQueryable.ToPagedListAsync(inQuery);
return pageList;
}
/// <summary>
/// 新增修改分割绑定
/// </summary>
/// <param name="addOrEditSegmentBinding"></param>
/// <returns></returns>
public async Task<IResponseOutput> AddOrUpdateSegmentBinding(SegmentBindingAddOrEdit addOrEditSegmentBinding)
{
var entity = await _segmentBindingRepository.InsertOrUpdateAsync(addOrEditSegmentBinding, true);
return ResponseOutput.Ok(entity.Id.ToString());
}
/// <summary>
/// 删除分割
/// </summary>
/// <param name="segmentBindingId"></param>
/// <returns></returns>
[HttpDelete("{segmentBindingId:guid}")]
public async Task<IResponseOutput> DeleteSegmentBinding(Guid segmentBindingId)
{
var success = await _segmentBindingRepository.DeleteFromQueryAsync(t => t.Id == segmentBindingId, true);
return ResponseOutput.Ok();
}
}
@@ -25,6 +25,11 @@ namespace IRaCIS.Core.Application.Service
CreateMap<Segmentation, SegmentationView>();
CreateMap<Segmentation, SegmentationAddOrEdit>().ReverseMap();
// 在此处拷贝automapper 映射
CreateMap<SegmentBinding, SegmentBindingView>();
CreateMap<SegmentBinding, SegmentBindingAddOrEdit>().ReverseMap();
CreateMap<ReadingQuestionTrial, ReadingReportDto>()
.ForMember(d => d.QuestionId, u => u.MapFrom(s => s.Id));