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 a244c812..df0255e7 100644 Binary files a/Yi.Abp.Net8/src/Yi.Abp.Web/yi-abp-dev.db and b/Yi.Abp.Net8/src/Yi.Abp.Web/yi-abp-dev.db differ diff --git a/Yi.RuoYi.Vue3/src/api/bbs/articleApi.js b/Yi.RuoYi.Vue3/src/api/bbs/articleApi.js index 403e94c0..dd128760 100644 --- a/Yi.RuoYi.Vue3/src/api/bbs/articleApi.js +++ b/Yi.RuoYi.Vue3/src/api/bbs/articleApi.js @@ -3,7 +3,7 @@ // 分页查询 export function listData(query) { return request({ - url: '/article/pageList', + url: '/article', method: 'get', params: query }) @@ -12,7 +12,7 @@ export function listData(query) { // id查询 export function getData(code) { return request({ - url: '/article/getById/' + code, + url: '/article/' + code, method: 'get' }) } @@ -20,7 +20,7 @@ export function getData(code) { // 新增 export function addData(data) { return request({ - url: '/article/add', + url: '/article', method: 'post', data: data }) @@ -29,17 +29,17 @@ export function addData(data) { // 修改 export function updateData(data) { return request({ - url: '/article/update', + url: `/article/${data.id}`, method: 'put', data: data }) } // 删除 -export function delData(code) { +export function delData(ids) { return request({ - url: '/article/delList', + url: '/article', method: 'delete', - data:"string"==typeof(code)?[code]:code + params:{id:ids} }) } diff --git a/Yi.RuoYi.Vue3/src/api/bbs/plateApi.js b/Yi.RuoYi.Vue3/src/api/bbs/plateApi.js new file mode 100644 index 00000000..71b14236 --- /dev/null +++ b/Yi.RuoYi.Vue3/src/api/bbs/plateApi.js @@ -0,0 +1,47 @@ +import request from '@/utils/request' +/* 以下为api的模板,通用的crud,将以下变量替换即可: +plate : 实体模型 +*/ +// 分页查询 +export function listData(query) { + return request({ + url: '/plate', + method: 'get', + params: query + }) +} + +// id查询 +export function getData(id) { + return request({ + url: `/plate/${id}`, + method: 'get' + }) +} + +// 新增 +export function addData(data) { + return request({ + url: '/plate', + method: 'post', + data: data + }) +} + +// 修改 +export function updateData(id,data) { + return request({ + url: `/plate/${id}`, + method: 'put', + data: data + }) +} + +// 删除 +export function delData(ids) { + return request({ + url: `/plate`, + method: 'delete', + params:{id:ids} + }) +} diff --git a/Yi.RuoYi.Vue3/src/api/template.txt b/Yi.RuoYi.Vue3/src/api/template.txt index 128ed557..06c97338 100644 --- a/Yi.RuoYi.Vue3/src/api/template.txt +++ b/Yi.RuoYi.Vue3/src/api/template.txt @@ -40,7 +40,8 @@ export function updateData(id,data) { // 删除 export function delData(ids) { return request({ - url: `/@model@/${ids}`, + url: `/@model@`, method: 'delete', + params:{id:ids} }) } diff --git a/Yi.RuoYi.Vue3/src/views/bbs/plate/index.vue b/Yi.RuoYi.Vue3/src/views/bbs/plate/index.vue new file mode 100644 index 00000000..1d81c57c --- /dev/null +++ b/Yi.RuoYi.Vue3/src/views/bbs/plate/index.vue @@ -0,0 +1,282 @@ + + + + \ 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 @@ -->