From 9b5f19c02fd25dfc7b872c799f8496b27c368c9b Mon Sep 17 00:00:00 2001 From: NoahLan <6995syu@163.com> Date: Sat, 11 May 2024 14:35:20 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BC=98=E5=8C=96entity=EF=BC=8C?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=E8=A1=A8=E5=90=8D=EF=BC=8C=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E8=87=AA=E5=8A=A8=E5=BC=80=E5=90=AF=E6=B5=8F?= =?UTF-8?q?=E8=A7=88=E5=99=A8=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/OrganizationDto.cs | 64 +++++------ .../Dtos/PostDto.cs | 34 +++--- .../Dtos/RoleDto.cs | 56 +++++----- .../Dtos/UserDto.cs | 100 +++++++++--------- .../NPinFrameworkUpmsDomainSharedModule.cs | 42 ++++---- .../Entities/AnnouncementEntity.cs | 10 +- .../Entities/ConfigEntity.cs | 10 +- .../Entities/FileAggregateRoot.cs | 8 +- .../Entities/LoginLogEntity.cs | 6 +- .../Entities/OrganizationEntity.cs | 10 +- .../Entities/PostEntity.cs | 10 +- .../Entities/RoleEntity.cs | 10 +- .../Entities/UserMetaEntity.cs | 8 +- .../OperLog/OperationLogEntity.cs | 4 +- src/NPin.Web/Properties/launchSettings.json | 2 +- 15 files changed, 187 insertions(+), 187 deletions(-) diff --git a/module/upms/NPin.Framework.Upms.Domain.Shared/Dtos/OrganizationDto.cs b/module/upms/NPin.Framework.Upms.Domain.Shared/Dtos/OrganizationDto.cs index 3cdb227..6f2f323 100644 --- a/module/upms/NPin.Framework.Upms.Domain.Shared/Dtos/OrganizationDto.cs +++ b/module/upms/NPin.Framework.Upms.Domain.Shared/Dtos/OrganizationDto.cs @@ -1,33 +1,33 @@ -namespace NPin.Framework.Upms.Domain.Shared.Dtos; - -public class OrganizationDto -{ - public Guid Id { get; set; } - - public string Name { get; set; } = string.Empty; - public string Code { get; set; } = string.Empty; - public string? Remark { get; set; } - - /// - /// 负责人ID - /// - public Guid LeaderId { get; set; } - - /// - /// 负责人名称,仅用户展示,不存储 - /// - public string Leader { get; set; } - - /// - /// 父节点 ID - /// - public Guid ParentId { get; set; } - - public bool IsDeleted { get; } - public DateTime CreationTime { get; } = DateTime.Now; - public Guid? CreatorId { get; } - public DateTime? LastModificationTime { get; } - public Guid? LastModifierId { get; } - public int OrderNum { get; set; } - public bool IsEnabled { get; set; } +namespace NPin.Framework.Upms.Domain.Shared.Dtos; + +public class OrganizationDto +{ + public Guid Id { get; set; } + + public string Name { get; set; } = string.Empty; + public string Code { get; set; } = string.Empty; + public string? Remark { get; set; } + + /// + /// 负责人ID + /// + public Guid LeaderId { get; set; } + + /// + /// 负责人名称,仅用户展示,不存储 + /// + public string Leader { get; set; } + + /// + /// 父节点 ID + /// + public Guid ParentId { get; set; } + + public bool IsDeleted { get; set; } + public DateTime CreationTime { get; } = DateTime.Now; + public Guid? CreatorId { get; set; } + public DateTime? LastModificationTime { get; set; } + public Guid? LastModifierId { get; set; } + public int OrderNum { get; set; } + public bool IsEnabled { get; set; } } \ No newline at end of file diff --git a/module/upms/NPin.Framework.Upms.Domain.Shared/Dtos/PostDto.cs b/module/upms/NPin.Framework.Upms.Domain.Shared/Dtos/PostDto.cs index d237836..a9f1577 100644 --- a/module/upms/NPin.Framework.Upms.Domain.Shared/Dtos/PostDto.cs +++ b/module/upms/NPin.Framework.Upms.Domain.Shared/Dtos/PostDto.cs @@ -1,18 +1,18 @@ -namespace NPin.Framework.Upms.Domain.Shared.Dtos; - -public class PostDto -{ - public Guid Id { get; set; } - - public string Code { get; set; } = string.Empty; - public string Name { get; set; } = string.Empty; - public string? Remark { get; set; } - - public bool IsDeleted { get; } - public DateTime CreationTime { get; } = DateTime.Now; - public Guid? CreatorId { get; } - public DateTime? LastModificationTime { get; } - public Guid? LastModifierId { get; } - public int OrderNum { get; set; } - public bool IsEnabled { get; set; } +namespace NPin.Framework.Upms.Domain.Shared.Dtos; + +public class PostDto +{ + public Guid Id { get; set; } + + public string Code { get; set; } = string.Empty; + public string Name { get; set; } = string.Empty; + public string? Remark { get; set; } + + public bool IsDeleted { get; set; } + public DateTime CreationTime { get; } = DateTime.Now; + public Guid? CreatorId { get; set; } + public DateTime? LastModificationTime { get; set; } + public Guid? LastModifierId { get; set; } + public int OrderNum { get; set; } + public bool IsEnabled { get; set; } } \ No newline at end of file diff --git a/module/upms/NPin.Framework.Upms.Domain.Shared/Dtos/RoleDto.cs b/module/upms/NPin.Framework.Upms.Domain.Shared/Dtos/RoleDto.cs index 4bdad92..e39ac65 100644 --- a/module/upms/NPin.Framework.Upms.Domain.Shared/Dtos/RoleDto.cs +++ b/module/upms/NPin.Framework.Upms.Domain.Shared/Dtos/RoleDto.cs @@ -1,29 +1,29 @@ -using NPin.Framework.Upms.Domain.Shared.Enums; - -namespace NPin.Framework.Upms.Domain.Shared.Dtos; - -public class RoleFullDto -{ - public RoleDto Role { get; set; } = new(); - - // Relations - public HashSet OrganizationList { get; set; } = []; -} - -public class RoleDto -{ - public Guid Id { get; set; } - - public string Code { get; set; } = string.Empty; - public string Name { get; set; } = string.Empty; - public DataScopeEnum DataScope { get; set; } = DataScopeEnum.All; - public string? Remark { get; set; } - - public bool IsDeleted { get; } - public DateTime CreationTime { get; } = DateTime.Now; - public Guid? CreatorId { get; } - public DateTime? LastModificationTime { get; } - public Guid? LastModifierId { get; } - public int OrderNum { get; set; } - public bool IsEnabled { get; set; } +using NPin.Framework.Upms.Domain.Shared.Enums; + +namespace NPin.Framework.Upms.Domain.Shared.Dtos; + +public class RoleFullDto +{ + public RoleDto Role { get; set; } = new(); + + // Relations + public HashSet OrganizationList { get; set; } = []; +} + +public class RoleDto +{ + public Guid Id { get; set; } + + public string Code { get; set; } = string.Empty; + public string Name { get; set; } = string.Empty; + public DataScopeEnum DataScope { get; set; } = DataScopeEnum.All; + public string? Remark { get; set; } + + public bool IsDeleted { get; set; } + public DateTime CreationTime { get; } = DateTime.Now; + public Guid? CreatorId { get; set; } + public DateTime? LastModificationTime { get; set; } + public Guid? LastModifierId { get; set; } + public int OrderNum { get; set; } + public bool IsEnabled { get; set; } } \ No newline at end of file diff --git a/module/upms/NPin.Framework.Upms.Domain.Shared/Dtos/UserDto.cs b/module/upms/NPin.Framework.Upms.Domain.Shared/Dtos/UserDto.cs index 275dc73..bdcd095 100644 --- a/module/upms/NPin.Framework.Upms.Domain.Shared/Dtos/UserDto.cs +++ b/module/upms/NPin.Framework.Upms.Domain.Shared/Dtos/UserDto.cs @@ -1,51 +1,51 @@ -using NPin.Framework.Upms.Domain.Shared.Enums; - -namespace NPin.Framework.Upms.Domain.Shared.Dtos; - -/// -/// 完整用户信息Dto -/// 包括所有关联关系 -/// -public class UserFullDto -{ - public UserDto User { get; set; } = new(); - - // Relations - public HashSet Roles { get; set; } = []; - public HashSet Posts { get; set; } = []; - public HashSet Organizations { get; set; } = []; - - public HashSet PostCodes { get; set; } = []; - public HashSet RoleCodes { get; set; } = []; - public HashSet PermissionCodes { get; set; } = []; -} - -public class UserDto -{ - /// - /// 主键ID - /// - public Guid Id { get; set; } - - public bool IsDeleted { get; } - public DateTime CreationTime { get; } = DateTime.Now; - public Guid? CreatorId { get; } - public DateTime? LastModificationTime { get; } - public Guid? LastModifierId { get; } - public bool IsEnabled { get; set; } - public int OrderNum { get; set; } - - public string Username { get; set; } = string.Empty; - public string PhoneNumber { get; set; } - public string? Email { get; set; } - public string? Nickname { get; set; } - public string Password { get; set; } = string.Empty; - public string Salt { get; set; } = string.Empty; - public string? Introduction { get; set; } - public GenderEnum Gender { get; set; } = GenderEnum.Secrecy; - public string? IpAddr { get; set; } - public string? Avatar { get; set; } - - // For user (metadata) - public Dictionary Metadata { get; set; } +using NPin.Framework.Upms.Domain.Shared.Enums; + +namespace NPin.Framework.Upms.Domain.Shared.Dtos; + +/// +/// 完整用户信息Dto +/// 包括所有关联关系 +/// +public class UserFullDto +{ + public UserDto User { get; set; } = new(); + + // Relations + public HashSet Roles { get; set; } = []; + public HashSet Posts { get; set; } = []; + public HashSet Organizations { get; set; } = []; + + public HashSet PostCodes { get; set; } = []; + public HashSet RoleCodes { get; set; } = []; + public HashSet PermissionCodes { get; set; } = []; +} + +public class UserDto +{ + /// + /// 主键ID + /// + public Guid Id { get; set; } + + public bool IsDeleted { get; set; } + public DateTime CreationTime { get; } = DateTime.Now; + public Guid? CreatorId { get; set; } + public DateTime? LastModificationTime { get; set; } + public Guid? LastModifierId { get; set; } + public bool IsEnabled { get; set; } + public int OrderNum { get; set; } + + public string Username { get; set; } = string.Empty; + public string PhoneNumber { get; set; } + public string? Email { get; set; } + public string? Nickname { get; set; } + public string Password { get; set; } = string.Empty; + public string Salt { get; set; } = string.Empty; + public string? Introduction { get; set; } + public GenderEnum Gender { get; set; } = GenderEnum.Secrecy; + public string? IpAddr { get; set; } + public string? Avatar { get; set; } + + // For user (metadata) + public Dictionary Metadata { get; set; } } \ No newline at end of file diff --git a/module/upms/NPin.Framework.Upms.Domain.Shared/NPinFrameworkUpmsDomainSharedModule.cs b/module/upms/NPin.Framework.Upms.Domain.Shared/NPinFrameworkUpmsDomainSharedModule.cs index 57a5513..660f1c6 100644 --- a/module/upms/NPin.Framework.Upms.Domain.Shared/NPinFrameworkUpmsDomainSharedModule.cs +++ b/module/upms/NPin.Framework.Upms.Domain.Shared/NPinFrameworkUpmsDomainSharedModule.cs @@ -1,22 +1,22 @@ -using Microsoft.Extensions.DependencyInjection; -using NPin.Framework.Mapster; -using NPin.Framework.Upms.Domain.Shared.Options; -using Volo.Abp.Domain; - -namespace NPin.Framework.Upms.Domain.Shared; - -[DependsOn( - typeof(AbpDddDomainSharedModule), - typeof(NPinFrameworkMapsterModule) -)] -public class NPinFrameworkUpmsDomainSharedModule : AbpModule -{ - public override void ConfigureServices(ServiceConfigurationContext context) - { - var configuration = context.Services.GetConfiguration(); - // 配置文件读取 - Configure(configuration.GetSection(nameof(JwtOptions))); - Configure(configuration.GetSection(nameof(RefreshJwtOptions))); - Configure(configuration.GetSection(nameof(UpmsOptions))); - } +using Microsoft.Extensions.DependencyInjection; +using NPin.Framework.Mapster; +using NPin.Framework.Upms.Domain.Shared.Options; +using Volo.Abp.Domain; + +namespace NPin.Framework.Upms.Domain.Shared; + +[DependsOn( + typeof(AbpDddDomainSharedModule), + typeof(NPinFrameworkMapsterModule) +)] +public class NPinFrameworkUpmsDomainSharedModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + var configuration = context.Services.GetConfiguration(); + // 配置文件读取 + Configure(configuration.GetSection(nameof(JwtOptions))); + Configure(configuration.GetSection(nameof(RefreshJwtOptions))); + Configure(configuration.GetSection(nameof(UpmsOptions))); + } } \ No newline at end of file diff --git a/module/upms/NPin.Framework.Upms.Domain/Entities/AnnouncementEntity.cs b/module/upms/NPin.Framework.Upms.Domain/Entities/AnnouncementEntity.cs index 69c05f4..2f44f4f 100644 --- a/module/upms/NPin.Framework.Upms.Domain/Entities/AnnouncementEntity.cs +++ b/module/upms/NPin.Framework.Upms.Domain/Entities/AnnouncementEntity.cs @@ -22,11 +22,11 @@ public class AnnouncementEntity : Entity, ISoftDelete, IAuditedObject, IOr [SugarColumn(ColumnDescription = "公告内容", ColumnDataType = StaticConfig.CodeFirst_BigString)] public string Content { get; set; } - public bool IsDeleted { get; } - public DateTime CreationTime { get; } - public Guid? CreatorId { get; } - public DateTime? LastModificationTime { get; } - public Guid? LastModifierId { get; } + public bool IsDeleted { get; set; } + public DateTime CreationTime { get; set; } = DateTime.Now; + public Guid? CreatorId { get; set; } + public DateTime? LastModificationTime { get; set; } + public Guid? LastModifierId { get; set; } public int OrderNum { get; set; } public bool IsEnabled { get; set; } } \ No newline at end of file diff --git a/module/upms/NPin.Framework.Upms.Domain/Entities/ConfigEntity.cs b/module/upms/NPin.Framework.Upms.Domain/Entities/ConfigEntity.cs index 598ea73..d64ad89 100644 --- a/module/upms/NPin.Framework.Upms.Domain/Entities/ConfigEntity.cs +++ b/module/upms/NPin.Framework.Upms.Domain/Entities/ConfigEntity.cs @@ -26,9 +26,9 @@ public class ConfigEntity : Entity, IEnabled, IOrderNum, ISoftDelete, IAud public bool IsEnabled { get; set; } public int OrderNum { get; set; } - public bool IsDeleted { get; } - public DateTime CreationTime { get; } - public Guid? CreatorId { get; } - public DateTime? LastModificationTime { get; } - public Guid? LastModifierId { get; } + public bool IsDeleted { get; set; } + public DateTime CreationTime { get; set; } = DateTime.Now; + public Guid? CreatorId { get; set; } + public DateTime? LastModificationTime { get; set; } + public Guid? LastModifierId { get; set; } } \ No newline at end of file diff --git a/module/upms/NPin.Framework.Upms.Domain/Entities/FileAggregateRoot.cs b/module/upms/NPin.Framework.Upms.Domain/Entities/FileAggregateRoot.cs index 7c1b445..003dc86 100644 --- a/module/upms/NPin.Framework.Upms.Domain/Entities/FileAggregateRoot.cs +++ b/module/upms/NPin.Framework.Upms.Domain/Entities/FileAggregateRoot.cs @@ -23,10 +23,10 @@ public class FileAggregateRoot : AggregateRoot, IAuditedObject [SugarColumn(ColumnDescription = "文件路径")] public string FilePath { get; set; } - public DateTime CreationTime { get; } - public Guid? CreatorId { get; } - public DateTime? LastModificationTime { get; } - public Guid? LastModifierId { get; } + public DateTime CreationTime { get; set; } = DateTime.Now; + public Guid? CreatorId { get; set; } + public DateTime? LastModificationTime { get; set; } + public Guid? LastModifierId { get; set; } [SugarColumn(IsIgnore = true)] public override ExtraPropertyDictionary ExtraProperties { get; protected set; } diff --git a/module/upms/NPin.Framework.Upms.Domain/Entities/LoginLogEntity.cs b/module/upms/NPin.Framework.Upms.Domain/Entities/LoginLogEntity.cs index 1365400..ea173bf 100644 --- a/module/upms/NPin.Framework.Upms.Domain/Entities/LoginLogEntity.cs +++ b/module/upms/NPin.Framework.Upms.Domain/Entities/LoginLogEntity.cs @@ -16,8 +16,8 @@ public class LoginLogEntity : Entity, ICreationAuditedObject { [SugarColumn(IsPrimaryKey = true)] public override Guid Id { get; protected set; } - public DateTime CreationTime { get; } - public Guid? CreatorId { get; } + public DateTime CreationTime { get; set; } = DateTime.Now; + public Guid? CreatorId { get; set; } [SugarColumn(ColumnDescription = "登录用户")] public string? LoginUser { get; set; } @@ -61,7 +61,7 @@ public class LoginLogEntity : Entity, ICreationAuditedObject break; } } - + var location = IPAddress.IsLoopback(ipAddr) ? new IpInfo { Province = "本地", City = "本机" } : IpTool.Search(ipAddr.ToString()); diff --git a/module/upms/NPin.Framework.Upms.Domain/Entities/OrganizationEntity.cs b/module/upms/NPin.Framework.Upms.Domain/Entities/OrganizationEntity.cs index 2c9391e..a1e8d94 100644 --- a/module/upms/NPin.Framework.Upms.Domain/Entities/OrganizationEntity.cs +++ b/module/upms/NPin.Framework.Upms.Domain/Entities/OrganizationEntity.cs @@ -36,11 +36,11 @@ public class OrganizationEntity : Entity, ISoftDelete, IAuditedObject, IOr /// public Guid ParentId { get; set; } - public bool IsDeleted { get; } - public DateTime CreationTime { get; } = DateTime.Now; - public Guid? CreatorId { get; } - public DateTime? LastModificationTime { get; } - public Guid? LastModifierId { get; } + public bool IsDeleted { get; set; } + public DateTime CreationTime { get; set; } = DateTime.Now; + public Guid? CreatorId { get; set; } + public DateTime? LastModificationTime { get; set; } + public Guid? LastModifierId { get; set; } public int OrderNum { get; set; } public bool IsEnabled { get; set; } } \ No newline at end of file diff --git a/module/upms/NPin.Framework.Upms.Domain/Entities/PostEntity.cs b/module/upms/NPin.Framework.Upms.Domain/Entities/PostEntity.cs index 7464309..1f21cc3 100644 --- a/module/upms/NPin.Framework.Upms.Domain/Entities/PostEntity.cs +++ b/module/upms/NPin.Framework.Upms.Domain/Entities/PostEntity.cs @@ -20,11 +20,11 @@ public class PostEntity : Entity, ISoftDelete, IAuditedObject, IOrderNum, [SugarColumn(ColumnDescription = "岗位描述")] public string? Remark { get; set; } - public bool IsDeleted { get; } - public DateTime CreationTime { get; } = DateTime.Now; - public Guid? CreatorId { get; } - public DateTime? LastModificationTime { get; } - public Guid? LastModifierId { get; } + public bool IsDeleted { get; set;} + public DateTime CreationTime { get; set;} = DateTime.Now; + public Guid? CreatorId { get; set;} + public DateTime? LastModificationTime { get; set;} + public Guid? LastModifierId { get; set;} public int OrderNum { get; set; } public bool IsEnabled { get; set; } } \ No newline at end of file diff --git a/module/upms/NPin.Framework.Upms.Domain/Entities/RoleEntity.cs b/module/upms/NPin.Framework.Upms.Domain/Entities/RoleEntity.cs index d1c3cdc..5b4e21c 100644 --- a/module/upms/NPin.Framework.Upms.Domain/Entities/RoleEntity.cs +++ b/module/upms/NPin.Framework.Upms.Domain/Entities/RoleEntity.cs @@ -24,11 +24,11 @@ public class RoleEntity : Entity, ISoftDelete, IAuditedObject, IOrderNum, [SugarColumn(ColumnDescription = "描述")] public string? Remark { get; set; } - public bool IsDeleted { get; } - public DateTime CreationTime { get; } = DateTime.Now; - public Guid? CreatorId { get; } - public DateTime? LastModificationTime { get; } - public Guid? LastModifierId { get; } + public bool IsDeleted { get; set; } + public DateTime CreationTime { get; set; } = DateTime.Now; + public Guid? CreatorId { get; set; } + public DateTime? LastModificationTime { get; set; } + public Guid? LastModifierId { get; set; } public int OrderNum { get; set; } public bool IsEnabled { get; set; } diff --git a/module/upms/NPin.Framework.Upms.Domain/Entities/UserMetaEntity.cs b/module/upms/NPin.Framework.Upms.Domain/Entities/UserMetaEntity.cs index 4c32089..5bca47d 100644 --- a/module/upms/NPin.Framework.Upms.Domain/Entities/UserMetaEntity.cs +++ b/module/upms/NPin.Framework.Upms.Domain/Entities/UserMetaEntity.cs @@ -17,8 +17,8 @@ public class UserMetaEntity : Entity, IAuditedObject [SugarColumn(ColumnDescription = "元数据 值")] public string Value { get; set; } - public DateTime CreationTime { get; } - public Guid? CreatorId { get; } - public DateTime? LastModificationTime { get; } - public Guid? LastModifierId { get; } + public DateTime CreationTime { get; set; } = DateTime.Now; + public Guid? CreatorId { get; set; } + public DateTime? LastModificationTime { get; set; } + public Guid? LastModifierId { get; set; } } \ No newline at end of file diff --git a/module/upms/NPin.Framework.Upms.Domain/OperLog/OperationLogEntity.cs b/module/upms/NPin.Framework.Upms.Domain/OperLog/OperationLogEntity.cs index 367865c..2399dc4 100644 --- a/module/upms/NPin.Framework.Upms.Domain/OperLog/OperationLogEntity.cs +++ b/module/upms/NPin.Framework.Upms.Domain/OperLog/OperationLogEntity.cs @@ -45,8 +45,8 @@ public class OperationLogEntity : Entity, ICreationAuditedObject [SugarColumn(ColumnDescription = "请求结果", Length = 9999)] public string? RequestResult { get; set; } - public DateTime CreationTime { get; } - public Guid? CreatorId { get; } + public DateTime CreationTime { get; set; } = DateTime.Now; + public Guid? CreatorId { get; set; } public static OperationLogEntity GetInfoByHttpContext(HttpContext httpContext) { diff --git a/src/NPin.Web/Properties/launchSettings.json b/src/NPin.Web/Properties/launchSettings.json index 29e3d78..ff9291a 100644 --- a/src/NPin.Web/Properties/launchSettings.json +++ b/src/NPin.Web/Properties/launchSettings.json @@ -3,7 +3,7 @@ "profiles": { "NPin.Web": { "commandName": "Project", - "launchBrowser": true, + "launchBrowser": false, "launchUrl": "swagger", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development"