From aa49398c2934af763662318c8ce5196fb9451e5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com> Date: Mon, 11 Dec 2023 22:14:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0abp=E7=9A=84=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../YiCrudAppService.cs | 7 +- .../Dtos/Article/ArticleGetListInputVo.cs | 3 +- .../Dtos/Article/ArticleGetListOutputDto.cs | 2 + .../Dtos/Article/ArticleGetOutputDto.cs | 2 + .../Dtos/Plate/PlateCreateInputVo.cs | 2 + .../Dtos/Plate/PlateGetListInputVo.cs | 6 +- .../Dtos/Plate/PlateGetListOutputDto.cs | 4 + .../Dtos/Plate/PlateGetOutputDto.cs | 3 + .../Dtos/Plate/PlateUpdateInputVo.cs | 2 + .../Services/ArticleService.cs | 17 ++ .../Services/PlateService.cs | 19 +- .../Entities/ArticleEntity.cs | 12 +- .../Entities/PlateEntity.cs | 15 +- Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs | 12 +- Yi.Abp.Net8/src/Yi.Abp.Web/yi-abp-dev.db | Bin 229376 -> 229376 bytes Yi.RuoYi.Vue3/src/api/bbs/articleApi.js | 14 +- Yi.RuoYi.Vue3/src/api/bbs/plateApi.js | 47 +++ Yi.RuoYi.Vue3/src/api/template.txt | 3 +- Yi.RuoYi.Vue3/src/views/bbs/plate/index.vue | 282 ++++++++++++++++++ Yi.RuoYi.Vue3/src/views/template.txt | 4 +- 20 files changed, 433 insertions(+), 23 deletions(-) create mode 100644 Yi.RuoYi.Vue3/src/api/bbs/plateApi.js create mode 100644 Yi.RuoYi.Vue3/src/views/bbs/plate/index.vue diff --git a/Yi.Abp.Net8/framework/Yi.Framework.Ddd.Application/YiCrudAppService.cs b/Yi.Abp.Net8/framework/Yi.Framework.Ddd.Application/YiCrudAppService.cs index 31700d81..ba23f367 100644 --- a/Yi.Abp.Net8/framework/Yi.Framework.Ddd.Application/YiCrudAppService.cs +++ b/Yi.Abp.Net8/framework/Yi.Framework.Ddd.Application/YiCrudAppService.cs @@ -62,6 +62,11 @@ namespace Yi.Framework.Ddd.Application { } + public override Task> GetListAsync(TGetListInput input) + { + throw new NotImplementedException($"【{typeof(TEntity)}】实体的CrudAppService,查询为具体业务,通用查询几乎无实际场景,请重写实现!"); + } + /// /// 偷梁换柱 /// @@ -72,7 +77,7 @@ namespace Yi.Framework.Ddd.Application { await Repository.DeleteManyAsync(id); } - [RemoteService(isEnabled:false)] + [RemoteService(isEnabled: false)] public override Task DeleteAsync(TKey id) { return base.DeleteAsync(id); diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleGetListInputVo.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleGetListInputVo.cs index dec2f195..b10278a1 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleGetListInputVo.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleGetListInputVo.cs @@ -1,8 +1,9 @@ using Volo.Abp.Application.Dtos; +using Yi.Framework.Ddd.Application.Contracts; namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Article { - public class ArticleGetListInputVo : PagedAndSortedResultRequestDto + public class ArticleGetListInputVo : PagedAllResultRequestDto { public string? Content { get; set; } public string? Name { get; set; } diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleGetListOutputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleGetListOutputDto.cs index 735dfac5..b63cd27e 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleGetListOutputDto.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleGetListOutputDto.cs @@ -10,5 +10,7 @@ namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Article public Guid DiscussId { get; set; } public List? Children { get; set; } + + public DateTime CreationTime { get; set; } } } diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleGetOutputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleGetOutputDto.cs index 85825322..0d974c80 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleGetOutputDto.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleGetOutputDto.cs @@ -8,5 +8,7 @@ namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Article public string Name { get; set; } public Guid DiscussId { get; set; } public Guid ParentId { get; set; } + + public DateTime CreationTime { get; set; } } } diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateCreateInputVo.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateCreateInputVo.cs index 0280902b..143bb793 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateCreateInputVo.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateCreateInputVo.cs @@ -8,5 +8,7 @@ namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Plate public string Name { get; set; } public string? Logo { get; set; } public string? Introduction { get; set; } + + public string Code { get; set; } } } diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateGetListInputVo.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateGetListInputVo.cs index b7a6ec3d..b424154c 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateGetListInputVo.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateGetListInputVo.cs @@ -1,11 +1,11 @@ using Volo.Abp.Application.Dtos; +using Yi.Framework.Ddd.Application.Contracts; namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Plate { - public class PlateGetListInputVo : PagedAndSortedResultRequestDto + public class PlateGetListInputVo : PagedAllResultRequestDto { public string? Name { get; set; } - public string? Logo { get; set; } - public string? Introduction { get; set; } + public string? Code { get; set; } } } diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateGetListOutputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateGetListOutputDto.cs index 1f2970c7..f3621635 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateGetListOutputDto.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateGetListOutputDto.cs @@ -8,5 +8,9 @@ namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Plate public string Name { get; set; } public string? Logo { get; set; } public string? Introduction { get; set; } + + public string Code { get; set; } + + public DateTime CreationTime { get; set; } } } diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateGetOutputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateGetOutputDto.cs index 24ba4208..ed0b9ad3 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateGetOutputDto.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateGetOutputDto.cs @@ -7,5 +7,8 @@ namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Plate public string Name { get; set; } public string? Logo { get; set; } public string? Introduction { get; set; } + public string Code { get; set; } + + public DateTime CreationTime { get; set; } } } diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateUpdateInputVo.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateUpdateInputVo.cs index 16a55e14..d5dfb272 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateUpdateInputVo.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateUpdateInputVo.cs @@ -5,5 +5,7 @@ namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Plate public string? Name { get; set; } public string? Logo { get; set; } public string? Introduction { get; set; } + + public string? Code { get; set; } } } diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/ArticleService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/ArticleService.cs index 12fa9001..83400b0d 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/ArticleService.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/ArticleService.cs @@ -3,8 +3,12 @@ using Mapster; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; +using SqlSugar; using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Domain.Repositories; using Yi.Framework.Bbs.Application.Contracts.Dtos.Article; +using Yi.Framework.Bbs.Application.Contracts.Dtos.Plate; using Yi.Framework.Bbs.Application.Contracts.IServices; using Yi.Framework.Bbs.Domain.Entities; using Yi.Framework.Bbs.Domain.Repositories; @@ -37,6 +41,19 @@ namespace Yi.Framework.Bbs.Application.Services private IArticleRepository _articleRepository { get; set; } private ISqlSugarRepository _discussRepository { get; set; } private IDiscussService _discussService { get; set; } + + public override async Task> GetListAsync(ArticleGetListInputVo input) + { + RefAsync total = 0; + + var entities = await _articleRepository._DbQueryable.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name!)) + //.WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Name.Contains(input.Code!)) + .WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime) + .ToPageListAsync(input.SkipCount, input.MaxResultCount, total); + return new PagedResultDto(total, await MapToGetListOutputDtosAsync(entities)); + } + + /// /// 获取文章全部平铺信息 /// diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/PlateService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/PlateService.cs index b438a99a..6ef7b09b 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/PlateService.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/PlateService.cs @@ -1,8 +1,12 @@ +using SqlSugar; +using Volo.Abp.Application.Dtos; using Volo.Abp.Domain.Repositories; using Yi.Framework.Bbs.Application.Contracts.Dtos.Plate; using Yi.Framework.Bbs.Application.Contracts.IServices; using Yi.Framework.Bbs.Domain.Entities; using Yi.Framework.Ddd.Application; +using Yi.Framework.Rbac.Application.Contracts.Dtos.Config; +using Yi.Framework.SqlSugarCore.Abstractions; namespace Yi.Framework.Bbs.Application.Services { @@ -12,8 +16,21 @@ namespace Yi.Framework.Bbs.Application.Services public class PlateService : YiCrudAppService, IPlateService { - public PlateService(IRepository repository) : base(repository) + private ISqlSugarRepository _repository; + public PlateService(ISqlSugarRepository repository) : base(repository) { + _repository= repository; + } + + public override async Task> GetListAsync(PlateGetListInputVo input) + { + RefAsync total = 0; + + var entities = await _repository._DbQueryable.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name!)) + .WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Name.Contains(input.Code!)) + .WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime) + .ToPageListAsync(input.SkipCount, input.MaxResultCount, total); + return new PagedResultDto(total, await MapToGetListOutputDtosAsync(entities)); } } } diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/ArticleEntity.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/ArticleEntity.cs index 58eef9c5..21652fc6 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/ArticleEntity.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/ArticleEntity.cs @@ -1,11 +1,12 @@ using SqlSugar; using Volo.Abp; +using Volo.Abp.Auditing; using Volo.Abp.Domain.Entities; namespace Yi.Framework.Bbs.Domain.Entities { [SugarTable("Article")] - public class ArticleEntity : Entity, ISoftDelete + public class ArticleEntity : Entity, ISoftDelete,IAuditedObject { [SugarColumn(ColumnName = "Id", IsPrimaryKey = true)] public override Guid Id { get; protected set; } @@ -23,6 +24,15 @@ namespace Yi.Framework.Bbs.Domain.Entities [SugarColumn(IsIgnore = true)] public List? Children { get; set; } + + + public DateTime CreationTime { get; set; } + + public Guid? CreatorId { get; set; } + + public Guid? LastModifierId { get; set; } + + public DateTime? LastModificationTime { get; set; } } public static class ArticleEntityExtensions diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/PlateEntity.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/PlateEntity.cs index 693690ff..3d2f171e 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/PlateEntity.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/PlateEntity.cs @@ -1,18 +1,31 @@ using SqlSugar; using Volo.Abp.Domain.Entities; using Volo.Abp; +using Volo.Abp.Auditing; namespace Yi.Framework.Bbs.Domain.Entities { [SugarTable("Plate")] - public class PlateEntity : Entity, ISoftDelete + public class PlateEntity : Entity, ISoftDelete,IAuditedObject { [SugarColumn(ColumnName = "Id", IsPrimaryKey = true)] public override Guid Id { get; protected set; } + + public string Code { get; set; } public string Name { get; set; } public string? Logo { get; set; } public string? Introduction { get; set; } public bool IsDeleted { get; set; } + + + + public DateTime CreationTime { get; set; } + + public Guid? CreatorId { get; set; } + + public Guid? LastModifierId { get; set; } + + public DateTime? LastModificationTime { get; set; } } } diff --git a/Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs b/Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs index fa8a7da3..faa20eee 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs +++ b/Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs @@ -55,7 +55,7 @@ namespace Yi.Abp.Web //动态Api Configure(options => { - options.ConventionalControllers.Create(typeof(YiAbpApplicationModule).Assembly,options=>options.RemoteServiceName="default"); + options.ConventionalControllers.Create(typeof(YiAbpApplicationModule).Assembly, options => options.RemoteServiceName = "default"); options.ConventionalControllers.Create(typeof(YiFrameworkRbacApplicationModule).Assembly, options => options.RemoteServiceName = "rbac"); options.ConventionalControllers.Create(typeof(YiFrameworkBbsApplicationModule).Assembly, options => options.RemoteServiceName = "bbs"); }); @@ -63,7 +63,6 @@ namespace Yi.Abp.Web //设置api格式 service.AddControllers().AddNewtonsoftJson(options => { - // options.SerializerSettings.Converters.Add(new DateTimeJsonConverter("yyyy-MM-dd HH:mm:ss")); options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss"; }); Configure(options => @@ -76,7 +75,10 @@ namespace Yi.Abp.Web }); //Swagger - context.Services.AddYiSwaggerGen(); + context.Services.AddYiSwaggerGen(options => + { + options.SwaggerDoc("default", new OpenApiInfo { Title = "Yi.Framework.Abp", Version = "v1",Description="集大成者" }); + }); //跨域 context.Services.AddCors(options => @@ -145,10 +147,10 @@ namespace Yi.Abp.Web app.UseRouting(); - + //跨域 app.UseCors(DefaultCorsPolicyName); - + //鉴权 app.UseAuthentication(); diff --git a/Yi.Abp.Net8/src/Yi.Abp.Web/yi-abp-dev.db b/Yi.Abp.Net8/src/Yi.Abp.Web/yi-abp-dev.db index a244c81284affd37ea0c8386708077c5c15ff2ed..df0255e71257b64e2a8951edd9a9783de1b4dc33 100644 GIT binary patch delta 1654 zcmcJPO>7%Q6o6;fC0_43yO@wzZ78)>qc&~F*_oZ0U0V=|=0Z`CpveNNsL1YmoLUVr zu^kc-AaSb}aVSX@fu%+jKcxp$kpwJZ5CVcKaYO0>Bo0U+h>{yZ>LnKhYsVp>0^|#; zx1+b3H}8G(_PsYVqt48zbKQ|X0D$GcTTlGb5ku(vaOl0+J&IfeT3Hj-v+cjPzZ~8O zPbwQqQNAq~tMR*S`O#Mt+3t@V*cXlW0KySBsDq$kx(+l5LeQg_K*Q0q%r!XShJkf# zK!hPeF^tkUmBut_A%+m0e`tYKZ(okwwMS9=fI6q0QinC7T~Pb9CG{swQ9sqbuf}6B z6&?)OLMyS9y5amEmlM_5#qmgBP`o%FT(L#**O*K@KN zrkl|9hyy*7S&(H+uSriG*YU_;-7tkYGdzMJ*BOB>aVhi|+cG4sgRJa8-OwXuh7*#7 zX4XRxyIvL=u0fj~iDM$>oTwX~3*V@PZwMO?c7;MyKzl@8R6E*_hnK<;rAK};H07t- z2|ZPQda%=$`fUKD&;uc8@9mbP5aQ@Dni3Mzzr6YC`t`Th z7vEW*yWqOTv{NYMyb+!r$rVej+`~J~y)$lpvU$#T(c4sebE6qPS$=$A2YipcJ6eZ7 z44TQb{xh39=~0>(X_`tR-LfdAP5LWe-nvrRrhk6KDYee-j+aXL(Z-oNcSC7X^AkSx z!?xWoggPW(cXZaN0k|V0z5n=Y@1VwMf|3|vmfB2t<*R7{b~W0-zmblTIx;A>uyge2 z!2Hc;6G3-;xYy^YMZ)55SNDSj5CJ1VSx|1tC#4^yYTM`1OM#!;UKdvb?+e$&kJ<~B z#IiWCOS%qLYi})!VM&xC%FV+ynmV9k%BVRa{8H$aM=ElZ(F2hGlxonOX z{N3YDvGiCz)A;-slge5`xVLlLXV2LY7>q`v!g;fDZCU(wx*jB-@uR-r6ui?;;UK28 zXDjmmg0xNTIi#a!itVI~6 zkT45DL}&_9_E(QnE5i+)PmJ-giNe@Kb4A#g82fv5P%DjDk|D-S(`eN6$#R#V*qvaX zwATQ3KeGrS%pef!DGmv7ILw;BEU`_qn6*{^I-TLRjWKWQWSRqcuTaBAg-;(>r2Y6bCKJ@zLNR@Y?! delta 281 zcmV+!0p|XIfDV9w4v-rWFaQ7mH~;_u00000000007?CV90Wh&(q>mU13iALDfe!)> zf(`u*eGK>vcnkOoa|-jbArRLJv-6q}1sDnrX8;b64_yvt4>S*k53dg54+{>t57@I2 zFiQ>uC<9dilmD6|vyZNI5d%>J2$KiERg+%890Cl@vw*-20+TQhfrALcw+O=l{5%i_ z3=seiNDi(J6AerZuM82hAt3z=w-F2i@S`ILs{j!IYybA3 + +
+ + + + + + + + + + + + + + + + + 搜索 + 重置 + + + + + + 新增 + + + 修改 + + + 删除 + + + 导出 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + \ No newline at end of file diff --git a/Yi.RuoYi.Vue3/src/views/template.txt b/Yi.RuoYi.Vue3/src/views/template.txt index cb6cabde..3b6f0e9f 100644 --- a/Yi.RuoYi.Vue3/src/views/template.txt +++ b/Yi.RuoYi.Vue3/src/views/template.txt @@ -92,11 +92,11 @@ -->