using Furion.DatabaseAccessor; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace YBEE.EQM.Core; /// /// 监测学生 /// [Comment("监测样本学生")] public class ExamStudent : DEntityBase, IEntityTypeBuilder { /// /// 监测计划ID /// [Comment("监测计划ID")] [Required] public int ExamPlanId { get; set; } /// /// 机构ID /// [Comment("机构ID")] [Required] public short SysOrgId { get; set; } /// /// 校区ID /// [Comment("校区ID")] public short? SysOrgBranchId { get; set; } /// /// 监测年级ID /// [Comment("监测年级ID")] [Required] public int ExamGradeId { get; set; } /// /// 年级ID /// [Comment("年级ID")] [Required] public short GradeId { get; set; } /// /// 班级ID /// [Comment("班级ID")] [Required] public long SchoolClassId { get; set; } /// /// 班号 /// [Comment("班号")] [Required] public short ClassNumber { get; set; } ///// ///// 班级学生ID ///// //[Comment("班级学生ID")] //[Required] //public int SchoolClassStudentId { get; set; } ///// ///// 学生信息ID ///// //[Comment("学生信息ID")] //[Required] //public int PersonId { get; set; } /// /// 高中选科组合ID /// [Comment("高中选科组合ID")] public short? NceeCourseCombId { get; set; } /// /// 自编监测号 /// [Comment("自编监测号")] [StringLength(20)] public string ExamNumber { get; set; } = ""; /// /// 学籍号 /// [Comment("学籍号")] [StringLength(100)] public string StudentNumber { get; set; } = ""; /// /// 考场号 /// [Comment("考场号")] [StringLength(20)] public string RoomNumber { get; set; } = ""; /// /// 座位号 /// [Comment("座位号")] [StringLength(20)] public string SeatNumber { get; set; } = ""; /// /// 姓名 /// [Comment("姓名")] [Required, StringLength(100)] public string Name { get; set; } /// /// 证件类型 /// [Comment("证件类型")] [Required, Column(TypeName = "smallint")] public CertificateType CertificateType { get; set; } = CertificateType.NONE; /// /// 证件号码 /// [Comment("证件号码")] [StringLength(50)] public string IdNumber { get; set; } = ""; /// /// 出生日期 /// [Comment("出生日期")] public DateTime? BirthDate { get; set; } /// /// 性别 /// [Comment("性别")] [Required, Column(TypeName = "smallint")] public Gender Gender { get; set; } = Gender.UNKNOWN; /// /// 备注 /// [Comment("备注")] [StringLength(200)] public string Remark { get; set; } /// /// 一对一引用(机构) /// public virtual SysOrg SysOrg { get; set; } /// /// 一对一引用(年级) /// public virtual Grade Grade { get; set; } /// /// 一对一引用(班级) /// public virtual SchoolClass SchoolClass { get; set; } /// /// 一对一引用(校区) /// public virtual SysOrg SysOrgBranch { get; set; } /// /// 一对一引用(监测年级) /// public virtual ExamGrade ExamGrade { get; set; } ///// ///// 一对一引用(班级学生) ///// //public virtual SchoolClassStudent SchoolClassStudent { get; set; } ///// ///// 一对一引用(学生信息) ///// //public virtual Person Person { get; set; } public void Configure(EntityTypeBuilder entityBuilder, DbContext dbContext, Type dbContextLocator) { entityBuilder.HasIndex(a => new { a.ExamPlanId, a.SysOrgId }).HasDatabaseName("idx_exam_student_exam_plan_id_sys_org_id"); entityBuilder.HasIndex(a => new { a.ExamPlanId, a.SysOrgId, a.SchoolClassId }).HasDatabaseName("idx_exam_student_exam_plan_id_soid_scid"); } }