mirror of
https://github.com/nsnail/NetAdmin.git
synced 2025-08-02 18:17:31 +08:00
Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
e48b425121 | |||
faaf5aa0fc | |||
e1bea2ec31 | |||
33e60a5bd7 | |||
1a28e8d5a6 | |||
60ec6ea2c1 | |||
6d4ccf3445 | |||
1733802e02 | |||
aaea28389a | |||
be5b9a160d | |||
67eaa5b783 | |||
8b01112f42 |
16
CHANGELOG.md
16
CHANGELOG.md
@ -2,6 +2,22 @@
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
## [1.5.0](https://github.com/nsnail/NetAdmin/compare/v1.4.0...v1.5.0) (2024-07-26)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ 登录日志独立存储 ([#161](https://github.com/nsnail/NetAdmin/issues/161)) ([faaf5aa](https://github.com/nsnail/NetAdmin/commit/faaf5aa0fc5299633ca4f384d6287171bb241ff4))
|
||||
* ✨ 框架代码同步 ([#158](https://github.com/nsnail/NetAdmin/issues/158)) ([1a28e8d](https://github.com/nsnail/NetAdmin/commit/1a28e8d5a62aeab7e4fda5049b4f733a16480b67))
|
||||
* ✨ 请求日志增加TraceId ([#154](https://github.com/nsnail/NetAdmin/issues/154)) ([aaea283](https://github.com/nsnail/NetAdmin/commit/aaea28389a56566e055b6651cf48a89194a72cb7))
|
||||
* ✨ cron表达式的自然语言表达 ([#156](https://github.com/nsnail/NetAdmin/issues/156)) ([6d4ccf3](https://github.com/nsnail/NetAdmin/commit/6d4ccf344595e128a445f1cb7596a7a1c28fd4cd))
|
||||
* ✨ logoBar显示程序版本号 ([#153](https://github.com/nsnail/NetAdmin/issues/153)) ([be5b9a1](https://github.com/nsnail/NetAdmin/commit/be5b9a160d1f06cfdf36cea4e5eb95908523fed2))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 error CS0117: 'Numbers' does not contain a definition for 'SECS_CACHE_DIC_CATALOG_CODE' ([#155](https://github.com/nsnail/NetAdmin/issues/155)) ([1733802](https://github.com/nsnail/NetAdmin/commit/1733802e02b7e69e4c8646f259da5098b87888f7))
|
||||
|
||||
## [1.4.0](https://github.com/nsnail/NetAdmin/compare/v1.3.0...v1.4.0) (2024-07-03)
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:9.0.0-preview.5 AS base
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:9.0.0-preview.6 AS base
|
||||
WORKDIR /app
|
||||
EXPOSE 8080
|
||||
RUN apt update
|
||||
|
@ -9,12 +9,13 @@
|
||||
|
||||
## 在线预览
|
||||
|
||||
http://na.yaopy.com (演示站点仅300kbps带宽,访问较慢)
|
||||
http://47.110.248.163:12000
|
||||
|
||||
## 一键运行
|
||||
|
||||
```shell
|
||||
docker run -p 8080:8080 nsnail/netadmin
|
||||
# 需翻墙
|
||||
```
|
||||
|
||||
## 构建步骤
|
||||
|
@ -98,6 +98,8 @@
|
||||
电子邮箱
|
||||
男
|
||||
登录
|
||||
登录名
|
||||
登录日志导出
|
||||
硕士
|
||||
示例导出
|
||||
离异
|
||||
@ -123,6 +125,8 @@
|
||||
请求日志导出
|
||||
调试
|
||||
跟踪
|
||||
跟踪标识
|
||||
跟踪编号
|
||||
身份证
|
||||
运行
|
||||
通知
|
||||
|
@ -93,6 +93,8 @@ XML注释文件不存在
|
||||
配置文件初始化完毕
|
||||
键值不能为空
|
||||
键名称不能为空
|
||||
随机延时结束时间不正确
|
||||
随机延时起始时间不正确
|
||||
非JSON字符串
|
||||
验证数据不能为空
|
||||
验证码不正确
|
||||
|
@ -15,7 +15,7 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.10.48">
|
||||
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.11.19-preview">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
@ -23,7 +23,7 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.28.0.94264">
|
||||
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.30.0.95878">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"version": "1.4.0",
|
||||
"version": "1.5.0",
|
||||
"devDependencies": {
|
||||
"cz-git": "^1.9.2",
|
||||
"cz-git": "^1.9.3",
|
||||
"commitizen": "^4.3.0",
|
||||
"prettier": "^3.3.0",
|
||||
"prettier": "^3.3.3",
|
||||
"standard-version": "^9.5.0"
|
||||
},
|
||||
"config": {
|
||||
|
@ -10,11 +10,11 @@
|
||||
"packages": [
|
||||
{
|
||||
"packageName": "FreeSql.NS",
|
||||
"version": "3.2.821-ns1"
|
||||
"version": "3.2.833-preview20260627-ns1"
|
||||
},
|
||||
{
|
||||
"packageName": "FreeSql.DbContext.NS",
|
||||
"version": "3.2.821-ns1"
|
||||
"version": "3.2.833-preview20260627-ns1"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
"packages": [
|
||||
{
|
||||
"packageName": "Furion.Pure.NS",
|
||||
"version": "4.9.4-ns1"
|
||||
"version": "4.9.4.6-ns4"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -71,7 +71,10 @@ global using NetAdmin.Domain.Attributes.DataValidation;
|
||||
global using NetAdmin.Domain.DbMaps.Dependency;
|
||||
global using NetAdmin.Domain.DbMaps.Dependency.Fields;
|
||||
global using NetAdmin.Domain.DbMaps.Sys;
|
||||
global using CsvIgnore = CsvHelper.Configuration.Attributes.IgnoreAttribute;
|
||||
global using CsvIndex = CsvHelper.Configuration.Attributes.IndexAttribute;
|
||||
global using CsvName = CsvHelper.Configuration.Attributes.NameAttribute;
|
||||
global using DynamicFilterInfo = NetAdmin.Domain.Dto.Dependency.DynamicFilterInfo;
|
||||
global using DynamicFilterOperators = NetAdmin.Domain.Enums.DynamicFilterOperators;
|
||||
global using SqlIndex = FreeSql.DataAnnotations.IndexAttribute;
|
||||
#endif
|
@ -823,11 +823,14 @@ public class AllTests(WebApplicationFactory<Startup> factory, ITestOutputHelper
|
||||
/// <inheritdoc />
|
||||
[InlineData(default)]
|
||||
[Theory]
|
||||
public async Task<PagedQueryRsp<GetAllEntriesRsp>> GetAllEntriesAsync(PagedQueryReq<GetAllEntriesReq> req)
|
||||
public Task<IEnumerable<GetEntryRsp>> GetAllEntriesAsync(GetAllEntriesReq req)
|
||||
{
|
||||
var rsp = await PostAsync("/api/sys/cache/get.all.entries"
|
||||
, JsonContent.Create(new PagedQueryReq<GetAllEntriesReq>()))
|
||||
.ConfigureAwait(true);
|
||||
var rsp = PostAsync("/api/sys/cache/get.all.entries", JsonContent.Create(new GetAllEntriesReq()))
|
||||
.ConfigureAwait(true)
|
||||
.GetAwaiter()
|
||||
#pragma warning disable xUnit1031
|
||||
.GetResult();
|
||||
#pragma warning restore xUnit1031
|
||||
Assert.Equal(HttpStatusCode.OK, rsp.StatusCode);
|
||||
return default;
|
||||
}
|
||||
@ -979,7 +982,7 @@ public class AllTests(WebApplicationFactory<Startup> factory, ITestOutputHelper
|
||||
/// <inheritdoc />
|
||||
[InlineData(default)]
|
||||
[Theory]
|
||||
public Task<IOrderedEnumerable<GetBarChartRsp>> GetBarChartAsync(QueryReq<QueryRequestLogReq> req)
|
||||
public Task<IEnumerable<GetBarChartRsp>> GetBarChartAsync(QueryReq<QueryRequestLogReq> req)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
@ -1029,6 +1032,12 @@ public class AllTests(WebApplicationFactory<Startup> factory, ITestOutputHelper
|
||||
return default;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<GetEntryRsp> GetEntryAsync(GetEntriesReq req)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[Fact]
|
||||
public IDictionary<string, Dictionary<string, string[]>> GetEnums()
|
||||
@ -1075,7 +1084,7 @@ public class AllTests(WebApplicationFactory<Startup> factory, ITestOutputHelper
|
||||
/// <inheritdoc />
|
||||
[InlineData(default)]
|
||||
[Theory]
|
||||
public Task<IOrderedEnumerable<GetPieChartRsp>> GetPieChartByApiSummaryAsync(QueryReq<QueryRequestLogReq> req)
|
||||
public Task<IEnumerable<GetPieChartRsp>> GetPieChartByApiSummaryAsync(QueryReq<QueryRequestLogReq> req)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
@ -1083,7 +1092,7 @@ public class AllTests(WebApplicationFactory<Startup> factory, ITestOutputHelper
|
||||
/// <inheritdoc />
|
||||
[InlineData(default)]
|
||||
[Theory]
|
||||
public Task<IOrderedEnumerable<GetPieChartRsp>> GetPieChartByHttpStatusCodeAsync(QueryReq<QueryRequestLogReq> req)
|
||||
public Task<IEnumerable<GetPieChartRsp>> GetPieChartByHttpStatusCodeAsync(QueryReq<QueryRequestLogReq> req)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
@ -1099,7 +1108,7 @@ public class AllTests(WebApplicationFactory<Startup> factory, ITestOutputHelper
|
||||
/// <inheritdoc />
|
||||
[InlineData(default)]
|
||||
[Theory]
|
||||
public Task<IOrderedEnumerable<GetBarChartRsp>> GetRecordBarChartAsync(QueryReq<QueryJobRecordReq> req)
|
||||
public Task<IEnumerable<GetBarChartRsp>> GetRecordBarChartAsync(QueryReq<QueryJobRecordReq> req)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
@ -1107,8 +1116,7 @@ public class AllTests(WebApplicationFactory<Startup> factory, ITestOutputHelper
|
||||
/// <inheritdoc />
|
||||
[InlineData(default)]
|
||||
[Theory]
|
||||
public Task<IOrderedEnumerable<GetPieChartRsp>> GetRecordPieChartByHttpStatusCodeAsync(
|
||||
QueryReq<QueryJobRecordReq> req)
|
||||
public Task<IEnumerable<GetPieChartRsp>> GetRecordPieChartByHttpStatusCodeAsync(QueryReq<QueryJobRecordReq> req)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
@ -1116,7 +1124,7 @@ public class AllTests(WebApplicationFactory<Startup> factory, ITestOutputHelper
|
||||
/// <inheritdoc />
|
||||
[InlineData(default)]
|
||||
[Theory]
|
||||
public Task<IOrderedEnumerable<GetPieChartRsp>> GetRecordPieChartByNameAsync(QueryReq<QueryJobRecordReq> req)
|
||||
public Task<IEnumerable<GetPieChartRsp>> GetRecordPieChartByNameAsync(QueryReq<QueryJobRecordReq> req)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
|
@ -12,19 +12,39 @@ public abstract class RedLockerService<TEntity, TPrimary, TLogger>(
|
||||
where TEntity : EntityBase<TPrimary> //
|
||||
where TPrimary : IEquatable<TPrimary>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取锁
|
||||
/// </summary>
|
||||
protected Task<IRedLock> GetLockerAsync(string lockName)
|
||||
{
|
||||
return GetLockerAsync(lockName, TimeSpan.FromSeconds(Numbers.SECS_RED_LOCK_WAIT)
|
||||
, TimeSpan.FromSeconds(Numbers.SECS_RED_LOCK_RETRY_INTERVAL));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取锁
|
||||
/// </summary>
|
||||
/// <exception cref="NetAdminGetLockerException">NetAdminGetLockerException</exception>
|
||||
protected async Task<IRedLock> GetLockerAsync(string lockName)
|
||||
protected async Task<IRedLock> GetLockerAsync(string lockName, TimeSpan waitTime, TimeSpan retryInterval)
|
||||
{
|
||||
// 加锁
|
||||
var redLock = await redLocker.RedLockFactory.CreateLockAsync( //
|
||||
lockName, TimeSpan.FromSeconds(Numbers.SECS_RED_LOCK_EXPIRY)
|
||||
, TimeSpan.FromSeconds(Numbers.SECS_RED_LOCK_WAIT)
|
||||
, TimeSpan.FromSeconds(Numbers.SECS_RED_LOCK_RETRY))
|
||||
.ConfigureAwait(false);
|
||||
var lockTask = waitTime == default || retryInterval == default
|
||||
? redLocker.RedLockFactory.CreateLockAsync(lockName, TimeSpan.FromSeconds(Numbers.SECS_RED_LOCK_EXPIRY))
|
||||
: redLocker.RedLockFactory.CreateLockAsync( //
|
||||
lockName, TimeSpan.FromSeconds(Numbers.SECS_RED_LOCK_EXPIRY), waitTime, retryInterval);
|
||||
var redLock = await lockTask.ConfigureAwait(false);
|
||||
|
||||
return redLock.IsAcquired ? redLock : throw new NetAdminGetLockerException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取锁
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 不重试,失败直接抛出异常
|
||||
/// </remarks>
|
||||
protected Task<IRedLock> GetLockerOnceAsync(string lockName)
|
||||
{
|
||||
return GetLockerAsync(lockName, default, default);
|
||||
}
|
||||
}
|
@ -1,4 +1,8 @@
|
||||
using CsvHelper;
|
||||
using Microsoft.Net.Http.Headers;
|
||||
using NetAdmin.Application.Repositories;
|
||||
using NetAdmin.Domain;
|
||||
using NetAdmin.Domain.Dto.Dependency;
|
||||
|
||||
namespace NetAdmin.Application.Services;
|
||||
|
||||
@ -26,6 +30,46 @@ public abstract class RepositoryService<TEntity, TPrimary, TLogger>(BasicReposit
|
||||
set => Rpo.DbContextOptions.EnableCascadeSave = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导出实体
|
||||
/// </summary>
|
||||
protected async Task<IActionResult> ExportAsync<TQuery, TExport>( //
|
||||
Func<QueryReq<TQuery>, ISelect<TEntity>> selector, QueryReq<TQuery> query, string fileName
|
||||
, Expression<Func<TEntity, object>> listExp = null)
|
||||
where TQuery : DataAbstraction, new()
|
||||
{
|
||||
var select = selector(query)
|
||||
#if DBTYPE_SQLSERVER
|
||||
.WithLock(SqlServerLock.NoLock | SqlServerLock.NoWait)
|
||||
#endif
|
||||
.Take(Numbers.MAX_LIMIT_EXPORT);
|
||||
|
||||
object list = listExp == null
|
||||
? await select.ToListAsync().ConfigureAwait(false)
|
||||
: await select.ToListAsync(listExp).ConfigureAwait(false);
|
||||
|
||||
var listTyped = list.Adapt<List<TExport>>();
|
||||
var stream = new MemoryStream();
|
||||
var writer = new StreamWriter(stream);
|
||||
var csv = new CsvWriter(writer, CultureInfo.InvariantCulture);
|
||||
csv.WriteHeader<TExport>();
|
||||
await csv.NextRecordAsync().ConfigureAwait(false);
|
||||
|
||||
foreach (var item in listTyped) {
|
||||
csv.WriteRecord(item);
|
||||
await csv.NextRecordAsync().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
await csv.FlushAsync().ConfigureAwait(false);
|
||||
_ = stream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
App.HttpContext.Response.Headers.ContentDisposition
|
||||
= new ContentDispositionHeaderValue(Chars.FLG_HTTP_HEADER_VALUE_ATTACHMENT) {
|
||||
FileNameStar = $"{fileName}_{DateTime.Now:yyyy.MM.dd-HH.mm.ss}.csv"
|
||||
}.ToString();
|
||||
return new FileStreamResult(stream, Chars.FLG_HTTP_HEADER_VALUE_APPLICATION_OCTET_STREAM);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新实体
|
||||
/// </summary>
|
||||
|
@ -70,7 +70,8 @@ public abstract class DistributedCache<TService>(IDistributedCache cache, TServi
|
||||
, TimeSpan? slideLifeTime = null)
|
||||
{
|
||||
var cacheRead = await GetAsync<T>(key).ConfigureAwait(false);
|
||||
if (cacheRead is not null) {
|
||||
if (cacheRead is not null && App.HttpContext?.Request.Headers.CacheControl.FirstOrDefault() !=
|
||||
Chars.FLG_HTTP_HEADER_VALUE_NO_CACHE) {
|
||||
return cacheRead;
|
||||
}
|
||||
|
||||
|
@ -10,5 +10,5 @@ public sealed class IndicatorAttribute(string indicate) : Attribute
|
||||
/// <summary>
|
||||
/// 状态指示
|
||||
/// </summary>
|
||||
public string Indicate { get; init; } = indicate;
|
||||
public string Indicate { get; } = indicate;
|
||||
}
|
@ -7,6 +7,12 @@ namespace NetAdmin.Domain.Contexts;
|
||||
/// </summary>
|
||||
public sealed record ContextUserToken : DataAbstraction
|
||||
{
|
||||
/// <summary>
|
||||
/// 部门编号
|
||||
/// </summary>
|
||||
/// ReSharper disable once MemberCanBePrivate.Global
|
||||
public long DeptId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户编号
|
||||
/// </summary>
|
||||
@ -39,6 +45,18 @@ public sealed record ContextUserToken : DataAbstraction
|
||||
/// </summary>
|
||||
public static ContextUserToken Create(QueryUserRsp user)
|
||||
{
|
||||
return new ContextUserToken { Id = user.Id, Token = user.Token, UserName = user.UserName };
|
||||
return new ContextUserToken {
|
||||
Id = user.Id, Token = user.Token, UserName = user.UserName, DeptId = user.DeptId
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从 Json Web Token 创建上下文用户
|
||||
/// </summary>
|
||||
public static ContextUserToken Create(string jwt)
|
||||
{
|
||||
var claim = JWTEncryption.ReadJwtToken(jwt.TrimPrefix($"{Chars.FLG_HTTP_HEADER_VALUE_AUTH_SCHEMA} "))
|
||||
?.Claims.FirstOrDefault(x => x.Type == nameof(ContextUserToken));
|
||||
return claim?.Value.ToObject<ContextUserToken>();
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
namespace NetAdmin.Domain.DbMaps.Dependency.Fields;
|
||||
|
||||
/// <summary>
|
||||
/// 创建者客户端IP字段接口
|
||||
/// </summary>
|
||||
public interface IFieldCreatedClientIp
|
||||
{
|
||||
/// <summary>
|
||||
/// 创建者客户端IP
|
||||
/// </summary>
|
||||
int? CreatedClientIp { get; init; }
|
||||
}
|
@ -1,15 +1,10 @@
|
||||
namespace NetAdmin.Domain.DbMaps.Dependency.Fields;
|
||||
|
||||
/// <summary>
|
||||
/// 创建者客户端字段接口
|
||||
/// 创建者客户端用户代理字段接口
|
||||
/// </summary>
|
||||
public interface IFieldCreatedClient
|
||||
public interface IFieldCreatedClientUserAgent
|
||||
{
|
||||
/// <summary>
|
||||
/// 创建者客户端IP
|
||||
/// </summary>
|
||||
int? CreatedClientIp { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建者客户端用户代理
|
||||
/// </summary>
|
@ -0,0 +1,12 @@
|
||||
namespace NetAdmin.Domain.DbMaps.Dependency.Fields;
|
||||
|
||||
/// <summary>
|
||||
/// 修改客户端IP字段接口
|
||||
/// </summary>
|
||||
public interface IFieldModifiedClientIp
|
||||
{
|
||||
/// <summary>
|
||||
/// 客户端IP
|
||||
/// </summary>
|
||||
int ModifiedClientIp { get; init; }
|
||||
}
|
@ -1,15 +1,10 @@
|
||||
namespace NetAdmin.Domain.DbMaps.Dependency.Fields;
|
||||
|
||||
/// <summary>
|
||||
/// 修改客户端字段接口
|
||||
/// 修改客户端用户代理字段接口
|
||||
/// </summary>
|
||||
public interface IFieldModifiedClient
|
||||
public interface IFieldModifiedClientUserAgent
|
||||
{
|
||||
/// <summary>
|
||||
/// 客户端IP
|
||||
/// </summary>
|
||||
int ModifiedClientIp { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 客户端用户代理
|
||||
/// </summary>
|
@ -5,6 +5,7 @@ public abstract record ImmutableEntity : ImmutableEntity<long>
|
||||
{
|
||||
/// <inheritdoc cref="EntityBase{T}.Id" />
|
||||
[Column(IsIdentity = false, IsPrimary = true, Position = 1)]
|
||||
[CsvIgnore]
|
||||
[Snowflake]
|
||||
public override long Id { get; init; }
|
||||
}
|
||||
@ -18,17 +19,18 @@ public abstract record ImmutableEntity<T> : LiteImmutableEntity<T>, IFieldCreate
|
||||
{
|
||||
/// <inheritdoc cref="IFieldCreatedUser.CreatedUserId" />
|
||||
[Column(CanUpdate = false, Position = -1)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public long? CreatedUserId { get; init; }
|
||||
|
||||
/// <inheritdoc cref="IFieldCreatedUser.CreatedUserName" />
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_31, CanUpdate = false, Position = -1)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string CreatedUserName { get; init; }
|
||||
|
||||
/// <inheritdoc cref="EntityBase{T}.Id" />
|
||||
[Column(IsIdentity = false, IsPrimary = true, Position = 1)]
|
||||
[CsvIgnore]
|
||||
public override T Id { get; init; }
|
||||
}
|
@ -5,6 +5,7 @@ public abstract record LiteImmutableEntity : LiteImmutableEntity<long>
|
||||
{
|
||||
/// <inheritdoc cref="EntityBase{T}.Id" />
|
||||
[Column(IsIdentity = false, IsPrimary = true, Position = 1)]
|
||||
[CsvIgnore]
|
||||
[Snowflake]
|
||||
public override long Id { get; init; }
|
||||
}
|
||||
@ -18,13 +19,13 @@ public abstract record LiteImmutableEntity<T> : EntityBase<T>, IFieldCreatedTime
|
||||
{
|
||||
/// <inheritdoc cref="IFieldCreatedTime.CreatedTime" />
|
||||
[Column(ServerTime = DateTimeKind.Local, CanUpdate = false, Position = -1)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual DateTime CreatedTime { get; init; }
|
||||
|
||||
/// <inheritdoc cref="EntityBase{T}.Id" />
|
||||
[Column(IsIdentity = false, IsPrimary = true, Position = 1)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public override T Id { get; init; }
|
||||
}
|
@ -5,6 +5,7 @@ public abstract record LiteMutableEntity : LiteMutableEntity<long>
|
||||
{
|
||||
/// <inheritdoc cref="EntityBase{T}.Id" />
|
||||
[Column(IsIdentity = false, IsPrimary = true, Position = 1)]
|
||||
[CsvIgnore]
|
||||
[Snowflake]
|
||||
public override long Id { get; init; }
|
||||
}
|
||||
@ -17,11 +18,12 @@ public abstract record LiteMutableEntity<T> : LiteImmutableEntity<T>, IFieldModi
|
||||
{
|
||||
/// <inheritdoc cref="EntityBase{T}.Id" />
|
||||
[Column(IsIdentity = false, IsPrimary = true, Position = 1)]
|
||||
[CsvIgnore]
|
||||
public override T Id { get; init; }
|
||||
|
||||
/// <inheritdoc cref="IFieldModifiedTime.ModifiedTime" />
|
||||
[Column(ServerTime = DateTimeKind.Local, CanInsert = false, Position = -1)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual DateTime? ModifiedTime { get; init; }
|
||||
}
|
@ -5,6 +5,7 @@ public abstract record LiteVersionEntity : LiteVersionEntity<long>
|
||||
{
|
||||
/// <inheritdoc cref="EntityBase{T}.Id" />
|
||||
[Column(IsIdentity = false, IsPrimary = true, Position = 1)]
|
||||
[CsvIgnore]
|
||||
[Snowflake]
|
||||
public override long Id { get; init; }
|
||||
}
|
||||
@ -17,11 +18,13 @@ public abstract record LiteVersionEntity<T> : LiteMutableEntity<T>, IFieldVersio
|
||||
{
|
||||
/// <inheritdoc cref="EntityBase{T}.Id" />
|
||||
[Column(IsIdentity = false, IsPrimary = true, Position = 1)]
|
||||
[CsvIgnore]
|
||||
[Snowflake]
|
||||
public override T Id { get; init; }
|
||||
|
||||
/// <inheritdoc cref="IFieldVersion.Version" />
|
||||
[Column(IsVersion = true, Position = -1)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual long Version { get; init; }
|
||||
}
|
@ -5,6 +5,7 @@ public abstract record MutableEntity : MutableEntity<long>
|
||||
{
|
||||
/// <inheritdoc cref="EntityBase{T}.Id" />
|
||||
[Column(IsIdentity = false, IsPrimary = true, Position = 1)]
|
||||
[CsvIgnore]
|
||||
[Snowflake]
|
||||
public override long Id { get; init; }
|
||||
}
|
||||
@ -17,17 +18,18 @@ public abstract record MutableEntity<T> : LiteMutableEntity<T>, IFieldModifiedUs
|
||||
{
|
||||
/// <inheritdoc cref="EntityBase{T}.Id" />
|
||||
[Column(IsIdentity = false, IsPrimary = true, Position = 1)]
|
||||
[CsvIgnore]
|
||||
public override T Id { get; init; }
|
||||
|
||||
/// <inheritdoc cref="IFieldModifiedUser.ModifiedUserId" />
|
||||
[Column(CanInsert = false, Position = -1)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public long? ModifiedUserId { get; init; }
|
||||
|
||||
/// <inheritdoc cref="IFieldModifiedUser.ModifiedUserName" />
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_31, CanInsert = false, Position = -1)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public string ModifiedUserName { get; init; }
|
||||
}
|
@ -5,6 +5,7 @@ public abstract record SimpleEntity : SimpleEntity<long>
|
||||
{
|
||||
/// <inheritdoc cref="EntityBase{T}.Id" />
|
||||
[Column(IsIdentity = false, IsPrimary = true, Position = 1)]
|
||||
[CsvIgnore]
|
||||
[Snowflake]
|
||||
public override long Id { get; init; }
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ public abstract record VersionEntity : VersionEntity<long>
|
||||
{
|
||||
/// <inheritdoc cref="EntityBase{T}.Id" />
|
||||
[Column(IsIdentity = false, IsPrimary = true, Position = 1)]
|
||||
[CsvIgnore]
|
||||
[Snowflake]
|
||||
public override long Id { get; init; }
|
||||
}
|
||||
@ -17,29 +18,30 @@ public abstract record VersionEntity<T> : LiteVersionEntity<T>, IFieldModifiedUs
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[Column(CanUpdate = false, Position = -1)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual long? CreatedUserId { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_31, CanUpdate = false, Position = -1)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string CreatedUserName { get; init; }
|
||||
|
||||
/// <inheritdoc cref="EntityBase{T}.Id" />
|
||||
[Column(IsIdentity = false, IsPrimary = true, Position = 1)]
|
||||
[CsvIgnore]
|
||||
public override T Id { get; init; }
|
||||
|
||||
/// <inheritdoc cref="IFieldModifiedUser.ModifiedUserId" />
|
||||
[Column(CanInsert = false, Position = -1)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual long? ModifiedUserId { get; init; }
|
||||
|
||||
/// <inheritdoc cref="IFieldModifiedUser.ModifiedUserName" />
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_31, CanInsert = false, Position = -1)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string ModifiedUserName { get; init; }
|
||||
}
|
@ -4,19 +4,20 @@ namespace NetAdmin.Domain.DbMaps.Sys;
|
||||
/// Api接口表
|
||||
/// </summary>
|
||||
[Table(Name = Chars.FLG_DB_TABLE_NAME_PREFIX + nameof(Sys_Api))]
|
||||
[SqlIndex(Chars.FLG_DB_INDEX_PREFIX + nameof(PathCrc32), nameof(PathCrc32), true)]
|
||||
public record Sys_Api : ImmutableEntity<string>, IFieldSummary
|
||||
{
|
||||
/// <summary>
|
||||
/// 子节点
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Navigate(nameof(ParentId))]
|
||||
public IEnumerable<Sys_Api> Children { get; init; }
|
||||
|
||||
/// <inheritdoc cref="EntityBase{T}.Id" />
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_127, IsIdentity = false, IsPrimary = true, Position = 1)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public override string Id { get; init; }
|
||||
|
||||
@ -24,7 +25,7 @@ public record Sys_Api : ImmutableEntity<string>, IFieldSummary
|
||||
/// 请求方式
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_15)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Method { get; init; }
|
||||
|
||||
@ -32,7 +33,7 @@ public record Sys_Api : ImmutableEntity<string>, IFieldSummary
|
||||
/// 服务名称
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_63)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Name { get; init; }
|
||||
|
||||
@ -40,7 +41,7 @@ public record Sys_Api : ImmutableEntity<string>, IFieldSummary
|
||||
/// 命名空间
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_31)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
#pragma warning disable CA1716
|
||||
public virtual string Namespace { get; init; }
|
||||
@ -50,14 +51,22 @@ public record Sys_Api : ImmutableEntity<string>, IFieldSummary
|
||||
/// 父编号
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_127)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string ParentId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 路径CRC32
|
||||
/// </summary>
|
||||
[Column]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual int PathCrc32 { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 角色集合
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Navigate(ManyToMany = typeof(Sys_RoleApi))]
|
||||
public ICollection<Sys_Role> Roles { get; init; }
|
||||
@ -66,7 +75,7 @@ public record Sys_Api : ImmutableEntity<string>, IFieldSummary
|
||||
/// 服务描述
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_63)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Summary { get; init; }
|
||||
}
|
@ -10,7 +10,7 @@ public record Sys_Config : VersionEntity, IFieldEnabled
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual bool Enabled { get; init; }
|
||||
|
||||
@ -18,14 +18,14 @@ public record Sys_Config : VersionEntity, IFieldEnabled
|
||||
/// 用户注册是否需要人工确认
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual bool UserRegisterConfirm { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户注册默认部门
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Navigate(nameof(UserRegisterDeptId))]
|
||||
public Sys_Dept UserRegisterDept { get; init; }
|
||||
@ -34,14 +34,14 @@ public record Sys_Config : VersionEntity, IFieldEnabled
|
||||
/// 用户注册默认部门编号
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual long UserRegisterDeptId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户注册默认角色
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Navigate(nameof(UserRegisterRoleId))]
|
||||
public Sys_Role UserRegisterRole { get; init; }
|
||||
@ -50,7 +50,7 @@ public record Sys_Config : VersionEntity, IFieldEnabled
|
||||
/// 用户注册默认角色编号
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual long UserRegisterRoleId { get; init; }
|
||||
}
|
@ -9,7 +9,7 @@ public record Sys_Dept : VersionEntity, IFieldEnabled, IFieldSummary, IFieldSort
|
||||
/// <summary>
|
||||
/// 子节点
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Navigate(nameof(ParentId))]
|
||||
public IEnumerable<Sys_Dept> Children { get; init; }
|
||||
@ -18,7 +18,7 @@ public record Sys_Dept : VersionEntity, IFieldEnabled, IFieldSummary, IFieldSort
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual bool Enabled { get; init; }
|
||||
|
||||
@ -26,7 +26,7 @@ public record Sys_Dept : VersionEntity, IFieldEnabled, IFieldSummary, IFieldSort
|
||||
/// 部门名称
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_31)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Name { get; init; }
|
||||
|
||||
@ -34,14 +34,14 @@ public record Sys_Dept : VersionEntity, IFieldEnabled, IFieldSummary, IFieldSort
|
||||
/// 父编号
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual long ParentId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 角色集合
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Navigate(ManyToMany = typeof(Sys_RoleDept))]
|
||||
public ICollection<Sys_Role> Roles { get; init; }
|
||||
@ -49,7 +49,7 @@ public record Sys_Dept : VersionEntity, IFieldEnabled, IFieldSummary, IFieldSort
|
||||
/// <summary>
|
||||
/// 发送给此部门的站内信集合
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Navigate(ManyToMany = typeof(Sys_SiteMsgDept))]
|
||||
public ICollection<Sys_SiteMsg> SiteMsgs { get; init; }
|
||||
@ -58,7 +58,7 @@ public record Sys_Dept : VersionEntity, IFieldEnabled, IFieldSummary, IFieldSort
|
||||
/// 排序值,越大越前
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual long Sort { get; init; }
|
||||
|
||||
@ -66,7 +66,7 @@ public record Sys_Dept : VersionEntity, IFieldEnabled, IFieldSummary, IFieldSort
|
||||
/// 部门描述
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Summary { get; init; }
|
||||
}
|
@ -3,14 +3,14 @@ namespace NetAdmin.Domain.DbMaps.Sys;
|
||||
/// <summary>
|
||||
/// 字典目录表
|
||||
/// </summary>
|
||||
[FreeSql.DataAnnotations.Index(Chars.FLG_DB_INDEX_PREFIX + nameof(Code), nameof(Code), true)]
|
||||
[Table(Name = Chars.FLG_DB_TABLE_NAME_PREFIX + nameof(Sys_DicCatalog))]
|
||||
[SqlIndex(Chars.FLG_DB_INDEX_PREFIX + nameof(Code), nameof(Code), true)]
|
||||
[Table(Name = Chars.FLG_DB_TABLE_NAME_PREFIX + nameof(Sys_DicCatalog))]
|
||||
public record Sys_DicCatalog : VersionEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 子节点
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Navigate(nameof(ParentId))]
|
||||
public IEnumerable<Sys_DicCatalog> Children { get; init; }
|
||||
@ -18,15 +18,15 @@ public record Sys_DicCatalog : VersionEntity
|
||||
/// <summary>
|
||||
/// 字典编码
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_31)]
|
||||
[Ignore]
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_63)]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Code { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 字典内容集合
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Navigate(nameof(Sys_DicContent.CatalogId))]
|
||||
public ICollection<Sys_DicContent> Contents { get; init; }
|
||||
@ -34,8 +34,8 @@ public record Sys_DicCatalog : VersionEntity
|
||||
/// <summary>
|
||||
/// 字典名称
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_31)]
|
||||
[Ignore]
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_63)]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Name { get; init; }
|
||||
|
||||
@ -43,7 +43,7 @@ public record Sys_DicCatalog : VersionEntity
|
||||
/// 父编号
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual long ParentId { get; init; }
|
||||
}
|
@ -3,17 +3,14 @@ namespace NetAdmin.Domain.DbMaps.Sys;
|
||||
/// <summary>
|
||||
/// 字典内容表
|
||||
/// </summary>
|
||||
[FreeSql.DataAnnotations.Index( //
|
||||
$"{Chars.FLG_DB_INDEX_PREFIX}{nameof(CatalogId)}_{nameof(Key)}", $"{nameof(CatalogId)},{nameof(Key)}", true)]
|
||||
[FreeSql.DataAnnotations.Index( //
|
||||
$"{Chars.FLG_DB_INDEX_PREFIX}{nameof(CatalogId)}_{nameof(Value)}", $"{nameof(CatalogId)},{nameof(Value)}", true)]
|
||||
[SqlIndex($"{Chars.FLG_DB_INDEX_PREFIX}{nameof(CatalogId)}_{nameof(Key)}", $"{nameof(CatalogId)},{nameof(Key)}", true)]
|
||||
[Table(Name = Chars.FLG_DB_TABLE_NAME_PREFIX + nameof(Sys_DicContent))]
|
||||
public record Sys_DicContent : VersionEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 字典目录
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Navigate(nameof(CatalogId))]
|
||||
public Sys_DicCatalog Catalog { get; init; }
|
||||
@ -22,7 +19,7 @@ public record Sys_DicContent : VersionEntity
|
||||
/// 字典目录编号
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual long CatalogId { get; init; }
|
||||
|
||||
@ -30,7 +27,7 @@ public record Sys_DicContent : VersionEntity
|
||||
/// 键名称
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_63)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Key { get; init; }
|
||||
|
||||
@ -38,7 +35,7 @@ public record Sys_DicContent : VersionEntity
|
||||
/// 键值
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Value { get; init; }
|
||||
}
|
@ -11,7 +11,7 @@ public record Sys_Job : VersionEntity, IFieldEnabled, IFieldSummary
|
||||
{
|
||||
/// <inheritdoc cref="IFieldEnabled.Enabled" />
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual bool Enabled { get; init; }
|
||||
|
||||
@ -19,7 +19,7 @@ public record Sys_Job : VersionEntity, IFieldEnabled, IFieldSummary
|
||||
/// 执行时间计划
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_31)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string ExecutionCron { get; init; }
|
||||
|
||||
@ -27,7 +27,7 @@ public record Sys_Job : VersionEntity, IFieldEnabled, IFieldSummary
|
||||
/// 请求方法
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual HttpMethods HttpMethod { get; init; }
|
||||
|
||||
@ -35,7 +35,7 @@ public record Sys_Job : VersionEntity, IFieldEnabled, IFieldSummary
|
||||
/// 作业名称
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_63)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string JobName { get; init; }
|
||||
|
||||
@ -43,7 +43,7 @@ public record Sys_Job : VersionEntity, IFieldEnabled, IFieldSummary
|
||||
/// 上次执行耗时
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual long? LastDuration { get; init; }
|
||||
|
||||
@ -51,7 +51,7 @@ public record Sys_Job : VersionEntity, IFieldEnabled, IFieldSummary
|
||||
/// 上次执行时间
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual DateTime? LastExecTime { get; init; }
|
||||
|
||||
@ -59,15 +59,15 @@ public record Sys_Job : VersionEntity, IFieldEnabled, IFieldSummary
|
||||
/// 上次执行状态
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual HttpStatusCode? LastStatusCode { get; init; }
|
||||
public HttpStatusCode? LastStatusCode { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 下次执行时间
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual DateTime? NextExecTime { get; init; }
|
||||
|
||||
@ -75,10 +75,26 @@ public record Sys_Job : VersionEntity, IFieldEnabled, IFieldSummary
|
||||
/// 下次执行时间编号
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual long? NextTimeId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 随机延时起始值(毫秒)
|
||||
/// </summary>
|
||||
[Column]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual int? RandomDelayBegin { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 随机延时结束值(毫秒)
|
||||
/// </summary>
|
||||
[Column]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual int? RandomDelayEnd { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 请求体
|
||||
/// </summary>
|
||||
@ -87,7 +103,7 @@ public record Sys_Job : VersionEntity, IFieldEnabled, IFieldSummary
|
||||
#else
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
#endif
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string RequestBody { get; init; }
|
||||
|
||||
@ -99,7 +115,7 @@ public record Sys_Job : VersionEntity, IFieldEnabled, IFieldSummary
|
||||
#else
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
#endif
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string RequestHeader { get; init; }
|
||||
|
||||
@ -111,7 +127,7 @@ public record Sys_Job : VersionEntity, IFieldEnabled, IFieldSummary
|
||||
#else
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
#endif
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string RequestUrl { get; init; }
|
||||
|
||||
@ -119,7 +135,7 @@ public record Sys_Job : VersionEntity, IFieldEnabled, IFieldSummary
|
||||
/// 作业状态
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual JobStatues Status { get; init; }
|
||||
|
||||
@ -129,14 +145,14 @@ public record Sys_Job : VersionEntity, IFieldEnabled, IFieldSummary
|
||||
#else
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
#endif
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Summary { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 执行用户
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Navigate(nameof(UserId))]
|
||||
public Sys_User User { get; init; }
|
||||
@ -145,7 +161,7 @@ public record Sys_Job : VersionEntity, IFieldEnabled, IFieldSummary
|
||||
/// 执行用户编号
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual long UserId { get; init; }
|
||||
}
|
@ -5,11 +5,10 @@ namespace NetAdmin.Domain.DbMaps.Sys;
|
||||
/// <summary>
|
||||
/// 计划作业执行记录表
|
||||
/// </summary>
|
||||
[FreeSql.DataAnnotations.Index( //
|
||||
$"{Chars.FLG_DB_INDEX_PREFIX}{nameof(JobId)}_{nameof(TimeId)}", $"{nameof(JobId)},{nameof(TimeId)}", true)]
|
||||
[FreeSql.DataAnnotations.Index(Chars.FLG_DB_INDEX_PREFIX + nameof(CreatedTime), nameof(CreatedTime), false)]
|
||||
[FreeSql.DataAnnotations.Index(Chars.FLG_DB_INDEX_PREFIX + nameof(JobId), nameof(JobId), false)]
|
||||
[FreeSql.DataAnnotations.Index(Chars.FLG_DB_INDEX_PREFIX + nameof(HttpStatusCode), nameof(HttpStatusCode), false)]
|
||||
[SqlIndex($"{Chars.FLG_DB_INDEX_PREFIX}{nameof(JobId)}_{nameof(TimeId)}", $"{nameof(JobId)},{nameof(TimeId)}", true)]
|
||||
[SqlIndex(Chars.FLG_DB_INDEX_PREFIX + nameof(CreatedTime), $"{nameof(CreatedTime)} DESC", false)]
|
||||
[SqlIndex(Chars.FLG_DB_INDEX_PREFIX + nameof(JobId), nameof(JobId), false)]
|
||||
[SqlIndex(Chars.FLG_DB_INDEX_PREFIX + nameof(HttpStatusCode), nameof(HttpStatusCode), false)]
|
||||
[Table(Name = Chars.FLG_DB_TABLE_NAME_PREFIX + nameof(Sys_JobRecord))]
|
||||
public record Sys_JobRecord : LiteImmutableEntity
|
||||
{
|
||||
@ -17,7 +16,7 @@ public record Sys_JobRecord : LiteImmutableEntity
|
||||
/// 执行耗时(毫秒)
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual long Duration { get; init; }
|
||||
|
||||
@ -25,7 +24,7 @@ public record Sys_JobRecord : LiteImmutableEntity
|
||||
/// 请求方法
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual HttpMethods HttpMethod { get; init; }
|
||||
|
||||
@ -33,14 +32,14 @@ public record Sys_JobRecord : LiteImmutableEntity
|
||||
/// HTTP 状态码
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public int HttpStatusCode { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 拥有者信息
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Navigate(nameof(JobId))]
|
||||
public Sys_Job Job { get; init; }
|
||||
@ -49,7 +48,7 @@ public record Sys_JobRecord : LiteImmutableEntity
|
||||
/// 作业编号
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual long JobId { get; init; }
|
||||
|
||||
@ -61,7 +60,7 @@ public record Sys_JobRecord : LiteImmutableEntity
|
||||
#else
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
#endif
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string RequestBody { get; init; }
|
||||
|
||||
@ -73,7 +72,7 @@ public record Sys_JobRecord : LiteImmutableEntity
|
||||
#else
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
#endif
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string RequestHeader { get; init; }
|
||||
|
||||
@ -81,7 +80,7 @@ public record Sys_JobRecord : LiteImmutableEntity
|
||||
/// 请求的网络地址
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_127)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string RequestUrl { get; init; }
|
||||
|
||||
@ -93,7 +92,7 @@ public record Sys_JobRecord : LiteImmutableEntity
|
||||
#else
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
#endif
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string ResponseBody { get; init; }
|
||||
|
||||
@ -105,7 +104,7 @@ public record Sys_JobRecord : LiteImmutableEntity
|
||||
#else
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
#endif
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string ResponseHeader { get; init; }
|
||||
|
||||
@ -113,7 +112,7 @@ public record Sys_JobRecord : LiteImmutableEntity
|
||||
/// 执行时间编号
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual long TimeId { get; init; }
|
||||
}
|
150
src/backend/NetAdmin.Domain/DbMaps/Sys/Sys_LoginLog.cs
Normal file
150
src/backend/NetAdmin.Domain/DbMaps/Sys/Sys_LoginLog.cs
Normal file
@ -0,0 +1,150 @@
|
||||
namespace NetAdmin.Domain.DbMaps.Sys;
|
||||
|
||||
/// <summary>
|
||||
/// 登录日志表
|
||||
/// </summary>
|
||||
[SqlIndex(Chars.FLG_DB_INDEX_PREFIX + nameof(CreatedTime), $"{nameof(CreatedTime)} DESC", false)]
|
||||
[SqlIndex(Chars.FLG_DB_INDEX_PREFIX + nameof(HttpStatusCode), nameof(HttpStatusCode), false)]
|
||||
[SqlIndex(Chars.FLG_DB_INDEX_PREFIX + nameof(OwnerId), nameof(OwnerId), false)]
|
||||
[Table(Name = Chars.FLG_DB_TABLE_NAME_PREFIX + nameof(Sys_LoginLog))]
|
||||
public record Sys_LoginLog : SimpleEntity, IFieldCreatedTime, IFieldOwner, IFieldCreatedClientIp
|
||||
, IFieldCreatedClientUserAgent
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[Column]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual int? CreatedClientIp { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[Column(ServerTime = DateTimeKind.Local, CanUpdate = false, Position = -1)]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual DateTime CreatedTime { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
#if DBTYPE_SQLSERVER
|
||||
[Column(Position = -1, DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_1022)]
|
||||
#else
|
||||
[Column(Position = -1, DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
#endif
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string CreatedUserAgent { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 执行耗时(毫秒)
|
||||
/// </summary>
|
||||
[Column]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual int Duration { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 程序响应码
|
||||
/// </summary>
|
||||
[Column]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual ErrorCodes ErrorCode { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// HTTP状态码
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_SMALL_INT)]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual int HttpStatusCode { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录用户名
|
||||
/// </summary>
|
||||
[Column(Position = -1, DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_63)]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string LoginUserName { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 拥有者
|
||||
/// </summary>
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Navigate(nameof(OwnerId))]
|
||||
public Sys_User Owner { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[Column]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual long? OwnerDeptId { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[Column]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual long? OwnerId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 请求内容
|
||||
/// </summary>
|
||||
#if DBTYPE_SQLSERVER
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_MAX)]
|
||||
#else
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
#endif
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string RequestBody { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 请求头信息
|
||||
/// </summary>
|
||||
#if DBTYPE_SQLSERVER
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_MAX)]
|
||||
#else
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
#endif
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string RequestHeaders { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 请求地址
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_127)]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string RequestUrl { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 响应内容
|
||||
/// </summary>
|
||||
#if DBTYPE_SQLSERVER
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_MAX)]
|
||||
#else
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
#endif
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string ResponseBody { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 响应头
|
||||
/// </summary>
|
||||
#if DBTYPE_SQLSERVER
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_MAX)]
|
||||
#else
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
#endif
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string ResponseHeaders { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务器IP
|
||||
/// </summary>
|
||||
[Column]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual int? ServerIp { get; init; }
|
||||
}
|
@ -5,22 +5,22 @@ namespace NetAdmin.Domain.DbMaps.Sys;
|
||||
/// <summary>
|
||||
/// 菜单表
|
||||
/// </summary>
|
||||
[FreeSql.DataAnnotations.Index(Chars.FLG_DB_INDEX_PREFIX + nameof(Name), nameof(Name), true)]
|
||||
[Table(Name = Chars.FLG_DB_TABLE_NAME_PREFIX + nameof(Sys_Menu))]
|
||||
[SqlIndex(Chars.FLG_DB_INDEX_PREFIX + nameof(Name), nameof(Name), true)]
|
||||
[Table(Name = Chars.FLG_DB_TABLE_NAME_PREFIX + nameof(Sys_Menu))]
|
||||
public record Sys_Menu : VersionEntity, IFieldSort
|
||||
{
|
||||
/// <summary>
|
||||
/// 子节点或详情页需要高亮的上级菜单路由地址
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_127)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Active { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 子节点
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Navigate(nameof(ParentId))]
|
||||
public IEnumerable<Sys_Menu> Children { get; init; }
|
||||
@ -29,7 +29,7 @@ public record Sys_Menu : VersionEntity, IFieldSort
|
||||
/// 背景颜色
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_7)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Color { get; init; }
|
||||
|
||||
@ -37,7 +37,7 @@ public record Sys_Menu : VersionEntity, IFieldSort
|
||||
/// 组件
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_63)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Component { get; init; }
|
||||
|
||||
@ -45,7 +45,7 @@ public record Sys_Menu : VersionEntity, IFieldSort
|
||||
/// 是否整页路由
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual bool FullPageRouting { get; init; }
|
||||
|
||||
@ -53,7 +53,7 @@ public record Sys_Menu : VersionEntity, IFieldSort
|
||||
/// 是否隐藏菜单
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual bool Hidden { get; init; }
|
||||
|
||||
@ -61,7 +61,7 @@ public record Sys_Menu : VersionEntity, IFieldSort
|
||||
/// 是否隐藏面包屑
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual bool HiddenBreadCrumb { get; init; }
|
||||
|
||||
@ -69,7 +69,7 @@ public record Sys_Menu : VersionEntity, IFieldSort
|
||||
/// 图标
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_31)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Icon { get; init; }
|
||||
|
||||
@ -77,7 +77,7 @@ public record Sys_Menu : VersionEntity, IFieldSort
|
||||
/// 菜单名称
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_63)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Name { get; init; }
|
||||
|
||||
@ -85,7 +85,7 @@ public record Sys_Menu : VersionEntity, IFieldSort
|
||||
/// 父编号
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual long ParentId { get; init; }
|
||||
|
||||
@ -93,7 +93,7 @@ public record Sys_Menu : VersionEntity, IFieldSort
|
||||
/// 菜单路径
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_127)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Path { get; init; }
|
||||
|
||||
@ -101,14 +101,14 @@ public record Sys_Menu : VersionEntity, IFieldSort
|
||||
/// 重定向地址
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_127)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Redirect { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 拥有此菜单的角色集合
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Navigate(ManyToMany = typeof(Sys_RoleMenu))]
|
||||
public ICollection<Sys_Role> Roles { get; init; }
|
||||
@ -117,7 +117,7 @@ public record Sys_Menu : VersionEntity, IFieldSort
|
||||
/// 排序值,越大越前
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual long Sort { get; init; }
|
||||
|
||||
@ -125,7 +125,7 @@ public record Sys_Menu : VersionEntity, IFieldSort
|
||||
/// 标签
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_31)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Tag { get; init; }
|
||||
|
||||
@ -133,7 +133,7 @@ public record Sys_Menu : VersionEntity, IFieldSort
|
||||
/// 菜单标题
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_63)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Title { get; init; }
|
||||
|
||||
@ -141,7 +141,7 @@ public record Sys_Menu : VersionEntity, IFieldSort
|
||||
/// 菜单类型
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual MenuTypes Type { get; init; }
|
||||
}
|
@ -1,190 +1,104 @@
|
||||
using HttpMethods = NetAdmin.Domain.Enums.HttpMethods;
|
||||
|
||||
namespace NetAdmin.Domain.DbMaps.Sys;
|
||||
|
||||
/// <summary>
|
||||
/// 请求日志表
|
||||
/// </summary>
|
||||
[FreeSql.DataAnnotations.Index(Chars.FLG_DB_INDEX_PREFIX + nameof(ApiId), nameof(ApiId), false)]
|
||||
[FreeSql.DataAnnotations.Index(Chars.FLG_DB_INDEX_PREFIX + nameof(CreatedTime), nameof(CreatedTime), false)]
|
||||
[FreeSql.DataAnnotations.Index(Chars.FLG_DB_INDEX_PREFIX + nameof(UserId), nameof(UserId), false)]
|
||||
[FreeSql.DataAnnotations.Index(Chars.FLG_DB_INDEX_PREFIX + nameof(HttpStatusCode), nameof(HttpStatusCode), false)]
|
||||
[Table(Name = Chars.FLG_DB_TABLE_NAME_PREFIX + nameof(Sys_RequestLog))]
|
||||
public record Sys_RequestLog : SimpleEntity, IFieldCreatedTime, IFieldCreatedClient
|
||||
[SqlIndex(Chars.FLG_DB_INDEX_PREFIX + nameof(ApiPathCrc32), nameof(ApiPathCrc32), false)]
|
||||
[SqlIndex(Chars.FLG_DB_INDEX_PREFIX + nameof(CreatedTime), $"{nameof(CreatedTime)} DESC", false)]
|
||||
[SqlIndex(Chars.FLG_DB_INDEX_PREFIX + nameof(OwnerId), nameof(OwnerId), false)]
|
||||
[SqlIndex(Chars.FLG_DB_INDEX_PREFIX + nameof(HttpStatusCode), nameof(HttpStatusCode), false)]
|
||||
[Table( //
|
||||
Name = $"{Chars.FLG_DB_TABLE_NAME_PREFIX}{nameof(Sys_RequestLog)}_{{yyyyMMdd}}"
|
||||
, AsTable = $"{nameof(CreatedTime)}=2024-1-1(1 day)")]
|
||||
public record Sys_RequestLog : SimpleEntity, IFieldCreatedTime, IFieldOwner, IFieldCreatedClientIp
|
||||
{
|
||||
/// <summary>
|
||||
/// 接口
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Navigate(nameof(ApiId))]
|
||||
[Navigate(nameof(ApiPathCrc32), TempPrimary = nameof(Sys_Api.PathCrc32))]
|
||||
public Sys_Api Api { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 接口编号
|
||||
/// 接口路径CRC32
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_127)]
|
||||
[Ignore]
|
||||
[Column]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string ApiId { get; init; }
|
||||
public virtual int ApiPathCrc32 { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[Column(Position = -1)]
|
||||
[Ignore]
|
||||
[Column]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public int? CreatedClientIp { get; init; }
|
||||
public virtual int? CreatedClientIp { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[Column(ServerTime = DateTimeKind.Local, CanUpdate = false, Position = -1)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual DateTime CreatedTime { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
#if DBTYPE_SQLSERVER
|
||||
[Column(Position = -1, DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_1022)]
|
||||
#else
|
||||
[Column(Position = -1, DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
#endif
|
||||
[Ignore]
|
||||
/// <summary>
|
||||
/// 明细
|
||||
/// </summary>
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string CreatedUserAgent { get; init; }
|
||||
[Navigate(nameof(Id))]
|
||||
public Sys_RequestLogDetail Detail { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 执行耗时(微秒)
|
||||
/// 执行耗时(毫秒)
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual long Duration { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 程序响应码
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[JsonIgnore]
|
||||
public virtual ErrorCodes ErrorCode { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 异常信息
|
||||
/// </summary>
|
||||
#if DBTYPE_SQLSERVER
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_MAX)]
|
||||
#else
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
#endif
|
||||
[Ignore]
|
||||
[JsonIgnore]
|
||||
public virtual string Exception { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// HTTP状态码
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[JsonIgnore]
|
||||
public virtual int HttpStatusCode { get; init; }
|
||||
public virtual int Duration { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 请求方法
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_15)]
|
||||
[Ignore]
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_TINY_INT)]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Method { get; init; }
|
||||
public virtual HttpMethods HttpMethod { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 请求内容
|
||||
/// HTTP状态码
|
||||
/// </summary>
|
||||
#if DBTYPE_SQLSERVER
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_MAX)]
|
||||
#else
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
#endif
|
||||
[Ignore]
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_SMALL_INT)]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string RequestBody { get; init; }
|
||||
public virtual int HttpStatusCode { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 请求content-type
|
||||
/// 拥有者
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_63)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string RequestContentType { get; init; }
|
||||
[Navigate(nameof(OwnerId))]
|
||||
public Sys_User Owner { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[Column]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual long? OwnerDeptId { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[Column]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual long? OwnerId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 请求头信息
|
||||
/// </summary>
|
||||
#if DBTYPE_SQLSERVER
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_MAX)]
|
||||
#else
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
#endif
|
||||
[Ignore]
|
||||
[JsonIgnore]
|
||||
public virtual string RequestHeaders { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 请求地址
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_127)]
|
||||
[Ignore]
|
||||
[JsonIgnore]
|
||||
public virtual string RequestUrl { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 响应内容
|
||||
/// </summary>
|
||||
#if DBTYPE_SQLSERVER
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_MAX)]
|
||||
#else
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
#endif
|
||||
[Ignore]
|
||||
[JsonIgnore]
|
||||
public virtual string ResponseBody { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 响应content-type
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_63)]
|
||||
[Ignore]
|
||||
[JsonIgnore]
|
||||
public virtual string ResponseContentType { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 响应头
|
||||
/// </summary>
|
||||
#if DBTYPE_SQLSERVER
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_MAX)]
|
||||
#else
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
#endif
|
||||
[Ignore]
|
||||
[JsonIgnore]
|
||||
public virtual string ResponseHeaders { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务器IP
|
||||
/// 请求跟踪标识
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual int? ServerIp { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[JsonIgnore]
|
||||
[Navigate(nameof(UserId))]
|
||||
public Sys_User User { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户编号
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[JsonIgnore]
|
||||
public virtual long? UserId { get; init; }
|
||||
public virtual Guid TraceId { get; init; }
|
||||
}
|
125
src/backend/NetAdmin.Domain/DbMaps/Sys/Sys_RequestLogDetail.cs
Normal file
125
src/backend/NetAdmin.Domain/DbMaps/Sys/Sys_RequestLogDetail.cs
Normal file
@ -0,0 +1,125 @@
|
||||
namespace NetAdmin.Domain.DbMaps.Sys;
|
||||
|
||||
/// <summary>
|
||||
/// 请求日志明细表
|
||||
/// </summary>
|
||||
[Table(Name = Chars.FLG_DB_TABLE_NAME_PREFIX + nameof(Sys_RequestLogDetail))]
|
||||
[SqlIndex(Chars.FLG_DB_INDEX_PREFIX + nameof(CreatedTime), $"{nameof(CreatedTime)} DESC", false)]
|
||||
public record Sys_RequestLogDetail : SimpleEntity, IFieldCreatedTime, IFieldCreatedClientUserAgent
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[Column(ServerTime = DateTimeKind.Local, CanUpdate = false, Position = -1)]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual DateTime CreatedTime { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
#if DBTYPE_SQLSERVER
|
||||
[Column(Position = -1, DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_1022)]
|
||||
#else
|
||||
[Column(Position = -1, DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
#endif
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string CreatedUserAgent { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 程序响应码
|
||||
/// </summary>
|
||||
[Column]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual ErrorCodes ErrorCode { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 异常信息
|
||||
/// </summary>
|
||||
#if DBTYPE_SQLSERVER
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_MAX)]
|
||||
#else
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
#endif
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Exception { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 请求内容
|
||||
/// </summary>
|
||||
#if DBTYPE_SQLSERVER
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_MAX)]
|
||||
#else
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
#endif
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string RequestBody { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 请求content-type
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_63)]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string RequestContentType { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 请求头信息
|
||||
/// </summary>
|
||||
#if DBTYPE_SQLSERVER
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_MAX)]
|
||||
#else
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
#endif
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string RequestHeaders { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 请求地址
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_127)]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string RequestUrl { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 响应内容
|
||||
/// </summary>
|
||||
#if DBTYPE_SQLSERVER
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_MAX)]
|
||||
#else
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
#endif
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string ResponseBody { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 响应content-type
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_63)]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string ResponseContentType { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 响应头
|
||||
/// </summary>
|
||||
#if DBTYPE_SQLSERVER
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_MAX)]
|
||||
#else
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
#endif
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string ResponseHeaders { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务器IP
|
||||
/// </summary>
|
||||
[Column]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual int? ServerIp { get; init; }
|
||||
}
|
@ -6,14 +6,14 @@ namespace NetAdmin.Domain.DbMaps.Sys;
|
||||
/// <summary>
|
||||
/// 角色表
|
||||
/// </summary>
|
||||
[FreeSql.DataAnnotations.Index(Chars.FLG_DB_INDEX_PREFIX + nameof(Name), nameof(Name), true)]
|
||||
[Table(Name = Chars.FLG_DB_TABLE_NAME_PREFIX + nameof(Sys_Role))]
|
||||
[SqlIndex(Chars.FLG_DB_INDEX_PREFIX + nameof(Name), nameof(Name), true)]
|
||||
[Table(Name = Chars.FLG_DB_TABLE_NAME_PREFIX + nameof(Sys_Role))]
|
||||
public record Sys_Role : VersionEntity, IFieldSort, IFieldEnabled, IFieldSummary, IRegister
|
||||
{
|
||||
/// <summary>
|
||||
/// 角色-接口映射
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Navigate(ManyToMany = typeof(Sys_RoleApi))]
|
||||
public ICollection<Sys_Api> Apis { get; init; }
|
||||
@ -26,7 +26,7 @@ public record Sys_Role : VersionEntity, IFieldSort, IFieldEnabled, IFieldSummary
|
||||
#else
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
#endif
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string DashboardLayout { get; set; }
|
||||
|
||||
@ -34,14 +34,14 @@ public record Sys_Role : VersionEntity, IFieldSort, IFieldEnabled, IFieldSummary
|
||||
/// 数据范围
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual DataScopes DataScope { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 角色-部门映射
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Navigate(ManyToMany = typeof(Sys_RoleDept))]
|
||||
public ICollection<Sys_Dept> Depts { get; init; }
|
||||
@ -50,7 +50,7 @@ public record Sys_Role : VersionEntity, IFieldSort, IFieldEnabled, IFieldSummary
|
||||
/// 是否显示仪表板
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual bool DisplayDashboard { get; init; }
|
||||
|
||||
@ -58,7 +58,7 @@ public record Sys_Role : VersionEntity, IFieldSort, IFieldEnabled, IFieldSummary
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual bool Enabled { get; init; }
|
||||
|
||||
@ -66,14 +66,14 @@ public record Sys_Role : VersionEntity, IFieldSort, IFieldEnabled, IFieldSummary
|
||||
/// 是否忽略权限控制
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual bool IgnorePermissionControl { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 角色-菜单映射
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Navigate(ManyToMany = typeof(Sys_RoleMenu))]
|
||||
public ICollection<Sys_Menu> Menus { get; init; }
|
||||
@ -82,14 +82,14 @@ public record Sys_Role : VersionEntity, IFieldSort, IFieldEnabled, IFieldSummary
|
||||
/// 角色名称
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_31)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Name { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 发送给此角色的站内信集合
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Navigate(ManyToMany = typeof(Sys_SiteMsgRole))]
|
||||
public ICollection<Sys_SiteMsg> SiteMsgs { get; init; }
|
||||
@ -98,7 +98,7 @@ public record Sys_Role : VersionEntity, IFieldSort, IFieldEnabled, IFieldSummary
|
||||
/// 排序值,越大越前
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual long Sort { get; init; }
|
||||
|
||||
@ -106,14 +106,14 @@ public record Sys_Role : VersionEntity, IFieldSort, IFieldEnabled, IFieldSummary
|
||||
/// 备注
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Summary { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 此角色下的用户集合
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Navigate(ManyToMany = typeof(Sys_UserRole))]
|
||||
public ICollection<Sys_User> Users { get; init; }
|
||||
|
@ -9,7 +9,7 @@ public record Sys_RoleApi : ImmutableEntity
|
||||
/// <summary>
|
||||
/// 关联的接口
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public Sys_Api Api { get; init; }
|
||||
|
||||
@ -17,14 +17,14 @@ public record Sys_RoleApi : ImmutableEntity
|
||||
/// 接口编号
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_127)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public string ApiId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联的角色
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public Sys_Role Role { get; init; }
|
||||
|
||||
@ -32,7 +32,7 @@ public record Sys_RoleApi : ImmutableEntity
|
||||
/// 角色编号
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public long RoleId { get; init; }
|
||||
}
|
@ -3,15 +3,14 @@ namespace NetAdmin.Domain.DbMaps.Sys;
|
||||
/// <summary>
|
||||
/// 角色-部门映射表
|
||||
/// </summary>
|
||||
[FreeSql.DataAnnotations.Index( //
|
||||
$"{Chars.FLG_DB_INDEX_PREFIX}{nameof(RoleId)}_{nameof(DeptId)}", $"{nameof(RoleId)},{nameof(DeptId)}", true)]
|
||||
[SqlIndex($"{Chars.FLG_DB_INDEX_PREFIX}{nameof(RoleId)}_{nameof(DeptId)}", $"{nameof(RoleId)},{nameof(DeptId)}", true)]
|
||||
[Table(Name = Chars.FLG_DB_TABLE_NAME_PREFIX + nameof(Sys_RoleDept))]
|
||||
public record Sys_RoleDept : ImmutableEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 关联的部门
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public Sys_Dept Dept { get; init; }
|
||||
|
||||
@ -19,14 +18,14 @@ public record Sys_RoleDept : ImmutableEntity
|
||||
/// 可访问的部门编号
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public long DeptId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联的角色
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public Sys_Role Role { get; init; }
|
||||
|
||||
@ -34,7 +33,7 @@ public record Sys_RoleDept : ImmutableEntity
|
||||
/// 角色编号
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public long RoleId { get; init; }
|
||||
}
|
@ -3,15 +3,14 @@ namespace NetAdmin.Domain.DbMaps.Sys;
|
||||
/// <summary>
|
||||
/// 角色-菜单映射表
|
||||
/// </summary>
|
||||
[FreeSql.DataAnnotations.Index( //
|
||||
$"{Chars.FLG_DB_INDEX_PREFIX}{nameof(RoleId)}_{nameof(MenuId)}", $"{nameof(RoleId)},{nameof(MenuId)}", true)]
|
||||
[SqlIndex($"{Chars.FLG_DB_INDEX_PREFIX}{nameof(RoleId)}_{nameof(MenuId)}", $"{nameof(RoleId)},{nameof(MenuId)}", true)]
|
||||
[Table(Name = Chars.FLG_DB_TABLE_NAME_PREFIX + nameof(Sys_RoleMenu))]
|
||||
public record Sys_RoleMenu : ImmutableEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 关联的菜单
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public Sys_Menu Menu { get; init; }
|
||||
|
||||
@ -19,14 +18,14 @@ public record Sys_RoleMenu : ImmutableEntity
|
||||
/// 菜单编号
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual long MenuId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联的角色
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public Sys_Role Role { get; init; }
|
||||
|
||||
@ -34,7 +33,7 @@ public record Sys_RoleMenu : ImmutableEntity
|
||||
/// 角色编号
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual long RoleId { get; init; }
|
||||
}
|
@ -17,14 +17,14 @@ public record Sys_SiteMsg : VersionEntity, IRegister, IFieldSummary
|
||||
#else
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
#endif
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Content { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 消息-创建者映射
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Navigate(nameof(CreatedUserId))]
|
||||
public Sys_User Creator { get; init; }
|
||||
@ -32,7 +32,7 @@ public record Sys_SiteMsg : VersionEntity, IRegister, IFieldSummary
|
||||
/// <summary>
|
||||
/// 消息-部门映射
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Navigate(ManyToMany = typeof(Sys_SiteMsgDept))]
|
||||
public ICollection<Sys_Dept> Depts { get; init; }
|
||||
@ -40,7 +40,7 @@ public record Sys_SiteMsg : VersionEntity, IRegister, IFieldSummary
|
||||
/// <summary>
|
||||
/// 消息-标记映射
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Navigate(nameof(Sys_SiteMsgFlag.SiteMsgId))]
|
||||
public ICollection<Sys_SiteMsgFlag> Flags { get; init; }
|
||||
@ -48,14 +48,14 @@ public record Sys_SiteMsg : VersionEntity, IRegister, IFieldSummary
|
||||
/// <summary>
|
||||
/// 消息类型
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual SiteMsgTypes MsgType { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 消息-角色映射
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Navigate(ManyToMany = typeof(Sys_SiteMsgRole))]
|
||||
public ICollection<Sys_Role> Roles { get; init; }
|
||||
@ -64,7 +64,7 @@ public record Sys_SiteMsg : VersionEntity, IRegister, IFieldSummary
|
||||
/// 消息摘要
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Summary { get; init; }
|
||||
|
||||
@ -72,14 +72,14 @@ public record Sys_SiteMsg : VersionEntity, IRegister, IFieldSummary
|
||||
/// 消息主题
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Title { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 消息-用户映射
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Navigate(ManyToMany = typeof(Sys_SiteMsgUser))]
|
||||
public ICollection<Sys_User> Users { get; init; }
|
||||
|
@ -3,15 +3,15 @@ namespace NetAdmin.Domain.DbMaps.Sys;
|
||||
/// <summary>
|
||||
/// 站内信-部门映射表
|
||||
/// </summary>
|
||||
[FreeSql.DataAnnotations.Index( //
|
||||
$"{Chars.FLG_DB_INDEX_PREFIX}{nameof(DeptId)}_{nameof(SiteMsgId)}", $"{nameof(DeptId)},{nameof(SiteMsgId)}", true)]
|
||||
[SqlIndex($"{Chars.FLG_DB_INDEX_PREFIX}{nameof(DeptId)}_{nameof(SiteMsgId)}", $"{nameof(DeptId)},{nameof(SiteMsgId)}"
|
||||
, true)]
|
||||
[Table(Name = Chars.FLG_DB_TABLE_NAME_PREFIX + nameof(Sys_SiteMsgDept))]
|
||||
public record Sys_SiteMsgDept : ImmutableEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 关联的部门
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public Sys_Dept Dept { get; init; }
|
||||
|
||||
@ -19,14 +19,14 @@ public record Sys_SiteMsgDept : ImmutableEntity
|
||||
/// 部门编号
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public long DeptId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联的站内信
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public Sys_SiteMsg SiteMsg { get; init; }
|
||||
|
||||
@ -34,7 +34,7 @@ public record Sys_SiteMsgDept : ImmutableEntity
|
||||
/// 站内信编号
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public long SiteMsgId { get; init; }
|
||||
}
|
@ -5,8 +5,8 @@ namespace NetAdmin.Domain.DbMaps.Sys;
|
||||
/// <summary>
|
||||
/// 站内信标记表
|
||||
/// </summary>
|
||||
[FreeSql.DataAnnotations.Index( //
|
||||
$"{Chars.FLG_DB_INDEX_PREFIX}{nameof(SiteMsgId)}_{nameof(UserId)}", $"{nameof(SiteMsgId)},{nameof(UserId)}", true)]
|
||||
[SqlIndex($"{Chars.FLG_DB_INDEX_PREFIX}{nameof(SiteMsgId)}_{nameof(UserId)}", $"{nameof(SiteMsgId)},{nameof(UserId)}"
|
||||
, true)]
|
||||
[Table(Name = Chars.FLG_DB_TABLE_NAME_PREFIX + nameof(Sys_SiteMsgFlag))]
|
||||
public record Sys_SiteMsgFlag : MutableEntity
|
||||
{
|
||||
@ -14,7 +14,7 @@ public record Sys_SiteMsgFlag : MutableEntity
|
||||
/// 站内信编号
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual long SiteMsgId { get; init; }
|
||||
|
||||
@ -22,7 +22,7 @@ public record Sys_SiteMsgFlag : MutableEntity
|
||||
/// 用户编号
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public long UserId { get; init; }
|
||||
|
||||
@ -30,7 +30,7 @@ public record Sys_SiteMsgFlag : MutableEntity
|
||||
/// 用户站内信状态
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual UserSiteMsgStatues UserSiteMsgStatus { get; init; }
|
||||
}
|
@ -3,15 +3,15 @@ namespace NetAdmin.Domain.DbMaps.Sys;
|
||||
/// <summary>
|
||||
/// 站内信-角色映射表
|
||||
/// </summary>
|
||||
[FreeSql.DataAnnotations.Index( //
|
||||
$"{Chars.FLG_DB_INDEX_PREFIX}{nameof(RoleId)}_{nameof(SiteMsgId)}", $"{nameof(RoleId)},{nameof(SiteMsgId)}", true)]
|
||||
[SqlIndex($"{Chars.FLG_DB_INDEX_PREFIX}{nameof(RoleId)}_{nameof(SiteMsgId)}", $"{nameof(RoleId)},{nameof(SiteMsgId)}"
|
||||
, true)]
|
||||
[Table(Name = Chars.FLG_DB_TABLE_NAME_PREFIX + nameof(Sys_SiteMsgRole))]
|
||||
public record Sys_SiteMsgRole : ImmutableEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 关联的角色
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public Sys_Role Role { get; init; }
|
||||
|
||||
@ -19,14 +19,14 @@ public record Sys_SiteMsgRole : ImmutableEntity
|
||||
/// 角色编号
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public long RoleId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联的站内信
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public Sys_SiteMsg SiteMsg { get; init; }
|
||||
|
||||
@ -34,7 +34,7 @@ public record Sys_SiteMsgRole : ImmutableEntity
|
||||
/// 站内信编号
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public long SiteMsgId { get; init; }
|
||||
}
|
@ -3,15 +3,15 @@ namespace NetAdmin.Domain.DbMaps.Sys;
|
||||
/// <summary>
|
||||
/// 站内信-用户映射表
|
||||
/// </summary>
|
||||
[FreeSql.DataAnnotations.Index( //
|
||||
$"{Chars.FLG_DB_INDEX_PREFIX}{nameof(UserId)}_{nameof(SiteMsgId)}", $"{nameof(UserId)},{nameof(SiteMsgId)}", true)]
|
||||
[SqlIndex($"{Chars.FLG_DB_INDEX_PREFIX}{nameof(UserId)}_{nameof(SiteMsgId)}", $"{nameof(UserId)},{nameof(SiteMsgId)}"
|
||||
, true)]
|
||||
[Table(Name = Chars.FLG_DB_TABLE_NAME_PREFIX + nameof(Sys_SiteMsgUser))]
|
||||
public record Sys_SiteMsgUser : ImmutableEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 关联的站内信
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public Sys_SiteMsg SiteMsg { get; init; }
|
||||
|
||||
@ -19,14 +19,14 @@ public record Sys_SiteMsgUser : ImmutableEntity
|
||||
/// 站内信编号
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public long SiteMsgId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联的用户
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public Sys_User User { get; init; }
|
||||
|
||||
@ -34,7 +34,7 @@ public record Sys_SiteMsgUser : ImmutableEntity
|
||||
/// 用户编号
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public long UserId { get; init; }
|
||||
}
|
@ -5,24 +5,24 @@ namespace NetAdmin.Domain.DbMaps.Sys;
|
||||
/// <summary>
|
||||
/// 用户基本信息表
|
||||
/// </summary>
|
||||
[FreeSql.DataAnnotations.Index(Chars.FLG_DB_INDEX_PREFIX + nameof(Email), nameof(Email), true)]
|
||||
[FreeSql.DataAnnotations.Index(Chars.FLG_DB_INDEX_PREFIX + nameof(Mobile), nameof(Mobile), true)]
|
||||
[FreeSql.DataAnnotations.Index(Chars.FLG_DB_INDEX_PREFIX + nameof(UserName), nameof(UserName), true)]
|
||||
[Table(Name = Chars.FLG_DB_TABLE_NAME_PREFIX + nameof(Sys_User))]
|
||||
[SqlIndex(Chars.FLG_DB_INDEX_PREFIX + nameof(Email), nameof(Email), true)]
|
||||
[SqlIndex(Chars.FLG_DB_INDEX_PREFIX + nameof(Mobile), nameof(Mobile), true)]
|
||||
[SqlIndex(Chars.FLG_DB_INDEX_PREFIX + nameof(UserName), nameof(UserName), true)]
|
||||
[Table(Name = Chars.FLG_DB_TABLE_NAME_PREFIX + nameof(Sys_User))]
|
||||
public record Sys_User : VersionEntity, IFieldSummary, IFieldEnabled, IRegister
|
||||
{
|
||||
/// <summary>
|
||||
/// 头像链接
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_127)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Avatar { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属部门
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Navigate(nameof(DeptId))]
|
||||
public Sys_Dept Dept { get; init; }
|
||||
@ -31,7 +31,7 @@ public record Sys_User : VersionEntity, IFieldSummary, IFieldEnabled, IRegister
|
||||
/// 部门编号
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual long DeptId { get; init; }
|
||||
|
||||
@ -39,7 +39,7 @@ public record Sys_User : VersionEntity, IFieldSummary, IFieldEnabled, IRegister
|
||||
/// 邮箱
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_63)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Email { get; init; }
|
||||
|
||||
@ -47,7 +47,7 @@ public record Sys_User : VersionEntity, IFieldSummary, IFieldEnabled, IRegister
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual bool Enabled { get; init; }
|
||||
|
||||
@ -55,7 +55,7 @@ public record Sys_User : VersionEntity, IFieldSummary, IFieldEnabled, IRegister
|
||||
/// 手机号码
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_15)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Mobile { get; init; }
|
||||
|
||||
@ -63,21 +63,21 @@ public record Sys_User : VersionEntity, IFieldSummary, IFieldEnabled, IRegister
|
||||
/// 密码
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public Guid Password { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户档案
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public Sys_UserProfile Profile { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属角色
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Navigate(ManyToMany = typeof(Sys_UserRole))]
|
||||
public ICollection<Sys_Role> Roles { get; init; }
|
||||
@ -85,7 +85,7 @@ public record Sys_User : VersionEntity, IFieldSummary, IFieldEnabled, IRegister
|
||||
/// <summary>
|
||||
/// 发送给此用户的站内信集合
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Navigate(ManyToMany = typeof(Sys_SiteMsgUser))]
|
||||
public ICollection<Sys_SiteMsg> SiteMsgs { get; init; }
|
||||
@ -94,7 +94,7 @@ public record Sys_User : VersionEntity, IFieldSummary, IFieldEnabled, IRegister
|
||||
/// 描述
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Summary { get; init; }
|
||||
|
||||
@ -102,7 +102,7 @@ public record Sys_User : VersionEntity, IFieldSummary, IFieldEnabled, IRegister
|
||||
/// 授权验证Token,全局唯一,可以随时重置(强制下线)
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public Guid Token { get; init; }
|
||||
|
||||
@ -110,7 +110,7 @@ public record Sys_User : VersionEntity, IFieldSummary, IFieldEnabled, IRegister
|
||||
/// 用户名
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_31)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string UserName { get; init; }
|
||||
|
||||
|
@ -16,7 +16,7 @@ public record Sys_UserProfile : VersionEntity, IRegister
|
||||
#else
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
#endif
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string AppConfig { get; set; }
|
||||
|
||||
@ -24,7 +24,7 @@ public record Sys_UserProfile : VersionEntity, IRegister
|
||||
/// 出生日期
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual DateTime? BornDate { get; init; }
|
||||
|
||||
@ -32,7 +32,7 @@ public record Sys_UserProfile : VersionEntity, IRegister
|
||||
/// 证件号码
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_63)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string CertificateNumber { get; init; }
|
||||
|
||||
@ -40,7 +40,7 @@ public record Sys_UserProfile : VersionEntity, IRegister
|
||||
/// 证件类型
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual CertificateTypes? CertificateType { get; init; }
|
||||
|
||||
@ -48,7 +48,7 @@ public record Sys_UserProfile : VersionEntity, IRegister
|
||||
/// 工作地址
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_127)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string CompanyAddress { get; init; }
|
||||
|
||||
@ -56,7 +56,7 @@ public record Sys_UserProfile : VersionEntity, IRegister
|
||||
/// 工作地区
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public int? CompanyArea { get; init; }
|
||||
|
||||
@ -64,7 +64,7 @@ public record Sys_UserProfile : VersionEntity, IRegister
|
||||
/// 工作单位
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_31)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string CompanyName { get; init; }
|
||||
|
||||
@ -72,7 +72,7 @@ public record Sys_UserProfile : VersionEntity, IRegister
|
||||
/// 工作电话
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_31)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string CompanyTelephone { get; init; }
|
||||
|
||||
@ -80,7 +80,7 @@ public record Sys_UserProfile : VersionEntity, IRegister
|
||||
/// 文化程度
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual Educations? Education { get; init; }
|
||||
|
||||
@ -88,7 +88,7 @@ public record Sys_UserProfile : VersionEntity, IRegister
|
||||
/// 紧急联系地址
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_127)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string EmergencyContactAddress { get; init; }
|
||||
|
||||
@ -96,7 +96,7 @@ public record Sys_UserProfile : VersionEntity, IRegister
|
||||
/// 紧急联系地区
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public int? EmergencyContactArea { get; init; }
|
||||
|
||||
@ -104,7 +104,7 @@ public record Sys_UserProfile : VersionEntity, IRegister
|
||||
/// 紧急联系人手机号
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_15)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string EmergencyContactMobile { get; init; }
|
||||
|
||||
@ -112,7 +112,7 @@ public record Sys_UserProfile : VersionEntity, IRegister
|
||||
/// 紧急联系人
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_31)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string EmergencyContactName { get; init; }
|
||||
|
||||
@ -120,7 +120,7 @@ public record Sys_UserProfile : VersionEntity, IRegister
|
||||
/// 毕业学校
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_31)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string GraduateSchool { get; init; }
|
||||
|
||||
@ -128,7 +128,7 @@ public record Sys_UserProfile : VersionEntity, IRegister
|
||||
/// 身高
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual int? Height { get; init; }
|
||||
|
||||
@ -136,7 +136,7 @@ public record Sys_UserProfile : VersionEntity, IRegister
|
||||
/// 住宅地址
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_127)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string HomeAddress { get; init; }
|
||||
|
||||
@ -144,7 +144,7 @@ public record Sys_UserProfile : VersionEntity, IRegister
|
||||
/// 住宅地区
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public int? HomeArea { get; init; }
|
||||
|
||||
@ -152,7 +152,7 @@ public record Sys_UserProfile : VersionEntity, IRegister
|
||||
/// 住宅电话
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_31)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string HomeTelephone { get; init; }
|
||||
|
||||
@ -160,7 +160,7 @@ public record Sys_UserProfile : VersionEntity, IRegister
|
||||
/// 婚姻状况
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual MarriageStatues? MarriageStatus { get; init; }
|
||||
|
||||
@ -169,7 +169,7 @@ public record Sys_UserProfile : VersionEntity, IRegister
|
||||
/// </summary>
|
||||
/// 7
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual Nations? Nation { get; init; }
|
||||
|
||||
@ -177,7 +177,7 @@ public record Sys_UserProfile : VersionEntity, IRegister
|
||||
/// 籍贯
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public int? NationArea { get; init; }
|
||||
|
||||
@ -185,7 +185,7 @@ public record Sys_UserProfile : VersionEntity, IRegister
|
||||
/// 政治面貌
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual PoliticalStatues? PoliticalStatus { get; init; }
|
||||
|
||||
@ -193,7 +193,7 @@ public record Sys_UserProfile : VersionEntity, IRegister
|
||||
/// 职业
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_31)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Profession { get; init; }
|
||||
|
||||
@ -201,7 +201,7 @@ public record Sys_UserProfile : VersionEntity, IRegister
|
||||
/// 真实姓名
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_31)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string RealName { get; init; }
|
||||
|
||||
@ -209,14 +209,14 @@ public record Sys_UserProfile : VersionEntity, IRegister
|
||||
/// 性别
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual Sexes? Sex { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户基本信息
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public Sys_User User { get; init; }
|
||||
|
||||
|
@ -9,7 +9,7 @@ public record Sys_UserRole : VersionEntity
|
||||
/// <summary>
|
||||
/// 关联的角色
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public Sys_Role Role { get; init; }
|
||||
|
||||
@ -17,14 +17,14 @@ public record Sys_UserRole : VersionEntity
|
||||
/// 角色编号
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public long RoleId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联的用户
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public Sys_User User { get; init; }
|
||||
|
||||
@ -32,7 +32,7 @@ public record Sys_UserRole : VersionEntity
|
||||
/// 用户编号
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public long UserId { get; init; }
|
||||
}
|
@ -12,7 +12,7 @@ public record Sys_VerifyCode : VersionEntity
|
||||
/// 验证码
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_7)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Code { get; init; }
|
||||
|
||||
@ -20,7 +20,7 @@ public record Sys_VerifyCode : VersionEntity
|
||||
/// 目标设备
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_63)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string DestDevice { get; init; }
|
||||
|
||||
@ -28,7 +28,7 @@ public record Sys_VerifyCode : VersionEntity
|
||||
/// 设备类型
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual VerifyCodeDeviceTypes DeviceType { get; init; }
|
||||
|
||||
@ -36,7 +36,7 @@ public record Sys_VerifyCode : VersionEntity
|
||||
/// 发送报告
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public string Report { get; init; }
|
||||
|
||||
@ -44,7 +44,7 @@ public record Sys_VerifyCode : VersionEntity
|
||||
/// 验证码状态
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual VerifyCodeStatues Status { get; init; }
|
||||
|
||||
@ -52,7 +52,7 @@ public record Sys_VerifyCode : VersionEntity
|
||||
/// 验证码类型
|
||||
/// </summary>
|
||||
[Column]
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual VerifyCodeTypes Type { get; init; }
|
||||
}
|
@ -37,6 +37,47 @@ public sealed record DynamicFilterInfo : DataAbstraction
|
||||
/// </summary>
|
||||
public static implicit operator FreeSql.Internal.Model.DynamicFilterInfo(DynamicFilterInfo d)
|
||||
{
|
||||
return d.Adapt<FreeSql.Internal.Model.DynamicFilterInfo>();
|
||||
var ret = d.Adapt<FreeSql.Internal.Model.DynamicFilterInfo>();
|
||||
ProcessDynamicFilter(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static void ProcessDynamicFilter(FreeSql.Internal.Model.DynamicFilterInfo d)
|
||||
{
|
||||
if (d?.Filters != null) {
|
||||
foreach (var filterInfo in d.Filters) {
|
||||
ProcessDynamicFilter(filterInfo);
|
||||
}
|
||||
}
|
||||
|
||||
if (new[] { nameof(IFieldCreatedClientIp.CreatedClientIp), nameof(IFieldModifiedClientIp.ModifiedClientIp) }
|
||||
.Contains(d?.Field, StringComparer.OrdinalIgnoreCase)) {
|
||||
var val = d!.Value?.ToString();
|
||||
if (val?.IsIpV4() == true) {
|
||||
d.Value = val.IpV4ToInt32();
|
||||
}
|
||||
}
|
||||
else if (d?.Operator == DynamicFilterOperator.DateRange) {
|
||||
var values = ((JsonElement)d.Value).Deserialize<string[]>();
|
||||
if (!DateTime.TryParse(values[0], CultureInfo.InvariantCulture, out _)) {
|
||||
var result = values[0]
|
||||
.ExecuteCSharpCodeAsync<DateTime>([typeof(DateTime).Assembly], nameof(System))
|
||||
.ConfigureAwait(false)
|
||||
.GetAwaiter()
|
||||
.GetResult();
|
||||
values[0] = $"{result:yyyy-MM-dd HH:mm:ss}";
|
||||
}
|
||||
|
||||
if (!DateTime.TryParse(values[1], CultureInfo.InvariantCulture, out _)) {
|
||||
var result = values[1]
|
||||
.ExecuteCSharpCodeAsync<DateTime>([typeof(DateTime).Assembly], nameof(System))
|
||||
.ConfigureAwait(false)
|
||||
.GetAwaiter()
|
||||
.GetResult();
|
||||
values[1] = $"{result:yyyy-MM-dd HH:mm:ss}";
|
||||
}
|
||||
|
||||
d.Value = values;
|
||||
}
|
||||
}
|
||||
}
|
@ -6,17 +6,17 @@ namespace NetAdmin.Domain.Dto.Dependency;
|
||||
public sealed record PagedQueryRsp<T>(int Page, int PageSize, long Total, IEnumerable<T> Rows) : IPagedInfo
|
||||
where T : DataAbstraction
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据行
|
||||
/// </summary>
|
||||
public IEnumerable<T> Rows { get; } = Rows;
|
||||
|
||||
/// <inheritdoc cref="IPagedInfo.Page" />
|
||||
public int Page { get; init; } = Page;
|
||||
|
||||
/// <inheritdoc cref="IPagedInfo.PageSize" />
|
||||
public int PageSize { get; init; } = PageSize;
|
||||
|
||||
/// <summary>
|
||||
/// 数据行
|
||||
/// </summary>
|
||||
public IEnumerable<T> Rows { get; init; } = Rows;
|
||||
|
||||
/// <summary>
|
||||
/// 数据总条
|
||||
/// </summary>
|
||||
|
@ -6,30 +6,30 @@ namespace NetAdmin.Domain.Dto.Sys.Api;
|
||||
public record ExportApiRsp : QueryApiRsp
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
public override IEnumerable<QueryApiRsp> Children { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(0)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.接口路径))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.接口路径))]
|
||||
public override string Id { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(2)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.请求方式))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.请求方式))]
|
||||
public override string Method { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(1)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.接口名称))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.接口名称))]
|
||||
public override string Name { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(3)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.接口描述))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.接口描述))]
|
||||
public override string Summary { get; init; }
|
||||
}
|
@ -27,6 +27,10 @@ public record QueryApiRsp : Sys_Api
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string ParentId { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_Api.PathCrc32" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override int PathCrc32 { get; init; }
|
||||
|
||||
/// <inheritdoc cref="IFieldSummary.Summary" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string Summary { get; init; }
|
||||
|
@ -6,7 +6,7 @@ namespace NetAdmin.Domain.Dto.Sys.Cache;
|
||||
public sealed record GetAllEntriesReq : DataAbstraction
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据库索引号
|
||||
/// 关键词
|
||||
/// </summary>
|
||||
public int DbIndex { get; init; }
|
||||
public string Keywords { get; init; }
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
namespace NetAdmin.Domain.Dto.Sys.Cache;
|
||||
|
||||
/// <summary>
|
||||
/// 响应:获取所有缓存项
|
||||
/// </summary>
|
||||
public sealed record GetAllEntriesRsp : DataAbstraction
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetAllEntriesRsp" /> class.
|
||||
/// </summary>
|
||||
public GetAllEntriesRsp() { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetAllEntriesRsp" /> class.
|
||||
/// </summary>
|
||||
public GetAllEntriesRsp(long absExp, string key, long sldExp, string data)
|
||||
{
|
||||
AbsExp = absExp;
|
||||
Key = key;
|
||||
SldExp = sldExp;
|
||||
Data = data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绝对过期时间
|
||||
/// </summary>
|
||||
public DateTime? AbsExpTime => AbsExp == -1 ? null : DateTime.FromBinary(AbsExp).ToLocalTime();
|
||||
|
||||
/// <summary>
|
||||
/// 滑动过期时间
|
||||
/// </summary>
|
||||
public DateTime? SldExpTime => SldExp == -1 ? null : DateTime.FromBinary(SldExp).ToLocalTime();
|
||||
|
||||
/// <summary>
|
||||
/// 绝对过期时间
|
||||
/// </summary>
|
||||
public long AbsExp { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 缓存值
|
||||
/// </summary>
|
||||
public string Data { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 缓存键
|
||||
/// </summary>
|
||||
public string Key { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 滑动过期时间
|
||||
/// </summary>
|
||||
public long SldExp { get; init; }
|
||||
}
|
12
src/backend/NetAdmin.Domain/Dto/Sys/Cache/GetEntriesReq.cs
Normal file
12
src/backend/NetAdmin.Domain/Dto/Sys/Cache/GetEntriesReq.cs
Normal file
@ -0,0 +1,12 @@
|
||||
namespace NetAdmin.Domain.Dto.Sys.Cache;
|
||||
|
||||
/// <summary>
|
||||
/// 请求:获取缓存项
|
||||
/// </summary>
|
||||
public sealed record GetEntriesReq : DataAbstraction
|
||||
{
|
||||
/// <summary>
|
||||
/// 缓存键
|
||||
/// </summary>
|
||||
public string Key { get; init; }
|
||||
}
|
34
src/backend/NetAdmin.Domain/Dto/Sys/Cache/GetEntryRsp.cs
Normal file
34
src/backend/NetAdmin.Domain/Dto/Sys/Cache/GetEntryRsp.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using StackExchange.Redis;
|
||||
|
||||
namespace NetAdmin.Domain.Dto.Sys.Cache;
|
||||
|
||||
/// <summary>
|
||||
/// 响应:获取所有缓存项
|
||||
/// </summary>
|
||||
public sealed record GetEntryRsp : DataAbstraction
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetEntryRsp" /> class.
|
||||
/// </summary>
|
||||
public GetEntryRsp() { }
|
||||
|
||||
/// <summary>
|
||||
/// 缓存值
|
||||
/// </summary>
|
||||
public string Data { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 过期时间
|
||||
/// </summary>
|
||||
public DateTime? ExpireTime { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 缓存键
|
||||
/// </summary>
|
||||
public string Key { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据类型
|
||||
/// </summary>
|
||||
public RedisType Type { get; init; }
|
||||
}
|
@ -10,44 +10,44 @@ public record ExportConfigRsp : QueryConfigRsp, IRegister
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(6)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.是否启用))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.是否启用))]
|
||||
public override bool Enabled { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(0)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.唯一编码))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.唯一编码))]
|
||||
public override long Id { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(3)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.人工审核))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.人工审核))]
|
||||
public override bool UserRegisterConfirm { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
public override QueryDeptRsp UserRegisterDept { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 默认部门
|
||||
/// </summary>
|
||||
[CsvIndex(1)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.默认部门))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.默认部门))]
|
||||
public string UserRegisterDeptName { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
public override QueryRoleRsp UserRegisterRole { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 默认角色
|
||||
/// </summary>
|
||||
[CsvIndex(2)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.默认角色))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.默认角色))]
|
||||
public string UserRegisterRoleName { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
|
@ -6,42 +6,42 @@ namespace NetAdmin.Domain.Dto.Sys.Dept;
|
||||
public record ExportDeptRsp : QueryDeptRsp
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
public override IEnumerable<QueryDeptRsp> Children { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(5)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.创建时间))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.创建时间))]
|
||||
public override DateTime CreatedTime { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(4)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.是否启用))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.是否启用))]
|
||||
public override bool Enabled { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(0)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.唯一编码))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.唯一编码))]
|
||||
public override long Id { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(1)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.部门名称))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.部门名称))]
|
||||
public override string Name { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(2)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.排序))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.排序))]
|
||||
public override long Sort { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(3)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.备注))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.备注))]
|
||||
public override string Summary { get; init; }
|
||||
}
|
@ -29,6 +29,7 @@ public sealed record IconExportJsInfo : DataAbstraction
|
||||
/// <summary>
|
||||
/// Icons
|
||||
/// </summary>
|
||||
[JsonInclude]
|
||||
public ICollection<string> Icons { get; init; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -7,19 +7,19 @@ public record ExportDicContentRsp : QueryDicContentRsp
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(2)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.创建时间))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.创建时间))]
|
||||
public override DateTime CreatedTime { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(0)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.项名))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.项名))]
|
||||
public override string Key { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(1)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.项值))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.项值))]
|
||||
public override string Value { get; init; }
|
||||
}
|
@ -32,6 +32,14 @@ public record CreateJobReq : Sys_Job
|
||||
/// <inheritdoc />
|
||||
public override long? NextTimeId { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[Range(1, int.MaxValue, ErrorMessageResourceType = typeof(Ln), ErrorMessageResourceName = nameof(Ln.随机延时起始时间不正确))]
|
||||
public override int? RandomDelayBegin { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[Range(1, int.MaxValue, ErrorMessageResourceType = typeof(Ln), ErrorMessageResourceName = nameof(Ln.随机延时结束时间不正确))]
|
||||
public override int? RandomDelayEnd { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_Job.RequestBody" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string RequestBody { get; init; }
|
||||
|
@ -11,71 +11,71 @@ public record ExportJobRsp : QueryJobRsp
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(5)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.上次执行状态))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.上次执行状态))]
|
||||
public override string LastStatusCode => base.LastStatusCode;
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(10)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.创建时间))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.创建时间))]
|
||||
public override DateTime CreatedTime { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(9)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.是否启用))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.是否启用))]
|
||||
public override bool Enabled { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(2)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.执行计划))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.执行计划))]
|
||||
public override string ExecutionCron { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(4)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.请求方式))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.请求方式))]
|
||||
public override HttpMethods HttpMethod { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(0)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.唯一编码))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.唯一编码))]
|
||||
public override long Id { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(1)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.作业名称))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.作业名称))]
|
||||
public override string JobName { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(7)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.上次执行耗时))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.上次执行耗时))]
|
||||
public override long? LastDuration { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(6)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.上次执行时间))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.上次执行时间))]
|
||||
public override DateTime? LastExecTime { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(8)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.下次执行时间))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.下次执行时间))]
|
||||
public override DateTime? NextExecTime { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(3)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.作业状态))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.作业状态))]
|
||||
public override JobStatues Status { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
public override QueryUserRsp User { get; init; }
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
using CronExpressionDescriptor;
|
||||
using NetAdmin.Domain.Dto.Sys.User;
|
||||
using NetAdmin.Domain.Enums.Sys;
|
||||
using HttpMethods = NetAdmin.Domain.Enums.HttpMethods;
|
||||
using Options = CronExpressionDescriptor.Options;
|
||||
|
||||
namespace NetAdmin.Domain.Dto.Sys.Job;
|
||||
|
||||
@ -9,7 +11,15 @@ namespace NetAdmin.Domain.Dto.Sys.Job;
|
||||
/// </summary>
|
||||
public record QueryJobRsp : Sys_Job
|
||||
{
|
||||
/// <summary>
|
||||
/// Cron 表达式描述
|
||||
/// </summary>
|
||||
[JsonInclude]
|
||||
public string CronDescription =>
|
||||
ExpressionDescriptor.GetDescription(ExecutionCron, new Options { Locale = "zh-CN" });
|
||||
|
||||
/// <inheritdoc cref="Sys_Job.LastStatusCode" />
|
||||
[JsonInclude]
|
||||
public new virtual string LastStatusCode =>
|
||||
#pragma warning disable IDE0072
|
||||
base.LastStatusCode switch {
|
||||
@ -80,6 +90,14 @@ public record QueryJobRsp : Sys_Job
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override long? NextTimeId { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override int? RandomDelayBegin { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override int? RandomDelayEnd { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_Job.RequestBody" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string RequestBody { get; init; }
|
||||
|
@ -9,44 +9,44 @@ public record ExportJobRecordRsp : QueryJobRecordRsp, IRegister
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(1)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.响应状态码))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.响应状态码))]
|
||||
public override string HttpStatusCode => base.HttpStatusCode;
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(6)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.创建时间))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.创建时间))]
|
||||
public override DateTime CreatedTime { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(3)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.执行耗时))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.执行耗时))]
|
||||
public override long Duration { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(0)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.唯一编码))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.唯一编码))]
|
||||
public override long Id { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
public override QueryJobRsp Job { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 作业名称
|
||||
/// </summary>
|
||||
[CsvIndex(4)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.作业名称))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.作业名称))]
|
||||
public string JobName { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(5)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.响应体))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.响应体))]
|
||||
public override string ResponseBody { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
|
@ -9,6 +9,7 @@ namespace NetAdmin.Domain.Dto.Sys.JobRecord;
|
||||
public record QueryJobRecordRsp : Sys_JobRecord
|
||||
{
|
||||
/// <inheritdoc cref="Sys_JobRecord.HttpStatusCode" />
|
||||
[JsonInclude]
|
||||
public new virtual string HttpStatusCode =>
|
||||
base.HttpStatusCode == Numbers.HTTP_STATUS_BIZ_FAIL
|
||||
? nameof(ErrorCodes.Unhandled).ToLowerCamelCase()
|
||||
|
@ -0,0 +1,50 @@
|
||||
using NetAdmin.Domain.Contexts;
|
||||
using NetAdmin.Domain.Dto.Sys.RequestLog;
|
||||
using NetAdmin.Domain.Dto.Sys.User;
|
||||
|
||||
namespace NetAdmin.Domain.Dto.Sys.LoginLog;
|
||||
|
||||
/// <summary>
|
||||
/// 请求:创建登录日志
|
||||
/// </summary>
|
||||
public record CreateLoginLogReq : Sys_LoginLog, IRegister
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void Register(TypeAdapterConfig config)
|
||||
{
|
||||
_ = config.ForType<CreateRequestLogReq, CreateLoginLogReq>().MapWith(x => Convert(x));
|
||||
}
|
||||
|
||||
private static CreateLoginLogReq Convert(CreateRequestLogReq s)
|
||||
{
|
||||
var body = s.Detail.ResponseBody.ToObject<RestfulInfo<LoginRsp>>();
|
||||
ContextUserToken userToken = null;
|
||||
if (body.Data?.AccessToken != null) {
|
||||
try {
|
||||
userToken = ContextUserToken.Create(body.Data.AccessToken);
|
||||
}
|
||||
catch {
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
|
||||
return new CreateLoginLogReq {
|
||||
Id = s.Id
|
||||
, CreatedClientIp = s.CreatedClientIp
|
||||
, CreatedTime = s.CreatedTime
|
||||
, Duration = s.Duration
|
||||
, HttpStatusCode = s.HttpStatusCode
|
||||
, ErrorCode = s.Detail.ErrorCode
|
||||
, RequestBody = s.Detail.RequestBody
|
||||
, RequestHeaders = s.Detail.RequestHeaders
|
||||
, RequestUrl = s.Detail.RequestUrl
|
||||
, ResponseBody = s.Detail.ResponseBody
|
||||
, ResponseHeaders = s.Detail.ResponseHeaders
|
||||
, ServerIp = s.Detail.ServerIp
|
||||
, CreatedUserAgent = s.Detail.CreatedUserAgent
|
||||
, OwnerId = userToken?.Id
|
||||
, OwnerDeptId = userToken?.DeptId
|
||||
, LoginUserName = s.Detail.RequestBody?.ToObject<LoginByPwdReq>()?.Account
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
using NetAdmin.Domain.Dto.Sys.User;
|
||||
|
||||
namespace NetAdmin.Domain.Dto.Sys.LoginLog;
|
||||
|
||||
/// <summary>
|
||||
/// 响应:导出登录日志
|
||||
/// </summary>
|
||||
public sealed record ExportLoginLogRsp : QueryLoginLogRsp
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(3)]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.客户端IP))]
|
||||
public override string CreatedClientIp => base.CreatedClientIp;
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(4)]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.操作系统))]
|
||||
public override string Os => base.Os;
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIgnore(false)]
|
||||
[CsvIndex(6)]
|
||||
[CsvName(nameof(Ln.创建时间))]
|
||||
public override DateTime CreatedTime { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(5)]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.用户代理))]
|
||||
public override string CreatedUserAgent { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(1)]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.响应状态码))]
|
||||
public override int HttpStatusCode { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(0)]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.唯一编码))]
|
||||
public override long Id { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIgnore(false)]
|
||||
[CsvIndex(2)]
|
||||
[CsvName(nameof(Ln.登录名))]
|
||||
public override string LoginUserName { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIgnore]
|
||||
public override QueryUserRsp Owner { get; init; }
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
namespace NetAdmin.Domain.Dto.Sys.LoginLog;
|
||||
|
||||
/// <summary>
|
||||
/// 请求:查询登录日志
|
||||
/// </summary>
|
||||
public sealed record QueryLoginLogReq : Sys_LoginLog
|
||||
{
|
||||
/// <inheritdoc cref="EntityBase{T}.Id" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override long Id { get; init; }
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
using NetAdmin.Domain.Dto.Sys.User;
|
||||
|
||||
namespace NetAdmin.Domain.Dto.Sys.LoginLog;
|
||||
|
||||
/// <summary>
|
||||
/// 响应:查询登录日志
|
||||
/// </summary>
|
||||
public record QueryLoginLogRsp : Sys_LoginLog
|
||||
{
|
||||
/// <summary>
|
||||
/// 创建者客户端IP
|
||||
/// </summary>
|
||||
[JsonInclude]
|
||||
public new virtual string CreatedClientIp => base.CreatedClientIp?.ToIpV4();
|
||||
|
||||
/// <summary>
|
||||
/// 操作系统
|
||||
/// </summary>
|
||||
[JsonInclude]
|
||||
public virtual string Os => UserAgentParser.Create(CreatedUserAgent)?.Platform;
|
||||
|
||||
/// <inheritdoc cref="IFieldCreatedTime.CreatedTime" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override DateTime CreatedTime { get; init; }
|
||||
|
||||
/// <inheritdoc cref="IFieldCreatedClientUserAgent.CreatedUserAgent" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string CreatedUserAgent { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_LoginLog.Duration" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override int Duration { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_LoginLog.ErrorCode" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override ErrorCodes ErrorCode { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_LoginLog.HttpStatusCode" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override int HttpStatusCode { get; init; }
|
||||
|
||||
/// <inheritdoc cref="EntityBase{T}.Id" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override long Id { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_LoginLog.LoginUserName" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string LoginUserName { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_LoginLog.Owner" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public new virtual QueryUserRsp Owner { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_LoginLog.RequestBody" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string RequestBody { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_LoginLog.RequestHeaders" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string RequestHeaders { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_LoginLog.RequestUrl" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string RequestUrl { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_LoginLog.ResponseBody" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string ResponseBody { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_LoginLog.ResponseHeaders" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string ResponseHeaders { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_LoginLog.ServerIp" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override int? ServerIp { get; init; }
|
||||
}
|
@ -31,36 +31,43 @@ public sealed record MetaInfo : DataAbstraction
|
||||
/// <summary>
|
||||
/// 背景颜色
|
||||
/// </summary>
|
||||
[JsonInclude]
|
||||
public string Color { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否整页路由
|
||||
/// </summary>
|
||||
[JsonInclude]
|
||||
public bool FullPage { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否隐藏
|
||||
/// </summary>
|
||||
[JsonInclude]
|
||||
public bool Hidden { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否隐藏面包屑
|
||||
/// </summary>
|
||||
[JsonInclude]
|
||||
public bool HiddenBreadCrumb { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 图标
|
||||
/// </summary>
|
||||
[JsonInclude]
|
||||
public string Icon { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 标签
|
||||
/// </summary>
|
||||
[JsonInclude]
|
||||
public string Tag { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 标题
|
||||
/// </summary>
|
||||
[JsonInclude]
|
||||
public string Title { get; init; }
|
||||
|
||||
/// <summary>
|
||||
@ -68,5 +75,6 @@ public sealed record MetaInfo : DataAbstraction
|
||||
/// </summary>
|
||||
[EnumDataType(typeof(MenuTypes), ErrorMessageResourceType = typeof(Ln)
|
||||
, ErrorMessageResourceName = nameof(Ln.菜单类型不正确))]
|
||||
[JsonInclude]
|
||||
public MenuTypes Type { get; init; }
|
||||
}
|
@ -1,6 +1,12 @@
|
||||
using NetAdmin.Domain.Dto.Sys.RequestLogDetail;
|
||||
|
||||
namespace NetAdmin.Domain.Dto.Sys.RequestLog;
|
||||
|
||||
/// <summary>
|
||||
/// 请求:创建请求日志
|
||||
/// </summary>
|
||||
public sealed record CreateRequestLogReq : Sys_RequestLog;
|
||||
public sealed record CreateRequestLogReq : Sys_RequestLog
|
||||
{
|
||||
/// <inheritdoc cref="Sys_RequestLog.Detail" />
|
||||
public new CreateRequestLogDetailReq Detail { get; init; }
|
||||
}
|
@ -1,4 +1,7 @@
|
||||
using NetAdmin.Domain.Dto.Sys.Api;
|
||||
using NetAdmin.Domain.Dto.Sys.RequestLogDetail;
|
||||
using NetAdmin.Domain.Dto.Sys.User;
|
||||
using HttpMethods = NetAdmin.Domain.Enums.HttpMethods;
|
||||
|
||||
namespace NetAdmin.Domain.Dto.Sys.RequestLog;
|
||||
|
||||
@ -7,73 +10,73 @@ namespace NetAdmin.Domain.Dto.Sys.RequestLog;
|
||||
/// </summary>
|
||||
public record ExportRequestLogRsp : QueryRequestLogRsp
|
||||
{
|
||||
/// <summary>
|
||||
/// 接口路径
|
||||
/// </summary>
|
||||
[CsvIndex(2)]
|
||||
[JsonInclude]
|
||||
[CsvName(nameof(Ln.接口路径))]
|
||||
public string ApiId => Api.Id;
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(6)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.客户端IP))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.客户端IP))]
|
||||
public override string CreatedClientIp => base.CreatedClientIp;
|
||||
|
||||
/// <inheritdoc />
|
||||
[Ignore]
|
||||
public override string LoginName => base.LoginName;
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(7)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.操作系统))]
|
||||
public override string Os => base.Os;
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(2)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.接口路径))]
|
||||
public override string ApiId { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(8)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.用户代理))]
|
||||
public override string CreatedUserAgent { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(4)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.执行耗时))]
|
||||
public override long Duration { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(1)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.响应状态码))]
|
||||
public override int HttpStatusCode { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(0)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.唯一编码))]
|
||||
public override long Id { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(3)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.请求方式))]
|
||||
public override string Method { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[Ignore]
|
||||
public override QueryUserRsp User { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户名
|
||||
/// </summary>
|
||||
[CsvIndex(5)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.用户名))]
|
||||
public string UserName { get; init; }
|
||||
[JsonInclude]
|
||||
[CsvName(nameof(Ln.用户名))]
|
||||
public string UserName => Owner?.UserName;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Register(TypeAdapterConfig config)
|
||||
{
|
||||
_ = config.ForType<Sys_RequestLog, ExportRequestLogRsp>().Map(d => d.UserName, s => s.User.UserName);
|
||||
}
|
||||
[CsvIgnore]
|
||||
public override QueryApiRsp Api { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIgnore(false)]
|
||||
[CsvIndex(8)]
|
||||
[CsvName(nameof(Ln.创建时间))]
|
||||
public override DateTime CreatedTime { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIgnore]
|
||||
public override QueryRequestLogDetailRsp Detail { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(4)]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.执行耗时))]
|
||||
public override int Duration { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(3)]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.请求方式))]
|
||||
public override HttpMethods HttpMethod { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(1)]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.响应状态码))]
|
||||
public override int HttpStatusCode { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(0)]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.唯一编码))]
|
||||
public override long Id { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIgnore]
|
||||
public override QueryUserRsp Owner { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(7)]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.跟踪标识))]
|
||||
public override Guid TraceId { get; init; }
|
||||
}
|
@ -3,4 +3,9 @@ namespace NetAdmin.Domain.Dto.Sys.RequestLog;
|
||||
/// <summary>
|
||||
/// 请求:查询请求日志
|
||||
/// </summary>
|
||||
public sealed record QueryRequestLogReq : Sys_RequestLog;
|
||||
public sealed record QueryRequestLogReq : Sys_RequestLog
|
||||
{
|
||||
/// <inheritdoc cref="IFieldCreatedTime.CreatedTime" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override DateTime CreatedTime { get; init; }
|
||||
}
|
@ -1,106 +1,58 @@
|
||||
using NetAdmin.Domain.Dto.Sys.Api;
|
||||
using NetAdmin.Domain.Dto.Sys.RequestLogDetail;
|
||||
using NetAdmin.Domain.Dto.Sys.User;
|
||||
using HttpMethods = NetAdmin.Domain.Enums.HttpMethods;
|
||||
|
||||
namespace NetAdmin.Domain.Dto.Sys.RequestLog;
|
||||
|
||||
/// <summary>
|
||||
/// 响应:查询请求日志
|
||||
/// </summary>
|
||||
public record QueryRequestLogRsp : Sys_RequestLog, IRegister
|
||||
public record QueryRequestLogRsp : Sys_RequestLog
|
||||
{
|
||||
/// <summary>
|
||||
/// 创建者客户端IP
|
||||
/// </summary>
|
||||
[JsonInclude]
|
||||
public new virtual string CreatedClientIp => base.CreatedClientIp?.ToIpV4();
|
||||
|
||||
/// <summary>
|
||||
/// 登录名
|
||||
/// </summary>
|
||||
public virtual string LoginName => RequestBody?.ToObject<LoginByPwdReq>()?.Account;
|
||||
|
||||
/// <summary>
|
||||
/// 操作系统
|
||||
/// </summary>
|
||||
public virtual string Os => UserAgentParser.Create(CreatedUserAgent)?.Platform;
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLog.ApiId" />
|
||||
/// <inheritdoc cref="Sys_RequestLog.Api" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string ApiId { get; init; }
|
||||
public new virtual QueryApiRsp Api { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 接口描述
|
||||
/// </summary>
|
||||
public string ApiSummary { get; init; }
|
||||
/// <inheritdoc cref="Sys_RequestLog.ApiPathCrc32" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override int ApiPathCrc32 { get; init; }
|
||||
|
||||
/// <inheritdoc cref="IFieldCreatedTime.CreatedTime" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override DateTime CreatedTime { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLog.CreatedUserAgent" />
|
||||
/// <inheritdoc cref="Sys_RequestLog.Detail" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string CreatedUserAgent { get; init; }
|
||||
public new virtual QueryRequestLogDetailRsp Detail { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLog.Duration" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override long Duration { get; init; }
|
||||
public override int Duration { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLog.ErrorCode" />
|
||||
/// <inheritdoc cref="Sys_RequestLog.HttpMethod" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override ErrorCodes ErrorCode { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLog.Exception" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string Exception { get; init; }
|
||||
public override HttpMethods HttpMethod { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLog.HttpStatusCode" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override int HttpStatusCode { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLog.Method" />
|
||||
/// <inheritdoc cref="Sys_RequestLog.Owner" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string Method { get; init; }
|
||||
public new virtual QueryUserRsp Owner { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLog.RequestBody" />
|
||||
/// <inheritdoc cref="IFieldOwner.OwnerId" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string RequestBody { get; init; }
|
||||
public override long? OwnerId { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLog.RequestContentType" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string RequestContentType { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLog.RequestHeaders" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string RequestHeaders { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLog.RequestUrl" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string RequestUrl { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLog.ResponseBody" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string ResponseBody { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLog.ResponseContentType" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string ResponseContentType { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLog.ResponseHeaders" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string ResponseHeaders { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLog.ServerIp" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override int? ServerIp { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLog.User" />
|
||||
public new virtual QueryUserRsp User { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLog.UserId" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override long? UserId { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual void Register(TypeAdapterConfig config)
|
||||
{
|
||||
_ = config.ForType<Sys_RequestLog, QueryRequestLogRsp>().Map(d => d.ApiSummary, s => s.Api.Summary);
|
||||
}
|
||||
/// <inheritdoc cref="Sys_RequestLog.TraceId" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override Guid TraceId { get; init; }
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace NetAdmin.Domain.Dto.Sys.RequestLogDetail;
|
||||
|
||||
/// <summary>
|
||||
/// 请求:创建请求日志明细
|
||||
/// </summary>
|
||||
public record CreateRequestLogDetailReq : Sys_RequestLogDetail;
|
@ -0,0 +1,11 @@
|
||||
namespace NetAdmin.Domain.Dto.Sys.RequestLogDetail;
|
||||
|
||||
/// <summary>
|
||||
/// 请求:查询请求日志明细
|
||||
/// </summary>
|
||||
public sealed record QueryRequestLogDetailReq : Sys_RequestLogDetail
|
||||
{
|
||||
/// <inheritdoc cref="EntityBase{T}.Id" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override long Id { get; init; }
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
using NetAdmin.Domain.Dto.Sys.User;
|
||||
|
||||
namespace NetAdmin.Domain.Dto.Sys.RequestLogDetail;
|
||||
|
||||
/// <summary>
|
||||
/// 响应:查询请求日志明细
|
||||
/// </summary>
|
||||
public sealed record QueryRequestLogDetailRsp : Sys_RequestLogDetail
|
||||
{
|
||||
/// <summary>
|
||||
/// 登录名
|
||||
/// </summary>
|
||||
[JsonInclude]
|
||||
public string LoginName => RequestBody?.ToObject<LoginByPwdReq>()?.Account;
|
||||
|
||||
/// <summary>
|
||||
/// 操作系统
|
||||
/// </summary>
|
||||
[JsonInclude]
|
||||
public string Os => UserAgentParser.Create(CreatedUserAgent)?.Platform;
|
||||
|
||||
/// <inheritdoc cref="IFieldCreatedClientUserAgent.CreatedUserAgent" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string CreatedUserAgent { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLogDetail.ErrorCode" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override ErrorCodes ErrorCode { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLogDetail.Exception" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string Exception { get; init; }
|
||||
|
||||
/// <inheritdoc cref="EntityBase{T}.Id" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override long Id { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLogDetail.RequestBody" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string RequestBody { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLogDetail.RequestContentType" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string RequestContentType { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLogDetail.RequestHeaders" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string RequestHeaders { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLogDetail.RequestUrl" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string RequestUrl { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLogDetail.ResponseBody" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string ResponseBody { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLogDetail.ResponseContentType" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string ResponseContentType { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLogDetail.ResponseHeaders" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string ResponseHeaders { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLogDetail.ServerIp" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override int? ServerIp { get; init; }
|
||||
}
|
@ -9,49 +9,49 @@ public sealed record ExportRoleRsp : QueryRoleRsp
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(7)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.创建时间))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.创建时间))]
|
||||
public override DateTime CreatedTime { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(4)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.数据范围))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.数据范围))]
|
||||
public override DataScopes DataScope { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(5)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.显示仪表板))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.显示仪表板))]
|
||||
public override bool DisplayDashboard { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(6)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.是否启用))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.是否启用))]
|
||||
public override bool Enabled { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(0)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.唯一编码))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.唯一编码))]
|
||||
public override long Id { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(3)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.无限权限))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.无限权限))]
|
||||
public override bool IgnorePermissionControl { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(1)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.角色名称))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.角色名称))]
|
||||
public override string Name { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(2)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.排序))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.排序))]
|
||||
public override long Sort { get; init; }
|
||||
}
|
@ -12,49 +12,49 @@ public record ExportSiteMsgRsp : QuerySiteMsgRsp
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(5)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.创建时间))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.创建时间))]
|
||||
public override DateTime CreatedTime { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(1)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.用户名))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.用户名))]
|
||||
public override string CreatedUserName { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
public override IEnumerable<QueryDeptRsp> Depts { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(0)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.唯一编码))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.唯一编码))]
|
||||
public override long Id { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(2)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.消息类型))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.消息类型))]
|
||||
public override SiteMsgTypes MsgType { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
public override IEnumerable<QueryRoleRsp> Roles { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(4)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.消息摘要))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.消息摘要))]
|
||||
public override string Summary { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(3)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.消息主题))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.消息主题))]
|
||||
public override string Title { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
public override IEnumerable<QueryUserRsp> Users { get; init; }
|
||||
}
|
@ -10,60 +10,60 @@ public record ExportUserRsp : QueryUserRsp
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(7)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.创建时间))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.创建时间))]
|
||||
public override DateTime CreatedTime { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
public override QueryDeptRsp Dept { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属部门
|
||||
/// </summary>
|
||||
[CsvIndex(5)]
|
||||
[Name(nameof(Ln.所属部门))]
|
||||
[CsvName(nameof(Ln.所属部门))]
|
||||
public string DeptName { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(3)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.邮箱号))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.邮箱号))]
|
||||
public override string Email { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(6)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.是否启用))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.是否启用))]
|
||||
public override bool Enabled { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(0)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.唯一编码))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.唯一编码))]
|
||||
public override long Id { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(2)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.手机号))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.手机号))]
|
||||
public override string Mobile { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属角色
|
||||
/// </summary>
|
||||
[CsvIndex(4)]
|
||||
[Name(nameof(Ln.所属角色))]
|
||||
[CsvName(nameof(Ln.所属角色))]
|
||||
public string RoleNames { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[Ignore]
|
||||
[CsvIgnore]
|
||||
public override IEnumerable<QueryRoleRsp> Roles { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(1)]
|
||||
[Ignore(false)]
|
||||
[Name(nameof(Ln.用户名))]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.用户名))]
|
||||
public override string UserName { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
|
@ -11,20 +11,19 @@ public sealed record SqlCommandAfterEvent : SqlCommandBeforeEvent
|
||||
public SqlCommandAfterEvent(CommandAfterEventArgs e) //
|
||||
: base(e)
|
||||
{
|
||||
ElapsedMicroseconds = (long)((double)e.ElapsedTicks / Stopwatch.Frequency * 1_000_000);
|
||||
ElapsedMilliseconds = (long)((double)e.ElapsedTicks / Stopwatch.Frequency * 1_000);
|
||||
EventId = nameof(SqlCommandAfterEvent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 耗时(单位:微秒)
|
||||
/// 耗时(单位:毫秒)
|
||||
/// </summary>
|
||||
/// de
|
||||
private long ElapsedMicroseconds { get; }
|
||||
private long ElapsedMilliseconds { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format(CultureInfo.InvariantCulture, "SQL-{0}: {2} ms {1}", Id
|
||||
, Sql?.Sub(0, Numbers.MAX_LIMIT_PRINT_LEN_SQL), ElapsedMicroseconds / 1000);
|
||||
return string.Format(CultureInfo.InvariantCulture, "SQL-{0}: {2} ms {1}", Id, Sql, ElapsedMilliseconds);
|
||||
}
|
||||
}
|
@ -10,6 +10,10 @@
|
||||
<ProjectReference Include="../NetAdmin.Infrastructure/NetAdmin.Infrastructure.csproj"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CronExpressionDescriptor" Version="2.36.0"/>
|
||||
<PackageReference Include="Cronos" Version="0.8.4"/>
|
||||
<PackageReference Include="CsvHelper.NS" Version="33.0.2-ns2"/>
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="9.0.0-preview.6.24328.4"/>
|
||||
<PackageReference Include="Yitter.IdGenerator" Version="1.0.14"/>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -35,20 +35,15 @@ public abstract class WorkBase<TLogger>
|
||||
/// </summary>
|
||||
protected UnitOfWorkManager UowManager { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取锁
|
||||
/// </summary>
|
||||
protected Task<IRedLock> GetLockerAsync(string lockId)
|
||||
{
|
||||
return _redLocker.RedLockFactory.CreateLockAsync(lockId, TimeSpan.FromSeconds(Numbers.SECS_RED_LOCK_EXPIRY)
|
||||
, TimeSpan.FromSeconds(Numbers.SECS_RED_LOCK_WAIT)
|
||||
, TimeSpan.FromSeconds(Numbers.SECS_RED_LOCK_RETRY));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通用工作流
|
||||
/// </summary>
|
||||
protected abstract ValueTask WorkflowAsync(CancellationToken cancelToken);
|
||||
protected abstract ValueTask WorkflowAsync( //
|
||||
|
||||
// ReSharper disable once UnusedParameter.Global
|
||||
#pragma warning disable SA1114
|
||||
CancellationToken cancelToken);
|
||||
#pragma warning restore SA1114
|
||||
|
||||
/// <summary>
|
||||
/// 通用工作流
|
||||
@ -69,4 +64,14 @@ public abstract class WorkBase<TLogger>
|
||||
|
||||
await WorkflowAsync(cancelToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取锁
|
||||
/// </summary>
|
||||
private Task<IRedLock> GetLockerAsync(string lockId)
|
||||
{
|
||||
return _redLocker.RedLockFactory.CreateLockAsync(lockId, TimeSpan.FromSeconds(Numbers.SECS_RED_LOCK_EXPIRY)
|
||||
, TimeSpan.FromSeconds(Numbers.SECS_RED_LOCK_WAIT)
|
||||
, TimeSpan.FromSeconds(Numbers.SECS_RED_LOCK_RETRY_INTERVAL));
|
||||
}
|
||||
}
|
@ -68,7 +68,7 @@ public static class IMvcBuilderExtensions
|
||||
/// <summary>
|
||||
/// 设置Json选项
|
||||
/// </summary>
|
||||
public static void SetJsonOptions(bool enumToString, JsonOptions options)
|
||||
private static void SetJsonOptions(bool enumToString, JsonOptions options)
|
||||
{
|
||||
////////////////////////////// json -> object
|
||||
|
||||
|
@ -58,7 +58,7 @@ public sealed class RequestAuditMiddleware(
|
||||
.FirstOrDefault()
|
||||
?.Enum<ErrorCodes>() ?? 0;
|
||||
|
||||
_ = await requestLogger.LogAsync(context, (long)sw.Elapsed.TotalMicroseconds, responseBody, errorCode
|
||||
_ = await requestLogger.LogAsync(context, (long)sw.Elapsed.TotalMilliseconds, responseBody, errorCode
|
||||
, exception)
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="IGeekFan.AspNetCore.Knife4jUI.NS" Condition="'$(Configuration)' == 'Debug'" Version="0.0.15-ns2"/>
|
||||
<PackageReference Include="Spectre.Console.Cli.NS" Version="0.45.1-preview.0.161"/>
|
||||
<PackageReference Include="Spectre.Console.Cli.NS" Version="0.45.1-preview.0.179"/>
|
||||
<PackageReference Include="prometheus-net.AspNetCore" Condition="'$(Configuration)' != 'Debug'" Version="8.2.1"/>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -26,7 +26,7 @@ public abstract class Startup : AppStartup
|
||||
/// <summary>
|
||||
/// 打印Banner
|
||||
/// </summary>
|
||||
protected static void ShowBanner()
|
||||
private static void ShowBanner()
|
||||
{
|
||||
AnsiConsole.WriteLine();
|
||||
var gridInfo = new Grid().AddColumn(new GridColumn().NoWrap().Width(50).PadRight(10))
|
||||
|
@ -1,6 +1,9 @@
|
||||
using NetAdmin.Domain.Contexts;
|
||||
using NetAdmin.Domain.Dto.Sys.RequestLog;
|
||||
using NetAdmin.Domain.Dto.Sys.RequestLogDetail;
|
||||
using NetAdmin.Domain.Events.Sys;
|
||||
using Yitter.IdGenerator;
|
||||
using HttpMethods = NetAdmin.Domain.Enums.HttpMethods;
|
||||
|
||||
namespace NetAdmin.Host.Utils;
|
||||
|
||||
@ -19,36 +22,39 @@ public sealed class RequestLogger(ILogger<RequestLogger> logger, IEventPublisher
|
||||
{
|
||||
// 从请求头中读取用户信息
|
||||
var associatedUser = GetAssociatedUser(context);
|
||||
|
||||
var auditData = new CreateRequestLogReq {
|
||||
Duration = duration
|
||||
, Method = context.Request.Method
|
||||
, RequestContentType = context.Request.ContentType
|
||||
, RequestBody = Array.Exists( //
|
||||
_textContentTypes
|
||||
, x => context.Request.ContentType?.Contains(
|
||||
x, StringComparison.OrdinalIgnoreCase) ?? false)
|
||||
? (await context.ReadBodyContentAsync().ConfigureAwait(false))
|
||||
?.Sub(0, Numbers.MAX_LIMIT_PRINT_LEN_CONTENT)
|
||||
: string.Empty
|
||||
, RequestUrl = context.Request.GetRequestUrlAddress()
|
||||
, ResponseBody
|
||||
= responseBody?.Sub(0, Numbers.MAX_LIMIT_PRINT_LEN_CONTENT)
|
||||
, ServerIp = context.GetLocalIpAddressToIPv4()?.IpV4ToInt32()
|
||||
, ApiId = context.Request.Path.Value?.TrimStart('/')
|
||||
, RequestHeaders = context.Request.Headers.Json()
|
||||
, ResponseContentType = context.Response.ContentType
|
||||
, ResponseHeaders = context.Response.Headers.Json()
|
||||
, HttpStatusCode = context.Response.StatusCode
|
||||
, ErrorCode = errorCode
|
||||
, Exception = exception?.Error.ToString()
|
||||
, UserId = associatedUser?.UserId
|
||||
, CreatedUserAgent = context.Request.Headers.UserAgent.ToString()
|
||||
, CreatedClientIp = context.GetRealIpAddress()
|
||||
?.MapToIPv4()
|
||||
.ToString()
|
||||
.IpV4ToInt32()
|
||||
};
|
||||
var id = YitIdHelper.NextId();
|
||||
var requestBody = Array.Exists( //
|
||||
_textContentTypes
|
||||
, x => context.Request.ContentType?.Contains(x, StringComparison.OrdinalIgnoreCase) ?? false)
|
||||
? await context.ReadBodyContentAsync().ConfigureAwait(false)
|
||||
: string.Empty;
|
||||
var auditData = new CreateRequestLogReq //
|
||||
{
|
||||
Detail = new CreateRequestLogDetailReq //
|
||||
{
|
||||
Id = id
|
||||
, CreatedUserAgent = context.Request.Headers.UserAgent.ToString()
|
||||
, ErrorCode = errorCode
|
||||
, Exception = exception?.Error.ToString()
|
||||
, RequestBody = requestBody
|
||||
, RequestContentType = context.Request.ContentType
|
||||
, RequestHeaders = context.Request.Headers.Json()
|
||||
, RequestUrl = context.Request.GetRequestUrlAddress()
|
||||
, ResponseBody = responseBody
|
||||
, ResponseContentType = context.Response.ContentType
|
||||
, ResponseHeaders = context.Response.Headers.Json()
|
||||
, ServerIp = context.GetLocalIpAddressToIPv4()?.IpV4ToInt32()
|
||||
}
|
||||
, Duration = (int)duration
|
||||
, HttpMethod = Enum.Parse<HttpMethods>(context.Request.Method, true)
|
||||
, ApiPathCrc32 = context.Request.Path.Value!.TrimStart('/').Crc32()
|
||||
, HttpStatusCode = context.Response.StatusCode
|
||||
, CreatedClientIp = context.GetRealIpAddress()?.MapToIPv4().ToString().IpV4ToInt32()
|
||||
, OwnerId = associatedUser?.UserId
|
||||
, OwnerDeptId = associatedUser?.DeptId
|
||||
, Id = id
|
||||
, TraceId = context.GetTraceId()
|
||||
};
|
||||
|
||||
// 打印日志
|
||||
logger.Info(auditData);
|
||||
@ -59,7 +65,7 @@ public sealed class RequestLogger(ILogger<RequestLogger> logger, IEventPublisher
|
||||
return auditData;
|
||||
}
|
||||
|
||||
private (long UserId, string UserName)? GetAssociatedUser(HttpContext context)
|
||||
private (long UserId, long DeptId, string UserName)? GetAssociatedUser(HttpContext context)
|
||||
{
|
||||
var token = context.Request.Headers.Authorization.FirstOrDefault();
|
||||
if (token == null) {
|
||||
@ -68,15 +74,12 @@ public sealed class RequestLogger(ILogger<RequestLogger> logger, IEventPublisher
|
||||
|
||||
ContextUserToken userToken = null;
|
||||
try {
|
||||
var jsonWebToken
|
||||
= JWTEncryption.ReadJwtToken(token.TrimStart($"{Chars.FLG_HTTP_HEADER_VALUE_AUTH_SCHEMA} "));
|
||||
var claim = jsonWebToken?.Claims.FirstOrDefault(y => y.Type == nameof(ContextUserToken));
|
||||
userToken = claim?.Value.ToObject<ContextUserToken>();
|
||||
userToken = ContextUserToken.Create(token);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
logger.Warn($"{Ln.读取用户令牌出错}: {ex}");
|
||||
logger.Warn($"{Ln.读取用户令牌出错} {ex}");
|
||||
}
|
||||
|
||||
return userToken == null ? null : (userToken.Id, userToken.UserName);
|
||||
return userToken == null ? null : (userToken.Id, userToken.DeptId, userToken.UserName);
|
||||
}
|
||||
}
|
@ -104,10 +104,10 @@ public sealed class SqlAuditor : ISingleton
|
||||
case nameof(IFieldCreatedUser.CreatedUserName):
|
||||
SetCreatedUserName(e, userInfo);
|
||||
break;
|
||||
case nameof(IFieldCreatedClient.CreatedClientIp):
|
||||
case nameof(IFieldCreatedClientIp.CreatedClientIp):
|
||||
SetCreatedClientIp(e);
|
||||
break;
|
||||
case nameof(IFieldCreatedClient.CreatedUserAgent):
|
||||
case nameof(IFieldCreatedClientUserAgent.CreatedUserAgent):
|
||||
SetCreatedUserAgent(e);
|
||||
break;
|
||||
default:
|
||||
|
@ -29,6 +29,7 @@ public static class Chars
|
||||
public const string FLG_DB_FIELD_TYPE_NVARCHAR_MAX = "nvarchar(max)";
|
||||
public const string FLG_DB_FIELD_TYPE_SMALL_INT = "smallint";
|
||||
public const string FLG_DB_FIELD_TYPE_TEXT = "text";
|
||||
public const string FLG_DB_FIELD_TYPE_TINY_INT = "tinyint";
|
||||
public const string FLG_DB_FIELD_TYPE_VARCHAR = "varchar";
|
||||
public const string FLG_DB_FIELD_TYPE_VARCHAR_1022 = "varchar(1022)";
|
||||
public const string FLG_DB_FIELD_TYPE_VARCHAR_127 = "varchar(127)";
|
||||
@ -54,6 +55,7 @@ public static class Chars
|
||||
public const string FLG_HTTP_HEADER_KEY_USER_AGENT = "User-Agent";
|
||||
public const string FLG_HTTP_HEADER_KEY_X_ACCESS_TOKEN = "X-ACCESS-TOKEN";
|
||||
public const string FLG_HTTP_HEADER_KEY_X_ACCESS_TOKEN_HEADER_KEY = "X-Authorization";
|
||||
public const string FLG_HTTP_HEADER_KEY_X_CACHE_CONTROL = "X-Cache-Control";
|
||||
public const string FLG_HTTP_HEADER_KEY_X_FORWARDED_FOR = "X-Forwarded-For";
|
||||
public const string FLG_HTTP_HEADER_KEY_X_REAL_IP = "X-Real-IP";
|
||||
public const string FLG_HTTP_HEADER_VALUE_APPLICATION_JSON = "application/json";
|
||||
@ -61,6 +63,7 @@ public static class Chars
|
||||
public const string FLG_HTTP_HEADER_VALUE_APPLICATION_URLENCODED = "application/x-www-form-urlencoded";
|
||||
public const string FLG_HTTP_HEADER_VALUE_ATTACHMENT = "attachment";
|
||||
public const string FLG_HTTP_HEADER_VALUE_AUTH_SCHEMA = "Bearer";
|
||||
public const string FLG_HTTP_HEADER_VALUE_NO_CACHE = "no-cache";
|
||||
public const string FLG_HTTP_METHOD_CONNECT = "CONNECT";
|
||||
public const string FLG_HTTP_METHOD_DELETE = "DELETE";
|
||||
public const string FLG_HTTP_METHOD_GET = "GET";
|
||||
|
@ -24,10 +24,12 @@ public static class Numbers
|
||||
public const int MAX_LIMIT_QUERY_PAGE_NO = 10000; // 最大限制:分页查询页码
|
||||
public const int MAX_LIMIT_QUERY_PAGE_SIZE = 100; // 最大限制:分页查询页容量
|
||||
|
||||
public const int SECS_CACHE_CHART = 300; // 秒:缓存时间-仪表
|
||||
public const int SECS_CACHE_DEFAULT = 60; // 秒:缓存时间-默认
|
||||
public const int SECS_RED_LOCK_EXPIRY = 30; // 秒:RedLock-锁过期时间,假如持有锁的进程挂掉,最多在此时间内锁将被释放(如持有锁的进程正常,此值不会生效)
|
||||
public const int SECS_RED_LOCK_RETRY = 1; // 秒:RedLock-锁等待时间内,多久尝试获取一次
|
||||
public const int SECS_RED_LOCK_WAIT = 10; // 秒:RedLock-锁等待时间,相同的 resource 如果当前的锁被其他线程占用,最多等待时间
|
||||
public const int SECS_TIMEOUT_JOB = 600; // 秒:超时时间-作业
|
||||
public const int SECS_CACHE_CHART = 300; // 秒:缓存时间-仪表
|
||||
public const int SECS_CACHE_DEFAULT = 60; // 秒:缓存时间-默认
|
||||
public const int SECS_CACHE_DIC_CATALOG_CODE = 300; // 秒:缓存时间-字典配置-目录代码
|
||||
public const int SECS_RED_LOCK_EXPIRY = 30; // 秒:RedLock-锁过期时间,假如持有锁的进程挂掉,最多在此时间内锁将被释放(如持有锁的进程正常,此值不会生效)
|
||||
public const int SECS_RED_LOCK_RETRY_INTERVAL = 1; // 秒:RedLock-锁等待时间内,多久尝试获取一次
|
||||
public const int SECS_RED_LOCK_WAIT = 10; // 秒:RedLock-锁等待时间,相同的 resource 如果当前的锁被其他线程占用,最多等待时间
|
||||
public const int SECS_TIMEOUT_HTTP_CLIENT = 15; // 秒:超时时间-默认HTTP客户端
|
||||
public const int SECS_TIMEOUT_JOB = 600; // 秒:超时时间-作业
|
||||
}
|
@ -19,5 +19,5 @@ public abstract class NetAdminException(string message, Exception innerException
|
||||
/// <summary>
|
||||
/// 错误码
|
||||
/// </summary>
|
||||
public ErrorCodes Code { get; init; }
|
||||
public ErrorCodes Code { get; }
|
||||
}
|
@ -22,4 +22,12 @@ public static class HttpContextExtensions
|
||||
? ip2
|
||||
: me.Connection.RemoteIpAddress;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取跟踪标识
|
||||
/// </summary>
|
||||
public static Guid GetTraceId(this HttpContext me)
|
||||
{
|
||||
return me.TraceIdentifier.Md5(Encoding.UTF8).Guid();
|
||||
}
|
||||
}
|
@ -5,22 +5,21 @@ namespace NetAdmin.Infrastructure.Extensions;
|
||||
/// </summary>
|
||||
public static class HttpRequestMessageExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 将Http请求的Uri、Header、Body打包成Json字符串
|
||||
/// </summary>
|
||||
public static async Task<string> BuildJsonAsync(this HttpRequestMessage me)
|
||||
{
|
||||
var body = me?.Content == null ? null : await me.Content!.ReadAsStringAsync().ConfigureAwait(false);
|
||||
return new { Uri = me?.RequestUri, Header = me?.ToString(), Body = body }.ToJson();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 记录日志
|
||||
/// </summary>
|
||||
public static async Task<HttpRequestMessage> LogAsync<T>(this HttpRequestMessage me, ILogger<T> logger)
|
||||
{
|
||||
logger.Info(
|
||||
$"HTTP Request: {(await me.BuildJsonAsync().ConfigureAwait(false))?.Sub(0, Numbers.MAX_LIMIT_PRINT_LEN_CONTENT)}");
|
||||
logger.Info($"HTTP Request {await me.BuildJsonAsync().ConfigureAwait(false)}");
|
||||
return me;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将Http请求的Uri、Header、Body打包成Json字符串
|
||||
/// </summary>
|
||||
private static async Task<string> BuildJsonAsync(this HttpRequestMessage me)
|
||||
{
|
||||
var body = me?.Content == null ? null : await me.Content!.ReadAsStringAsync().ConfigureAwait(false);
|
||||
return new { Uri = me?.RequestUri, Header = me?.ToString(), Body = body }.ToJson();
|
||||
}
|
||||
}
|
@ -11,9 +11,7 @@ public static class HttpResponseMessageExtensions
|
||||
public static async Task LogAsync<T>(this HttpResponseMessage me, ILogger<T> logger
|
||||
, Func<string, string> bodyPreHandle = null)
|
||||
{
|
||||
logger.Info(
|
||||
(await me.BuildJsonAsync(bodyPreHandle).ConfigureAwait(false))?.Sub(
|
||||
0, Numbers.MAX_LIMIT_PRINT_LEN_CONTENT));
|
||||
logger.Info($"HTTP Response {await me.BuildJsonAsync(bodyPreHandle).ConfigureAwait(false)}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -22,8 +20,7 @@ public static class HttpResponseMessageExtensions
|
||||
public static async Task LogExceptionAsync<T>(this HttpResponseMessage me, string errors, ILogger<T> logger
|
||||
, Func<string, string> bodyHandle = null)
|
||||
{
|
||||
logger.Warn(
|
||||
$"{errors}: {(await me.BuildJsonAsync(bodyHandle).ConfigureAwait(false))?.Sub(0, Numbers.MAX_LIMIT_PRINT_LEN_CONTENT)}");
|
||||
logger.Warn($"{errors}: {await me.BuildJsonAsync(bodyHandle).ConfigureAwait(false)}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1,3 +1,6 @@
|
||||
using Microsoft.CodeAnalysis.CSharp.Scripting;
|
||||
using Microsoft.CodeAnalysis.Scripting;
|
||||
|
||||
namespace NetAdmin.Infrastructure.Extensions;
|
||||
|
||||
/// <summary>
|
||||
@ -5,8 +8,34 @@ namespace NetAdmin.Infrastructure.Extensions;
|
||||
/// </summary>
|
||||
public static class StringExtensions
|
||||
{
|
||||
private static readonly Regex _regex = new("Options$");
|
||||
private static readonly Regex _regex2 = new("Async$");
|
||||
private static readonly Regex _regexIpV4 = new(Chars.RGXL_IP_V4);
|
||||
|
||||
/// <summary>
|
||||
/// 计算Crc32
|
||||
/// </summary>
|
||||
public static int Crc32(this string me)
|
||||
{
|
||||
return BitConverter.ToInt32(System.IO.Hashing.Crc32.Hash(Encoding.UTF8.GetBytes(me)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行C#代码
|
||||
/// </summary>
|
||||
public static Task<T> ExecuteCSharpCodeAsync<T>(this string me, Assembly[] assemblies
|
||||
, params string[] importNamespaces)
|
||||
{
|
||||
// 使用 Roslyn 编译并执行代码
|
||||
return CSharpScript.EvaluateAsync<T>(
|
||||
me, ScriptOptions.Default.WithReferences(assemblies).WithImports(importNamespaces));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否IPV4地址
|
||||
/// </summary>
|
||||
public static bool IsIpV4(this string me)
|
||||
{
|
||||
return _regexIpV4.IsMatch(me);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// object -> json
|
||||
@ -24,29 +53,37 @@ public static class StringExtensions
|
||||
return me.Object(toType, GlobalStatic.JsonSerializerOptions);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 去掉前部字符串
|
||||
/// </summary>
|
||||
public static string TrimPrefix(this string me, string clearStr)
|
||||
{
|
||||
return Regex.Replace(me, $"^{clearStr}", string.Empty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 去掉尾部字符串“Async”
|
||||
/// </summary>
|
||||
#pragma warning disable RCS1047, ASA002, VSTHRD200
|
||||
public static string TrimEndAsync(this string me)
|
||||
public static string TrimPrefixAsync(this string me)
|
||||
#pragma warning restore VSTHRD200, ASA002, RCS1047
|
||||
{
|
||||
return _regex2.Replace(me, string.Empty);
|
||||
return TrimPrefix(me, "Async");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 去掉尾部字符串
|
||||
/// </summary>
|
||||
public static string TrimSuffix(this string me, string clearStr)
|
||||
{
|
||||
return Regex.Replace(me, $"{clearStr}$", string.Empty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 去掉尾部字符串“Options”
|
||||
/// </summary>
|
||||
public static string TrimEndOptions(this string me)
|
||||
public static string TrimSuffixOptions(this string me)
|
||||
{
|
||||
return _regex.Replace(me, string.Empty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 去掉前部字符串
|
||||
/// </summary>
|
||||
public static string TrimStart(this string me, string clearStr)
|
||||
{
|
||||
return Regex.Replace(me, $"^{clearStr}", string.Empty);
|
||||
return TrimPrefix(me, "Options");
|
||||
}
|
||||
}
|
@ -24,11 +24,6 @@ public static class GlobalStatic
|
||||
#endif
|
||||
;
|
||||
|
||||
/// <summary>
|
||||
/// 日志保存跳过的API编号
|
||||
/// </summary>
|
||||
public static string[] LogSavingSkipApiIds => ["api/probe/health.check", "api/adm/device.log/create"];
|
||||
|
||||
/// <summary>
|
||||
/// 系统内部密钥
|
||||
/// </summary>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user