8 changed files with 132 additions and 0 deletions
@ -0,0 +1,14 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
|
namespace Faster.Zheng.Winin.Enums |
||||
|
{ |
||||
|
public enum SchoolType |
||||
|
{ |
||||
|
[Display(Name = "未定义")] |
||||
|
None=0, |
||||
|
[Display(Name = "坏学校")] |
||||
|
NoGoodSchool=1, |
||||
|
[Display(Name = "好学校")] |
||||
|
GoodSchool = 2 |
||||
|
} |
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
|
namespace Faster.Zheng.Winin.Enums |
||||
|
{ |
||||
|
public enum StudentType |
||||
|
{ |
||||
|
[Display(Name = "未定义")] |
||||
|
None=0, |
||||
|
[Display(Name = "坏学生")] |
||||
|
Nok=1, |
||||
|
[Display(Name = "好学生")] |
||||
|
Ok=2 |
||||
|
} |
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
|
||||
|
namespace Faster.Zheng.Winin.AppBusiness.DictCityAdress |
||||
|
{ |
||||
|
[Owned] //值对象特性
|
||||
|
public class DictCityAdress |
||||
|
{ |
||||
|
public string City { get; set; } |
||||
|
public string Street { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,8 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp.Domain.Repositories; |
||||
|
|
||||
|
namespace Faster.Zheng.Winin.AppBusiness.TestSchool; |
||||
|
|
||||
|
public interface ITestSchoolRepository : IRepository<TestSchool, Guid> |
||||
|
{ |
||||
|
} |
@ -0,0 +1,8 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp.Domain.Repositories; |
||||
|
|
||||
|
namespace Faster.Zheng.Winin.AppBusiness.TestSchool; |
||||
|
|
||||
|
public interface ITestStudentDetailRepository : IRepository<TestStudentDetail, Guid> |
||||
|
{ |
||||
|
} |
@ -0,0 +1,43 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Faster.Zheng.Winin.Enums; |
||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using Volo.Abp.Domain.Entities.Auditing; |
||||
|
|
||||
|
namespace Faster.Zheng.Winin.AppBusiness.TestSchool; |
||||
|
|
||||
|
//[Table("School")] 不起作用
|
||||
|
[Index(nameof(TestSchool.SchoolName), nameof(TestSchool.OrderType))] |
||||
|
public class TestSchool : AuditedAggregateRoot<Guid> |
||||
|
{ |
||||
|
public string SchoolName { get; set; } |
||||
|
|
||||
|
public SchoolType OrderType { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 键值对的属性 需要添加非空 否则会有警告 但不影响使用
|
||||
|
/// </summary>
|
||||
|
[Required] |
||||
|
public DictCityAdress.DictCityAdress CityAdress { get; set; } |
||||
|
|
||||
|
public List<TestStudentDetail> Details { get; set; } = new(); |
||||
|
|
||||
|
protected TestSchool() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
public TestSchool( |
||||
|
Guid id, |
||||
|
string schoolName, |
||||
|
SchoolType orderType, |
||||
|
DictCityAdress.DictCityAdress cityAdress, |
||||
|
List<TestStudentDetail> details |
||||
|
) : base(id) |
||||
|
{ |
||||
|
SchoolName = schoolName; |
||||
|
OrderType = orderType; |
||||
|
CityAdress = cityAdress; |
||||
|
Details = details; |
||||
|
} |
||||
|
} |
@ -0,0 +1,33 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations.Schema; |
||||
|
using Faster.Zheng.Winin.Enums; |
||||
|
using Volo.Abp.Domain.Entities.Auditing; |
||||
|
|
||||
|
namespace Faster.Zheng.Winin.AppBusiness.TestSchool; |
||||
|
|
||||
|
//[Table("Student")] 不起作用
|
||||
|
public class TestStudentDetail : AuditedAggregateRoot<Guid> |
||||
|
{ |
||||
|
[ForeignKey(nameof(TestStudentDetail.MasterId))] |
||||
|
public Guid MasterId { get; set; } |
||||
|
|
||||
|
public string StudentName { get; set; } |
||||
|
|
||||
|
public StudentType OrderType { get; set; } |
||||
|
|
||||
|
protected TestStudentDetail() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
public TestStudentDetail( |
||||
|
Guid id, |
||||
|
Guid masterId, |
||||
|
string studentName, |
||||
|
StudentType orderType |
||||
|
) : base(id) |
||||
|
{ |
||||
|
MasterId = masterId; |
||||
|
StudentName = studentName; |
||||
|
OrderType = orderType; |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue