Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita492b94

Browse files
committed
1.修改CrudService接口
1 parent0bee326 commita492b94

File tree

15 files changed

+229
-105
lines changed

15 files changed

+229
-105
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
usingDestiny.Core.Flow.AspNetCore;
2+
usingDestiny.Core.Flow.Dtos;
3+
usingDestiny.Core.Flow.IServices.Assets;
4+
usingDestiny.Core.Flow.Model.Entities;
5+
usingMicrosoft.AspNetCore.Http;
6+
usingMicrosoft.AspNetCore.Mvc;
7+
usingSystem;
8+
usingSystem.Collections.Generic;
9+
usingSystem.ComponentModel;
10+
usingSystem.Linq;
11+
usingSystem.Threading.Tasks;
12+
13+
namespaceDestiny.Core.Flow.API.Controllers
14+
{
15+
[Description("资产控制器")]
16+
17+
publicclassAssetController:CrudAdminControllerBase<IAssetService,Guid,Asset,AssetInputDto,AssetOutputDto,AssetPageListDto>
18+
{
19+
publicAssetController(IAssetServicecrudServiceAsync):base(crudServiceAsync)
20+
{
21+
22+
}
23+
24+
25+
}
26+
}

‎src/Destiny.Core.Flow.API/Controllers/IdentityController.cs‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
usingSystem.ComponentModel;
1111
usingSystem.Security.Claims;
1212
usingSystem.Threading.Tasks;
13-
13+
usingDestinyCore.Enums;
14+
1415
namespaceDestiny.Core.Flow.API.Controllers
1516
{
1617

@@ -56,10 +57,16 @@ public async Task<AjaxResult> LoginAsync([FromBody] LoginDto loginDto)
5657
[Description("更改密码")]
5758
[NoAuthorityVerification]
5859
publicasyncTask<AjaxResult>ChangePassword([FromBody]ChangePassInputDtodto)
59-
{
60-
varresult=await_identityService.ChangePassword(dto);
61-
62-
returnresult.ToAjaxResult();
60+
{
61+
62+
#ifDEBUG
63+
varresult=await_identityService.ChangePassword(dto);
64+
returnresult.ToAjaxResult();
65+
#else
66+
awaitTask.CompletedTask;
67+
returnnewAjaxResult("正式环境上不支持修改密码功能",AjaxResultType.Info);
68+
#endif
69+
6370
}
6471

6572

‎src/Destiny.Core.Flow.API/Destiny.Core.Flow.API.csproj‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
</ItemGroup>
5555

5656
<ItemGroup>
57+
<ProjectReferenceInclude="..\Destiny.Core.Flow.AspNetCore\Destiny.Core.Flow.AspNetCore.csproj" />
5758
<ProjectReferenceInclude="..\Destiny.Core.Flow.Dtos\Destiny.Core.Flow.Dtos.csproj" />
5859
<ProjectReferenceInclude="..\Destiny.Core.Flow.IdentityServer4\Destiny.Core.Flow.IdentityServer.csproj" />
5960
<ProjectReferenceInclude="..\Destiny.Core.Flow.IServices\Destiny.Core.Flow.IServices.csproj" />
Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,63 @@
1-
usingAspectCore.Extensions.Hosting;
2-
usingDestiny.Core.Flow.SeriLog;
3-
usingMicrosoft.AspNetCore.Hosting;
4-
usingMicrosoft.Extensions.Configuration;
5-
usingMicrosoft.Extensions.Hosting;
6-
usingMicrosoft.Extensions.Logging;
7-
usingSerilog;
8-
usingSerilog.Events;
9-
usingSystem;
10-
usingSystem.IO;
11-
12-
namespaceDestiny.Core.Flow.API
13-
{
14-
publicclassProgram
15-
{
16-
publicstaticvoidMain(string[]args)
17-
{
18-
19-
//SeriLogLogger.SetSeriLoggerToFile("Logs",string.Empty);
20-
CreateHostBuilder(args).Build().Run();
21-
}
22-
publicstaticIHostBuilderCreateHostBuilder(string[]args)=>
23-
Host.CreateDefaultBuilder(args)
24-
.ConfigureWebHostDefaults(webBuilder=>
25-
{
26-
webBuilder.UseStartup<Startup>()
27-
//待封装
28-
.UseSerilog((webHost,configuration)=>{
29-
30-
//得到配置文件
31-
varserilog=webHost.Configuration.GetSection("Serilog");
32-
//最小级别
33-
varminimumLevel=serilog["MinimumLevel:Default"];
34-
//日志事件级别
35-
varlogEventLevel=(LogEventLevel)Enum.Parse(typeof(LogEventLevel),minimumLevel);
36-
37-
38-
configuration.ReadFrom.
39-
Configuration(webHost.Configuration.GetSection("Serilog")).Enrich.FromLogContext().WriteTo.Console(logEventLevel);
40-
configuration.WriteTo.Map(le=>MapData(le),
41-
(key,log)=>
42-
log.Async(o=>o.File(Path.Combine("Logs",@$"{key.time:yyyy-MM-dd}\{key.level.ToString().ToLower()}.txt"),logEventLevel)));
43-
44-
(DateTimetime,LogEventLevellevel)MapData(LogEventlogEvent)
45-
{
46-
47-
return(newDateTime(logEvent.Timestamp.Year,logEvent.Timestamp.Month,logEvent.Timestamp.Day,logEvent.Timestamp.Hour,logEvent.Timestamp.Minute,logEvent.Timestamp.Second),logEvent.Level);
48-
}
49-
50-
}).ConfigureLogging((hostingContext,builder)=>
51-
{
52-
builder.ClearProviders();
53-
builder.SetMinimumLevel(LogLevel.Information);
54-
55-
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
56-
builder.AddConsole();
57-
builder.AddDebug();
58-
});
59-
}).UseDynamicProxy();//*/;//aspcectcore;
60-
61-
62-
}
63-
}
1+
usingAspectCore.Extensions.Hosting;
2+
usingDestiny.Core.Flow.SeriLog;
3+
usingMicrosoft.AspNetCore.Hosting;
4+
usingMicrosoft.Extensions.Configuration;
5+
usingMicrosoft.Extensions.Hosting;
6+
usingMicrosoft.Extensions.Logging;
7+
usingSerilog;
8+
usingSerilog.Events;
9+
usingSystem;
10+
usingSystem.IO;
11+
12+
namespaceDestiny.Core.Flow.API
13+
{
14+
publicclassProgram
15+
{
16+
publicstaticvoidMain(string[]args)
17+
{
18+
19+
//SeriLogLogger.SetSeriLoggerToFile("Logs",string.Empty);
20+
CreateHostBuilder(args).Build().Run();
21+
}
22+
publicstaticIHostBuilderCreateHostBuilder(string[]args)=>
23+
Host.CreateDefaultBuilder(args)
24+
.ConfigureWebHostDefaults(webBuilder=>
25+
{
26+
webBuilder.UseStartup<Startup>()
27+
//待封装
28+
.UseSerilog((webHost,configuration)=>{
29+
30+
//得到配置文件
31+
varserilog=webHost.Configuration.GetSection("Serilog");
32+
//最小级别
33+
varminimumLevel=serilog["MinimumLevel:Default"];
34+
//日志事件级别
35+
varlogEventLevel=(LogEventLevel)Enum.Parse(typeof(LogEventLevel),minimumLevel);
36+
37+
38+
configuration.ReadFrom.
39+
Configuration(webHost.Configuration.GetSection("Serilog")).Enrich.FromLogContext().WriteTo.Console(logEventLevel);
40+
configuration.WriteTo.Map(le=>MapData(le),
41+
(key,log)=>
42+
log.Async(o=>o.File(Path.Combine("Logs",@$"{key.time:yyyy-MM-dd}\{key.level.ToString().ToLower()}.txt"),logEventLevel)));
43+
44+
(DateTimetime,LogEventLevellevel)MapData(LogEventlogEvent)
45+
{
46+
47+
return(newDateTime(logEvent.Timestamp.Year,logEvent.Timestamp.Month,logEvent.Timestamp.Day,logEvent.Timestamp.Hour,logEvent.Timestamp.Minute,logEvent.Timestamp.Second),logEvent.Level);
48+
}
49+
50+
}).ConfigureLogging((hostingContext,builder)=>
51+
{
52+
builder.ClearProviders();
53+
builder.SetMinimumLevel(LogLevel.Information);
54+
55+
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
56+
builder.AddConsole();
57+
builder.AddDebug();
58+
});
59+
}).UseDynamicProxy();//*/;//aspcectcore;
60+
61+
62+
}
63+
}

‎src/Destiny.Core.Flow.AspNetCore/CrudAdminControllerBaseOfModle.cs‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ public virtual async Task<AjaxResult> UpdateAsync([FromBody] IInputDto dto)
9292

9393
[Description("异步删除")]
9494
[HttpDelete]
95-
publicvirtualasyncTask<AjaxResult>DeleteAsync(TPrimaryKeyid)
95+
publicvirtualasyncTask<AjaxResult>DeleteAsync(TPrimaryKeykey)
9696
{
9797

98-
return(awaitCrudServiceAsync.DeleteAsync(id)).ToAjaxResult();
98+
return(awaitCrudServiceAsync.DeleteAsync(key)).ToAjaxResult();
9999

100100
}
101101

@@ -106,6 +106,17 @@ public async Task<PageList<IPagedListDto>> GetPageAsync([FromBody] PageRequest r
106106
return(awaitCrudServiceAsync.GetPageAsync(request)).ToPageList();
107107

108108
}
109+
110+
/// <summary>
111+
/// 异步创建或更新
112+
/// </summary>
113+
/// <param name="dto"></param>
114+
[Description("异步创建或更新")]
115+
[HttpPost]
116+
publicasyncTask<AjaxResult>CreateOrUpdateAsync([FromBody]IInputDtodto)
117+
{
118+
return(awaitCrudServiceAsync.CreateOrUpdateAsync(dto)).ToAjaxResult();
119+
}
109120
}
110121

111122

@@ -156,7 +167,7 @@ public abstract class CrudAdminControllerBase<ICrudService, TPrimaryKey, TEntity
156167
whereICrudService:ICrudServiceAsync<TPrimaryKey,TEntity,IInputDto,IIOutputDto,IPagedListDto>
157168
{
158169

159-
170+
160171

161172
protectedCrudAdminControllerBase(ICrudServicecrudServiceAsync):base(crudServiceAsync)
162173
{

‎src/Destiny.Core.Flow.AuthenticationCenter/Destiny.Core.Flow.AuthenticationCenter.csproj‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
<ItemGroup>
1111
<PackageReferenceInclude="AspNet.Security.OAuth.QQ"Version="5.0.5" />
12-
<PackageReferenceInclude="DestinyCore.AspNetCore"Version="1.0.0" />
1312
<PackageReferenceInclude="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation"Version="5.0.6" />
1413
<PackageReferenceInclude="Microsoft.VisualStudio.Azure.Containers.Tools.Targets"Version="1.10.13" />
1514
<PackageReferenceInclude="Pomelo.EntityFrameworkCore.MySql"Version="5.0.0" />
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
usingDestiny.Core.Flow.Dtos;
2+
usingDestiny.Core.Flow.Model.Entities;
3+
usingDestiny.Core.Flow.Shared.Abstractions;
4+
usingDestinyCore.Dependency;
5+
usingSystem;
6+
usingSystem.Collections.Generic;
7+
usingSystem.Linq;
8+
usingSystem.Text;
9+
usingSystem.Threading.Tasks;
10+
11+
namespaceDestiny.Core.Flow.IServices.Assets
12+
{
13+
/// <summary>
14+
/// 资源服务接口
15+
/// </summary>
16+
publicinterfaceIAssetService:ICrudServiceAsync<Guid,Asset,AssetInputDto,AssetOutputDto,AssetPageListDto>,IScopedDependency
17+
{
18+
}
19+
}

‎src/Destiny.Core.Flow.IServices/Destiny.Core.Flow.IServices.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
<ItemGroup>
1818
<ProjectReferenceInclude="..\Destiny.Core.Flow.Dtos\Destiny.Core.Flow.Dtos.csproj" />
19+
<ProjectReferenceInclude="..\Destiny.Core.Flow.Shared\Destiny.Core.Flow.Shared.csproj" />
1920
</ItemGroup>
2021

2122
<ItemGroup>
@@ -25,7 +26,6 @@
2526

2627
<ItemGroup>
2728
<FolderInclude="Abstractions\" />
28-
<FolderInclude="Assets\" />
2929
</ItemGroup>
3030

3131
</Project>

‎src/Destiny.Core.Flow.Model/Destiny.Core.Flow.Model.csproj‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<ProjectReferenceInclude="..\Destiny.Core.Flow.IdentityServer.Entities\Destiny.Core.Flow.IdentityServer.Entities.csproj" />
2525
<ProjectReferenceInclude="..\Destiny.Core.Flow.Identity\Destiny.Core.Flow.Identitys.csproj" />
2626
<ProjectReferenceInclude="..\Destiny.Core.Flow.OpenIddict.Entities\Destiny.Core.Flow.OpenIddict.Entities.csproj" />
27+
<ProjectReferenceInclude="..\Destiny.Core.Flow.Shared\Destiny.Core.Flow.Shared.csproj" />
2728
</ItemGroup>
2829

2930
</Project>

‎src/Destiny.Core.Flow.Model/Entities/Asset.cs‎

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
usingDestinyCore.Entity;
1+
usingDestiny.Core.Flow.Shared.Entity;
2+
usingDestinyCore.Entity;
23
usingSystem;
34
usingSystem.Collections.Generic;
45
usingSystem.ComponentModel;
@@ -10,7 +11,7 @@ namespace Destiny.Core.Flow.Model.Entities
1011
/// 资产
1112
/// </summary>
1213
[DisplayName("资产")]
13-
publicpartialclassAsset:EntityBase<Guid>,IFullAuditedEntity<Guid>
14+
publicpartialclassAsset:FullAuditedEntityWithEntity<Guid,Guid>
1415
{
1516
/// <summary>
1617
/// 后缀名
@@ -44,30 +45,6 @@ public partial class Asset : EntityBase<Guid>, IFullAuditedEntity<Guid>
4445
[DisplayName("名字")]
4546
publicstringName{get;set;}
4647

47-
/// <summary>
48-
/// 获取或设置最后修改用户
49-
/// </summary>
50-
[DisplayName("最后修改用户")]
51-
publicGuid?LastModifierUserId{get;set;}
52-
/// <summary>
53-
/// 获取或设置最后修改时间
54-
/// </summary>
55-
[DisplayName("最后修改时间")]
56-
publicDateTime?LastModifionTime{get;set;}
57-
/// <summary>
58-
/// 获取或设置是否删除
59-
/// </summary>
60-
[DisplayName("是否删除")]
61-
publicboolIsDeleted{get;set;}
62-
/// <summary>
63-
/// 获取或设置创建用户ID
64-
/// </summary>
65-
[DisplayName("创建用户ID")]
66-
publicGuid?CreatorUserId{get;set;}
67-
/// <summary>
68-
/// 获取或设置创建时间
69-
/// </summary>
70-
[DisplayName("创建时间")]
71-
publicDateTimeCreatedTime{get;set;}
48+
7249
}
7350
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp