From f903caf5e65f963d4781067845fd7fc207993a0d Mon Sep 17 00:00:00 2001 From: "boxu.zheng" Date: Wed, 14 Jun 2023 17:22:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0Demo=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Enums/SchoolType.cs | 14 ++++++ .../Enums/StudentType.cs | 14 ++++++ .../DictCityAdress/DictCityAdress.cs | 11 +++++ .../TestSchool/ITestSchoolRepository.cs | 8 ++++ .../ITestStudentDetailRepository.cs | 8 ++++ .../AppBusiness/TestSchool/TestSchool.cs | 43 +++++++++++++++++++ .../TestSchool/TestStudentDetail.cs | 33 ++++++++++++++ .../Faster.Zheng.Winin.Domain.csproj | 1 + 8 files changed, 132 insertions(+) create mode 100644 Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain.Shared/Enums/SchoolType.cs create mode 100644 Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain.Shared/Enums/StudentType.cs create mode 100644 Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/AppBusiness/DictCityAdress/DictCityAdress.cs create mode 100644 Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/AppBusiness/TestSchool/ITestSchoolRepository.cs create mode 100644 Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/AppBusiness/TestSchool/ITestStudentDetailRepository.cs create mode 100644 Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/AppBusiness/TestSchool/TestSchool.cs create mode 100644 Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/AppBusiness/TestSchool/TestStudentDetail.cs diff --git a/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain.Shared/Enums/SchoolType.cs b/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain.Shared/Enums/SchoolType.cs new file mode 100644 index 0000000..2145c41 --- /dev/null +++ b/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain.Shared/Enums/SchoolType.cs @@ -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 + } +} diff --git a/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain.Shared/Enums/StudentType.cs b/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain.Shared/Enums/StudentType.cs new file mode 100644 index 0000000..449b095 --- /dev/null +++ b/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain.Shared/Enums/StudentType.cs @@ -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 + } +} diff --git a/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/AppBusiness/DictCityAdress/DictCityAdress.cs b/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/AppBusiness/DictCityAdress/DictCityAdress.cs new file mode 100644 index 0000000..dcc8257 --- /dev/null +++ b/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/AppBusiness/DictCityAdress/DictCityAdress.cs @@ -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; } + } +} diff --git a/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/AppBusiness/TestSchool/ITestSchoolRepository.cs b/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/AppBusiness/TestSchool/ITestSchoolRepository.cs new file mode 100644 index 0000000..8096d97 --- /dev/null +++ b/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/AppBusiness/TestSchool/ITestSchoolRepository.cs @@ -0,0 +1,8 @@ +using System; +using Volo.Abp.Domain.Repositories; + +namespace Faster.Zheng.Winin.AppBusiness.TestSchool; + +public interface ITestSchoolRepository : IRepository +{ +} diff --git a/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/AppBusiness/TestSchool/ITestStudentDetailRepository.cs b/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/AppBusiness/TestSchool/ITestStudentDetailRepository.cs new file mode 100644 index 0000000..4372468 --- /dev/null +++ b/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/AppBusiness/TestSchool/ITestStudentDetailRepository.cs @@ -0,0 +1,8 @@ +using System; +using Volo.Abp.Domain.Repositories; + +namespace Faster.Zheng.Winin.AppBusiness.TestSchool; + +public interface ITestStudentDetailRepository : IRepository +{ +} diff --git a/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/AppBusiness/TestSchool/TestSchool.cs b/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/AppBusiness/TestSchool/TestSchool.cs new file mode 100644 index 0000000..a12e2f6 --- /dev/null +++ b/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/AppBusiness/TestSchool/TestSchool.cs @@ -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 +{ + public string SchoolName { get; set; } + + public SchoolType OrderType { get; set; } + + /// + /// 键值对的属性 需要添加非空 否则会有警告 但不影响使用 + /// + [Required] + public DictCityAdress.DictCityAdress CityAdress { get; set; } + + public List Details { get; set; } = new(); + + protected TestSchool() + { + } + + public TestSchool( + Guid id, + string schoolName, + SchoolType orderType, + DictCityAdress.DictCityAdress cityAdress, + List details + ) : base(id) + { + SchoolName = schoolName; + OrderType = orderType; + CityAdress = cityAdress; + Details = details; + } +} diff --git a/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/AppBusiness/TestSchool/TestStudentDetail.cs b/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/AppBusiness/TestSchool/TestStudentDetail.cs new file mode 100644 index 0000000..2691a6a --- /dev/null +++ b/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/AppBusiness/TestSchool/TestStudentDetail.cs @@ -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 +{ + [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; + } +} diff --git a/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/Faster.Zheng.Winin.Domain.csproj b/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/Faster.Zheng.Winin.Domain.csproj index d37ff3c..e812f73 100644 --- a/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/Faster.Zheng.Winin.Domain.csproj +++ b/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/Faster.Zheng.Winin.Domain.csproj @@ -13,6 +13,7 @@ +