添加分割绑定
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
67216d1c92
commit
c84fed8af1
|
|
@ -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> AddOrUpdateSegment(SegmentAddOrEdit addOrEditSegment);
|
||||||
|
|
||||||
Task<IResponseOutput> DeleteSegment(Guid segmentId);
|
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>
|
/// <param name="_localizer"></param>
|
||||||
[ ApiExplorerSettings(GroupName = "Reading")]
|
[ ApiExplorerSettings(GroupName = "Reading")]
|
||||||
public class SegmentationService(IRepository<Segmentation> _segmentationRepository,
|
public class SegmentationService(IRepository<Segmentation> _segmentationRepository,
|
||||||
|
IRepository<SegmentBinding> _segmentBindingRepository,
|
||||||
IRepository<Segment> _segmentRepository,
|
IRepository<Segment> _segmentRepository,
|
||||||
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer): BaseService, ISegmentationService
|
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer): BaseService, ISegmentationService
|
||||||
{
|
{
|
||||||
|
|
@ -134,6 +135,61 @@ public class SegmentationService(IRepository<Segmentation> _segmentationReposito
|
||||||
return ResponseOutput.Ok();
|
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, SegmentationView>();
|
||||||
CreateMap<Segmentation, SegmentationAddOrEdit>().ReverseMap();
|
CreateMap<Segmentation, SegmentationAddOrEdit>().ReverseMap();
|
||||||
|
|
||||||
|
// 在此处拷贝automapper 映射
|
||||||
|
|
||||||
|
CreateMap<SegmentBinding, SegmentBindingView>();
|
||||||
|
CreateMap<SegmentBinding, SegmentBindingAddOrEdit>().ReverseMap();
|
||||||
|
|
||||||
CreateMap<ReadingQuestionTrial, ReadingReportDto>()
|
CreateMap<ReadingQuestionTrial, ReadingReportDto>()
|
||||||
.ForMember(d => d.QuestionId, u => u.MapFrom(s => s.Id));
|
.ForMember(d => d.QuestionId, u => u.MapFrom(s => s.Id));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
using IRaCIS.Core.Domain.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Numerics;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace IRaCIS.Core.Domain.Models
|
||||||
|
{
|
||||||
|
|
||||||
|
[Comment("分割绑定")]
|
||||||
|
[Table("SegmentBinding")]
|
||||||
|
public class SegmentBinding : BaseFullDeleteAuditEntity
|
||||||
|
{
|
||||||
|
#region 导航属性
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 分割组Id
|
||||||
|
/// </summary>
|
||||||
|
public Guid SegmentationId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 分割Id
|
||||||
|
/// </summary>
|
||||||
|
public Guid SegmentId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务Id
|
||||||
|
/// </summary>
|
||||||
|
public Guid VisitTaskId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 问题Id
|
||||||
|
/// </summary>
|
||||||
|
public Guid? QuestionId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表格行
|
||||||
|
/// </summary>
|
||||||
|
public Guid? RowId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表格问题Id
|
||||||
|
/// </summary>
|
||||||
|
public Guid? TableQuestionId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -362,6 +362,8 @@ public class IRaCISDBContext : DbContext
|
||||||
|
|
||||||
public virtual DbSet<Segment> Segment { get; set; }
|
public virtual DbSet<Segment> Segment { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<SegmentBinding> SegmentBinding { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public virtual DbSet<TrialCriterionKeyFile> TrialCriterionKeyFile { get; set; }
|
public virtual DbSet<TrialCriterionKeyFile> TrialCriterionKeyFile { get; set; }
|
||||||
|
|
||||||
|
|
|
||||||
21995
IRaCIS.Core.Infra.EFCore/Migrations/20260319071138_SegmentBinding.Designer.cs
generated
Normal file
21995
IRaCIS.Core.Infra.EFCore/Migrations/20260319071138_SegmentBinding.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,55 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class SegmentBinding : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "SegmentBinding",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
SegmentationId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
SegmentId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
VisitTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
QuestionId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||||
|
RowId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||||
|
TableQuestionId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||||
|
DeleteUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||||
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||||
|
CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
|
UpdateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_SegmentBinding", x => x.Id)
|
||||||
|
.Annotation("SqlServer:Clustered", false);
|
||||||
|
|
||||||
|
},
|
||||||
|
comment: "分割绑定");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_SegmentBinding_CreateTime",
|
||||||
|
table: "SegmentBinding",
|
||||||
|
column: "CreateTime")
|
||||||
|
.Annotation("SqlServer:Clustered", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "SegmentBinding");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -9324,6 +9324,64 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Domain.Models.SegmentBinding", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid?>("DeleteUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DeletedTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<bool>("IsDeleted")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<Guid?>("QuestionId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid?>("RowId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("SegmentId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("SegmentationId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid?>("TableQuestionId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("UpdateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("VisitTaskId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);
|
||||||
|
|
||||||
|
b.HasIndex("CreateTime");
|
||||||
|
|
||||||
|
SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("CreateTime"));
|
||||||
|
|
||||||
|
b.ToTable("SegmentBinding", t =>
|
||||||
|
{
|
||||||
|
t.HasComment("分割绑定");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("IRaCIS.Core.Domain.Models.Segmentation", b =>
|
modelBuilder.Entity("IRaCIS.Core.Domain.Models.Segmentation", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
|
|
@ -19031,6 +19089,17 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
b.Navigation("CreateUserRole");
|
b.Navigation("CreateUserRole");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Domain.Models.SegmentBinding", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("CreateUserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("CreateUserRole");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("IRaCIS.Core.Domain.Models.Segmentation", b =>
|
modelBuilder.Entity("IRaCIS.Core.Domain.Models.Segmentation", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole")
|
b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue