Browse Source

添加Demo类

master
郑勃旭 2 years ago
parent
commit
f903caf5e6
  1. 14
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain.Shared/Enums/SchoolType.cs
  2. 14
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain.Shared/Enums/StudentType.cs
  3. 11
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/AppBusiness/DictCityAdress/DictCityAdress.cs
  4. 8
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/AppBusiness/TestSchool/ITestSchoolRepository.cs
  5. 8
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/AppBusiness/TestSchool/ITestStudentDetailRepository.cs
  6. 43
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/AppBusiness/TestSchool/TestSchool.cs
  7. 33
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/AppBusiness/TestSchool/TestStudentDetail.cs
  8. 1
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/Faster.Zheng.Winin.Domain.csproj

14
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
}
}

14
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
}
}

11
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; }
}
}

8
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<TestSchool, Guid>
{
}

8
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<TestStudentDetail, Guid>
{
}

43
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<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;
}
}

33
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<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;
}
}

1
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/Faster.Zheng.Winin.Domain.csproj

@ -13,6 +13,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="7.0.1" />
<PackageReference Include="Volo.Abp.Emailing" Version="7.2.1" /> <PackageReference Include="Volo.Abp.Emailing" Version="7.2.1" />
<PackageReference Include="Volo.Abp.Identity.Domain" Version="7.2.1" /> <PackageReference Include="Volo.Abp.Identity.Domain" Version="7.2.1" />
<PackageReference Include="Volo.Abp.PermissionManagement.Domain.Identity" Version="7.2.1" /> <PackageReference Include="Volo.Abp.PermissionManagement.Domain.Identity" Version="7.2.1" />

Loading…
Cancel
Save