添加学校表和年级表,修改班级表结构
This commit is contained in:
@@ -2,9 +2,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Entities.Contracts
|
namespace Entities.Contracts
|
||||||
{
|
{
|
||||||
@@ -12,20 +9,19 @@ namespace Entities.Contracts
|
|||||||
public class Class
|
public class Class
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
[Column("id")]
|
[Column("class_id")]
|
||||||
public Guid Id { get; set; }
|
public int ClassId { get; set; }
|
||||||
|
|
||||||
[Column("grade")]
|
[Column("grade_id")]
|
||||||
public byte Grade { get; set; }
|
public int GradeId { get; set; }
|
||||||
|
public Grade Grade { get; set; }
|
||||||
|
|
||||||
[Column("class")]
|
[Column("class_name")]
|
||||||
public byte Number { get; set; }
|
[MaxLength(30)]
|
||||||
|
public string ClassName { get; set; }
|
||||||
[Column("description")]
|
|
||||||
public string Description { get; set; }
|
|
||||||
|
|
||||||
[Column("head_teacher_id")]
|
[Column("head_teacher_id")]
|
||||||
public Guid? HeadTeacherId { get; set; }
|
public int? HeadTeacherId { get; set; }
|
||||||
public User HeadTeacher { get; set; }
|
public User HeadTeacher { get; set; }
|
||||||
|
|
||||||
[Column("created_at")]
|
[Column("created_at")]
|
||||||
@@ -44,12 +40,11 @@ namespace Entities.Contracts
|
|||||||
|
|
||||||
public Class()
|
public Class()
|
||||||
{
|
{
|
||||||
Id = Guid.NewGuid();
|
|
||||||
Grade = 0;
|
|
||||||
Number = 0;
|
|
||||||
ClassStudents = new HashSet<ClassStudent>();
|
ClassStudents = new HashSet<ClassStudent>();
|
||||||
ClassTeachers = new HashSet<ClassTeacher>();
|
ClassTeachers = new HashSet<ClassTeacher>();
|
||||||
AssignmentClasses = new HashSet<AssignmentClass>();
|
AssignmentClasses = new HashSet<AssignmentClass>();
|
||||||
|
CreatedAt = DateTime.Now;
|
||||||
|
UpdatedAt = DateTime.Now;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
34
Entities/Contracts/Grade.cs
Normal file
34
Entities/Contracts/Grade.cs
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Entities.Contracts
|
||||||
|
{
|
||||||
|
[Table("grades")]
|
||||||
|
public class Grade
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
[Column("grade_id")]
|
||||||
|
public int GradeId { get; set; }
|
||||||
|
|
||||||
|
[Column("school_id")]
|
||||||
|
public int SchoolId { get; set; }
|
||||||
|
public School School { get; set; }
|
||||||
|
|
||||||
|
[Column("grade_name")]
|
||||||
|
[MaxLength(20)]
|
||||||
|
public string GradeName { get; set; }
|
||||||
|
|
||||||
|
[Column("grade_level")]
|
||||||
|
public int GradeLevel { get; set; }
|
||||||
|
|
||||||
|
// Navigation Properties
|
||||||
|
public ICollection<Class> Classes { get; set; }
|
||||||
|
|
||||||
|
public Grade()
|
||||||
|
{
|
||||||
|
Classes = new HashSet<Class>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
35
Entities/Contracts/School.cs
Normal file
35
Entities/Contracts/School.cs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Entities.Contracts
|
||||||
|
{
|
||||||
|
[Table("schools")]
|
||||||
|
public class School
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
[Column("school_id")]
|
||||||
|
public int SchoolId { get; set; }
|
||||||
|
|
||||||
|
[Column("school_name")]
|
||||||
|
[MaxLength(50)]
|
||||||
|
public string SchoolName { get; set; }
|
||||||
|
|
||||||
|
[Column("address")]
|
||||||
|
[MaxLength(100)]
|
||||||
|
public string Address { get; set; }
|
||||||
|
|
||||||
|
[Column("create_time")]
|
||||||
|
public DateTime CreateTime { get; set; }
|
||||||
|
|
||||||
|
// Navigation Properties
|
||||||
|
public ICollection<Grade> Grades { get; set; }
|
||||||
|
|
||||||
|
public School()
|
||||||
|
{
|
||||||
|
Grades = new HashSet<Grade>();
|
||||||
|
CreateTime = DateTime.Now;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user