ExamStudent.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. using Furion.DatabaseAccessor;
  2. using Microsoft.EntityFrameworkCore;
  3. using Microsoft.EntityFrameworkCore.Metadata.Builders;
  4. using System;
  5. using System.ComponentModel.DataAnnotations;
  6. using System.ComponentModel.DataAnnotations.Schema;
  7. namespace YBEE.EQM.Core;
  8. /// <summary>
  9. /// 监测学生
  10. /// </summary>
  11. [Comment("监测样本学生")]
  12. public class ExamStudent : DEntityBase<long>, IEntityTypeBuilder<ExamStudent>
  13. {
  14. /// <summary>
  15. /// 监测计划ID
  16. /// </summary>
  17. [Comment("监测计划ID")]
  18. [Required]
  19. public int ExamPlanId { get; set; }
  20. /// <summary>
  21. /// 机构ID
  22. /// </summary>
  23. [Comment("机构ID")]
  24. [Required]
  25. public short SysOrgId { get; set; }
  26. /// <summary>
  27. /// 校区ID
  28. /// </summary>
  29. [Comment("校区ID")]
  30. public short? SysOrgBranchId { get; set; }
  31. /// <summary>
  32. /// 监测年级ID
  33. /// </summary>
  34. [Comment("监测年级ID")]
  35. [Required]
  36. public int ExamGradeId { get; set; }
  37. /// <summary>
  38. /// 年级ID
  39. /// </summary>
  40. [Comment("年级ID")]
  41. [Required]
  42. public short GradeId { get; set; }
  43. /// <summary>
  44. /// 班级ID
  45. /// </summary>
  46. [Comment("班级ID")]
  47. [Required]
  48. public long SchoolClassId { get; set; }
  49. /// <summary>
  50. /// 班号
  51. /// </summary>
  52. [Comment("班号")]
  53. [Required]
  54. public short ClassNumber { get; set; }
  55. ///// <summary>
  56. ///// 班级学生ID
  57. ///// </summary>
  58. //[Comment("班级学生ID")]
  59. //[Required]
  60. //public int SchoolClassStudentId { get; set; }
  61. ///// <summary>
  62. ///// 学生信息ID
  63. ///// </summary>
  64. //[Comment("学生信息ID")]
  65. //[Required]
  66. //public int PersonId { get; set; }
  67. /// <summary>
  68. /// 高中选科组合ID
  69. /// </summary>
  70. [Comment("高中选科组合ID")]
  71. public short? NceeCourseCombId { get; set; }
  72. /// <summary>
  73. /// 自编监测号
  74. /// </summary>
  75. [Comment("自编监测号")]
  76. [StringLength(20)]
  77. public string ExamNumber { get; set; } = "";
  78. /// <summary>
  79. /// 学籍号
  80. /// </summary>
  81. [Comment("学籍号")]
  82. [StringLength(100)]
  83. public string StudentNumber { get; set; } = "";
  84. /// <summary>
  85. /// 考场号
  86. /// </summary>
  87. [Comment("考场号")]
  88. [StringLength(20)]
  89. public string RoomNumber { get; set; } = "";
  90. /// <summary>
  91. /// 座位号
  92. /// </summary>
  93. [Comment("座位号")]
  94. [StringLength(20)]
  95. public string SeatNumber { get; set; } = "";
  96. /// <summary>
  97. /// 姓名
  98. /// </summary>
  99. [Comment("姓名")]
  100. [Required, StringLength(100)]
  101. public string Name { get; set; }
  102. /// <summary>
  103. /// 证件类型
  104. /// </summary>
  105. [Comment("证件类型")]
  106. [Required, Column(TypeName = "smallint")]
  107. public CertificateType CertificateType { get; set; } = CertificateType.NONE;
  108. /// <summary>
  109. /// 证件号码
  110. /// </summary>
  111. [Comment("证件号码")]
  112. [StringLength(50)]
  113. public string IdNumber { get; set; } = "";
  114. /// <summary>
  115. /// 出生日期
  116. /// </summary>
  117. [Comment("出生日期")]
  118. public DateTime? BirthDate { get; set; }
  119. /// <summary>
  120. /// 性别
  121. /// </summary>
  122. [Comment("性别")]
  123. [Required, Column(TypeName = "smallint")]
  124. public Gender Gender { get; set; } = Gender.UNKNOWN;
  125. /// <summary>
  126. /// 备注
  127. /// </summary>
  128. [Comment("备注")]
  129. [StringLength(200)]
  130. public string Remark { get; set; }
  131. /// <summary>
  132. /// 一对一引用(机构)
  133. /// </summary>
  134. public virtual SysOrg SysOrg { get; set; }
  135. /// <summary>
  136. /// 一对一引用(年级)
  137. /// </summary>
  138. public virtual Grade Grade { get; set; }
  139. /// <summary>
  140. /// 一对一引用(班级)
  141. /// </summary>
  142. public virtual SchoolClass SchoolClass { get; set; }
  143. /// <summary>
  144. /// 一对一引用(校区)
  145. /// </summary>
  146. public virtual SysOrg SysOrgBranch { get; set; }
  147. /// <summary>
  148. /// 一对一引用(监测年级)
  149. /// </summary>
  150. public virtual ExamGrade ExamGrade { get; set; }
  151. ///// <summary>
  152. ///// 一对一引用(班级学生)
  153. ///// </summary>
  154. //public virtual SchoolClassStudent SchoolClassStudent { get; set; }
  155. ///// <summary>
  156. ///// 一对一引用(学生信息)
  157. ///// </summary>
  158. //public virtual Person Person { get; set; }
  159. public void Configure(EntityTypeBuilder<ExamStudent> entityBuilder, DbContext dbContext, Type dbContextLocator)
  160. {
  161. entityBuilder.HasIndex(a => new { a.ExamPlanId, a.SysOrgId }).HasDatabaseName("idx_exam_student_exam_plan_id_sys_org_id");
  162. entityBuilder.HasIndex(a => new { a.ExamPlanId, a.SysOrgId, a.SchoolClassId }).HasDatabaseName("idx_exam_student_exam_plan_id_soid_scid");
  163. }
  164. }