ExamGrade.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. using Furion.DatabaseAccessor;
  2. using Microsoft.EntityFrameworkCore;
  3. using Microsoft.EntityFrameworkCore.Metadata.Builders;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.ComponentModel.DataAnnotations;
  7. using System.ComponentModel.DataAnnotations.Schema;
  8. namespace YBEE.EQM.Core;
  9. /// <summary>
  10. /// 监测年级
  11. /// </summary>
  12. [Comment("监测年级")]
  13. public class ExamGrade : DEntityBase, IEntityTypeBuilder<ExamGrade>
  14. {
  15. /// <summary>
  16. /// 监测计划ID
  17. /// </summary>
  18. [Comment("监测计划ID")]
  19. [Required]
  20. public int ExamPlanId { get; set; }
  21. /// <summary>
  22. /// 年级ID
  23. /// </summary>
  24. [Comment("年级ID")]
  25. [Required]
  26. public short GradeId { get; set; }
  27. /// <summary>
  28. /// 年份(级)
  29. /// </summary>
  30. [Comment("年份(级)")]
  31. [Required]
  32. public short GradeBeginYear { get; set; }
  33. /// <summary>
  34. /// 年份(届)
  35. /// </summary>
  36. [Comment("年份(届)")]
  37. [Required]
  38. public short GradeEndYear { get; set; }
  39. /// <summary>
  40. /// 学段
  41. /// </summary>
  42. [Comment("学段")]
  43. [Required, Column(TypeName = "smallint")]
  44. public EducationStage EducationStage { get; set; }
  45. /// <summary>
  46. /// 学制
  47. /// </summary>
  48. [Comment("学制")]
  49. [Required]
  50. public short EducationYears { get; set; }
  51. /// <summary>
  52. /// 是否需要自编监测号
  53. /// </summary>
  54. [Comment("是否需要自编监测号")]
  55. [Required]
  56. public bool IsRequiredSelfExamNumber { get; set; } = false;
  57. /// <summary>
  58. /// 自编监测号长度
  59. /// </summary>
  60. [Comment("自编监测号长度")]
  61. [Required]
  62. public short SelfExamNumberLength { get; set; } = 0;
  63. /// <summary>
  64. /// 是否需要抽样监测
  65. /// </summary>
  66. [Comment("是否需要抽样监测")]
  67. [Required]
  68. public bool IsRequiredSample { get; set; } = true;
  69. /// <summary>
  70. /// 总分分数段类型
  71. /// </summary>
  72. [Comment("总分分数段类型")]
  73. public ExamScoreRangeType ExamScoreRangeType { get; set; } = ExamScoreRangeType.NONE;
  74. /// <summary>
  75. /// 备注
  76. /// </summary>
  77. [Comment("备注")]
  78. [StringLength(200)]
  79. public string Remark { get; set; } = "";
  80. /// <summary>
  81. /// 一对一引用(年级)
  82. /// </summary>
  83. public virtual Grade Grade { get; set; }
  84. /// <summary>
  85. /// 一对一引用(监测计划)
  86. /// </summary>
  87. public virtual ExamPlan ExamPlan { get; set; }
  88. /// <summary>
  89. /// 一对多引用(监测科目)
  90. /// </summary>
  91. public ICollection<ExamCourse> ExamCourses { get; } = new List<ExamCourse>();
  92. public void Configure(EntityTypeBuilder<ExamGrade> entityBuilder, DbContext dbContext, Type dbContextLocator)
  93. {
  94. entityBuilder.HasIndex(x => new { x.ExamPlanId, x.GradeId }).IsUnique().HasDatabaseName("idx_exam_grade_exam_plan_id_grade_id");
  95. }
  96. }