diff --git a/Yi.Abp.Net8/Yi.Abp.sln b/Yi.Abp.Net8/Yi.Abp.sln index 68fdb662..0403da9e 100644 --- a/Yi.Abp.Net8/Yi.Abp.sln +++ b/Yi.Abp.Net8/Yi.Abp.sln @@ -115,7 +115,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.CodeGen.Domain EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.CodeGen.Domain.Shared", "module\code-gen\Yi.Framework.Codegen.Domain.Shared\Yi.Framework.CodeGen.Domain.Shared.csproj", "{EEFF0F05-2709-4151-A8CE-667935CEAE0B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yi.Framework.Caching.FreeRedis", "framework\Yi.Framework.Caching.FreeRedis\Yi.Framework.Caching.FreeRedis.csproj", "{862BB0EF-3D4E-44FF-AB15-0EB74CE553D3}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Caching.FreeRedis", "framework\Yi.Framework.Caching.FreeRedis\Yi.Framework.Caching.FreeRedis.csproj", "{862BB0EF-3D4E-44FF-AB15-0EB74CE553D3}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yi.Framework.CodeGen.SqlSugarCore", "module\code-gen\Yi.Framework.CodeGen.SqlSugarCore\Yi.Framework.CodeGen.SqlSugarCore.csproj", "{FB09ACC2-A27D-4D87-8D85-1435FDED4D04}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -295,6 +297,10 @@ Global {862BB0EF-3D4E-44FF-AB15-0EB74CE553D3}.Debug|Any CPU.Build.0 = Debug|Any CPU {862BB0EF-3D4E-44FF-AB15-0EB74CE553D3}.Release|Any CPU.ActiveCfg = Release|Any CPU {862BB0EF-3D4E-44FF-AB15-0EB74CE553D3}.Release|Any CPU.Build.0 = Release|Any CPU + {FB09ACC2-A27D-4D87-8D85-1435FDED4D04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FB09ACC2-A27D-4D87-8D85-1435FDED4D04}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FB09ACC2-A27D-4D87-8D85-1435FDED4D04}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FB09ACC2-A27D-4D87-8D85-1435FDED4D04}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -348,6 +354,7 @@ Global {85CB8517-2B80-42D8-B954-081079AC9BA0} = {4FFE7212-21F2-476D-B628-3C65E6C5075E} {EEFF0F05-2709-4151-A8CE-667935CEAE0B} = {4FFE7212-21F2-476D-B628-3C65E6C5075E} {862BB0EF-3D4E-44FF-AB15-0EB74CE553D3} = {77B949E9-530E-45A5-9657-20F7D5C6875C} + {FB09ACC2-A27D-4D87-8D85-1435FDED4D04} = {4FFE7212-21F2-476D-B628-3C65E6C5075E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {23D6FBC9-C970-4641-BC1E-2AEA59F51C18} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain.Shared/Enums/FieldTypeEnum.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain.Shared/Enums/FieldTypeEnum.cs index 4713f2a9..8a08cca9 100644 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain.Shared/Enums/FieldTypeEnum.cs +++ b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain.Shared/Enums/FieldTypeEnum.cs @@ -26,6 +26,9 @@ namespace Yi.Framework.CodeGen.Domain.Shared.Enums [Display(Name = "DateTime", Description = "DateTime")] DateTime, + + [Display(Name = "Guid", Description = "Guid")] + Guid } } diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.SqlSugarCore/TemplateDataSeed.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.SqlSugarCore/TemplateDataSeed.cs new file mode 100644 index 00000000..348cdaf9 --- /dev/null +++ b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.SqlSugarCore/TemplateDataSeed.cs @@ -0,0 +1,106 @@ +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Guids; +using Yi.Framework.CodeGen.Domain.Entities; +using Yi.Framework.SqlSugarCore.Abstractions; + +namespace Yi.Framework.CodeGen.SqlSugarCore +{ + public class TemplateDataSeed : IDataSeedContributor, ITransientDependency + { + private ISqlSugarRepository _repository; + public TemplateDataSeed(ISqlSugarRepository repository) + { + _repository = repository; + } + public async Task SeedAsync(DataSeedContext context) + { + if (!await _repository.IsAnyAsync(x => true)) + { + await _repository.InsertManyAsync(GetSeedData()); + } + } + public List GetSeedData() + { + var entities = new List(); + TemplateEntity entityTemplate = new TemplateEntity() + { + Name= "Entity", + BuildPath= "D:\\code\\Entities\\@ModelEntity.cs", + Remarks= "实体", + TemplateStr= "using SqlSugar;\r\nusing Volo.Abp;\r\nusing Volo.Abp.Auditing;\r\nusing Volo.Abp.Domain.Entities;\r\nusing Yi.Framework.Core.Data;\r\n\r\nnamespace Yi.Framework.Rbac.Domain.Entities\r\n{\r\n /// \r\n /// 实体\r\n /// \r\n [SugarTable(\"@Model\")]\r\n public class @ModelEntity : Entity\r\n {\r\n@field\r\n }\r\n}\r\n" + }; + entities.Add(entityTemplate); + + + TemplateEntity getListInputTemplate = new TemplateEntity() + { + Name = "GetListInput", + BuildPath = "D:\\code\\Dtos\\@Model\\@ModelGetListInput.cs", + Remarks = "列表查询参数", + TemplateStr = "using Yi.Framework.Ddd;\r\nusing Yi.Framework.Ddd.Application.Contracts;\r\n\r\nnamespace Yi.Framework.Rbac.Application.Contracts.Dtos.@Model\r\n{\r\n /// \r\n /// 查询参数\r\n /// \r\n public class @ModelGetListInputVo : PagedAllResultRequestDto\r\n {\r\n@field\r\n }\r\n}\r\n" + }; + entities.Add(getListInputTemplate); + + + TemplateEntity getListOutputDtoTemplate = new TemplateEntity() + { + Name = "GetListOutputDto", + BuildPath = "D:\\code\\Dtos\\@Model\\@ModelGetListOutputDto.cs", + Remarks = "列表返回dto", + TemplateStr = "using Volo.Abp.Application.Dtos;\r\n\r\nnamespace Yi.Framework.Rbac.Application.Contracts.Dtos.@Model\r\n{\r\n public class @ModelGetListOutputDto : EntityDto\r\n {\r\n@field\r\n }\r\n}\r\n" + }; + entities.Add(getListOutputDtoTemplate); + + + TemplateEntity getOutputDtoTemplate = new TemplateEntity() + { + Name = "GetOutputDto", + BuildPath = "D:\\code\\Dtos\\@Model\\@ModelGetOutputDto.cs", + Remarks = "单返回dto", + TemplateStr = "using Volo.Abp.Application.Dtos;\r\n\r\nnamespace Yi.Framework.Rbac.Application.Contracts.Dtos.@Model\r\n{\r\n public class @ModelGetOutputDto : EntityDto\r\n {\r\n@field\r\n }\r\n}\r\n" + }; + entities.Add(getOutputDtoTemplate); + + TemplateEntity updateInputTemplate = new TemplateEntity() + { + Name = "UpdateInput", + BuildPath = "D:\\code\\Dtos\\@Model\\@ModelUpdateInput.cs", + Remarks = "更新输入", + TemplateStr = "namespace Yi.Framework.Rbac.Application.Contracts.Dtos.@Model\r\n{\r\n public class @ModelUpdateInput\r\n {\r\n@field\r\n }\r\n}\r\n" + }; + entities.Add(updateInputTemplate); + + TemplateEntity createInputTemplate = new TemplateEntity() + { + Name = "CreateInput", + BuildPath = "D:\\code\\Dtos\\@Model\\@ModelCreateInput.cs", + Remarks = "创建dto", + TemplateStr = "namespace Yi.Framework.Rbac.Application.Contracts.Dtos.@Model\r\n{\r\n /// \r\n /// @Model输入创建对象\r\n /// \r\n public class @ModelCreateInput\r\n {\r\n@field\r\n }\r\n}\r\n" + }; + entities.Add(createInputTemplate); + + + TemplateEntity iServicesTemplate = new TemplateEntity() + { + Name = "IServices", + BuildPath = "D:\\code\\IServices\\I@ModelService.cs", + Remarks = "应用服务抽象", + TemplateStr = "using Volo.Abp.Application.Services;\r\nusing Yi.Framework.Ddd.Application.Contracts;\r\nusing Yi.Framework.Rbac.Application.Contracts.Dtos.@Model;\r\n\r\nnamespace Yi.Framework.Rbac.Application.Contracts.IServices\r\n{\r\n /// \r\n /// @Model服务抽象\r\n /// \r\n public interface I@ModelService : IYiCrudAppService<@ModelGetOutputDto, @ModelGetListOutputDto, Guid, @ModelGetListInputVo, @ModelCreateInputVo, @ModelUpdateInputVo>\r\n {\r\n\r\n }\r\n}\r\n" + }; + entities.Add(iServicesTemplate); + + + + TemplateEntity servicesTemplate = new TemplateEntity() + { + Name = "Service", + BuildPath = "D:\\code\\Services\\@ModelService.cs", + Remarks = "应用服务", + TemplateStr = "using SqlSugar;\r\nusing Volo.Abp.Application.Dtos;\r\nusing Volo.Abp.Application.Services;\r\nusing Yi.Framework.Ddd.Application;\r\nusing Yi.Framework.Rbac.Application.Contracts.Dtos.@Model;\r\nusing Yi.Framework.Rbac.Application.Contracts.IServices;\r\nusing Yi.Framework.Rbac.Domain.Entities;\r\nusing Yi.Framework.SqlSugarCore.Abstractions;\r\n\r\nnamespace Yi.Framework.Rbac.Application.Services\r\n{\r\n /// \r\n /// @Model服务实现\r\n /// \r\n public class @ModelService : YiCrudAppService<@ModelEntity, @ModelGetOutputDto, @ModelGetListOutputDto, Guid, @ModelGetListInputVo, @ModelCreateInputVo, @ModelUpdateInputVo>,\r\n I@ModelService\r\n {\r\n private ISqlSugarRepository<@ModelEntity, Guid> _repository;\r\n public @ModelService(ISqlSugarRepository<@ModelEntity, Guid> repository) : base(repository)\r\n {\r\n _repository = repository;\r\n }\r\n\r\n /// \r\n /// 多查\r\n /// \r\n /// \r\n /// \r\n public override async Task> GetListAsync(@ModelGetListInputVo input)\r\n {\r\n RefAsync total = 0;\r\n\r\n var entities = await _repository._DbQueryable.WhereIF(!string.IsNullOrEmpty(input.@ModelKey), x => x.@ModelKey.Contains(input.@ModelKey!))\r\n .WhereIF(!string.IsNullOrEmpty(input.@ModelName), x => x.@ModelName!.Contains(input.@ModelName!))\r\n .WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime)\r\n .ToPageListAsync(input.SkipCount, input.MaxResultCount, total);\r\n return new PagedResultDto<@ModelGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));\r\n }\r\n }\r\n}\r\n" + }; + entities.Add(servicesTemplate); + return entities; + } + } +} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.SqlSugarCore/Yi.Framework.CodeGen.SqlSugarCore.csproj b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.SqlSugarCore/Yi.Framework.CodeGen.SqlSugarCore.csproj new file mode 100644 index 00000000..e32e0691 --- /dev/null +++ b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.SqlSugarCore/Yi.Framework.CodeGen.SqlSugarCore.csproj @@ -0,0 +1,13 @@ + + + + net8.0 + enable + enable + + + + + + + diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.SqlSugarCore/YiFrameworkCodeGenSqlSugarCoreModule.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.SqlSugarCore/YiFrameworkCodeGenSqlSugarCoreModule.cs new file mode 100644 index 00000000..7e47a1d6 --- /dev/null +++ b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.SqlSugarCore/YiFrameworkCodeGenSqlSugarCoreModule.cs @@ -0,0 +1,10 @@ +using Yi.Framework.SqlSugarCore; + +namespace Yi.Framework.CodeGen.SqlSugarCore +{ + [DependsOn(typeof(YiFrameworkSqlSugarCoreModule))] + public class YiFrameworkCodeGenSqlSugarCoreModule:AbpModule + { + + } +} diff --git a/Yi.Abp.Net8/src/Yi.Abp.SqlSugarCore/Yi.Abp.SqlSugarCore.csproj b/Yi.Abp.Net8/src/Yi.Abp.SqlSugarCore/Yi.Abp.SqlSugarCore.csproj index c948284e..81fe397a 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.SqlSugarCore/Yi.Abp.SqlSugarCore.csproj +++ b/Yi.Abp.Net8/src/Yi.Abp.SqlSugarCore/Yi.Abp.SqlSugarCore.csproj @@ -6,6 +6,7 @@ + diff --git a/Yi.Abp.Net8/src/Yi.Abp.SqlSugarCore/YiAbpSqlSugarCoreModule.cs b/Yi.Abp.Net8/src/Yi.Abp.SqlSugarCore/YiAbpSqlSugarCoreModule.cs index 004f7512..6cfd4b59 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.SqlSugarCore/YiAbpSqlSugarCoreModule.cs +++ b/Yi.Abp.Net8/src/Yi.Abp.SqlSugarCore/YiAbpSqlSugarCoreModule.cs @@ -4,6 +4,7 @@ using Yi.Abp.Domain; using Yi.Abp.SqlSugarCore; using Yi.Framework.AuditLogging.SqlSugarCore; using Yi.Framework.Bbs.SqlSugarCore; +using Yi.Framework.CodeGen.SqlSugarCore; using Yi.Framework.Mapster; using Yi.Framework.Rbac.SqlSugarCore; using Yi.Framework.SqlSugarCore; @@ -17,6 +18,7 @@ namespace Yi.Abp.SqlsugarCore typeof(YiFrameworkRbacSqlSugarCoreModule), typeof(YiFrameworkBbsSqlSugarCoreModule), + typeof(YiFrameworkCodeGenSqlSugarCoreModule), typeof(YiFrameworkAuditLoggingSqlSugarCoreModule), typeof(YiFrameworkTenantManagementSqlSugarCoreModule), diff --git a/Yi.Abp.Net8/src/Yi.Abp.Web/Properties/launchSettings.json b/Yi.Abp.Net8/src/Yi.Abp.Web/Properties/launchSettings.json index 44097413..8f58fa9b 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.Web/Properties/launchSettings.json +++ b/Yi.Abp.Net8/src/Yi.Abp.Web/Properties/launchSettings.json @@ -5,8 +5,8 @@ "launchBrowser": true, "launchUrl": "swagger", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development", - //"ASPNETCORE_ENVIRONMENT": "Staging" + //"ASPNETCORE_ENVIRONMENT": "Development", + "ASPNETCORE_ENVIRONMENT": "Staging" }, "dotnetRunMessages": true, "applicationUrl": "http://localhost:19001" diff --git a/Yi.RuoYi.Vue3/src/views/code/table/index.vue b/Yi.RuoYi.Vue3/src/views/code/table/index.vue index 8afbd4d9..a3f14c2f 100644 --- a/Yi.RuoYi.Vue3/src/views/code/table/index.vue +++ b/Yi.RuoYi.Vue3/src/views/code/table/index.vue @@ -374,7 +374,8 @@ const handleCodeToWeb = async () => { /** CodeToWeb */ const handleWebToCode = async () => { const response= await webToCode(ids.value); - if(response.statusCode==200) + console.log(response,"response"); + if(response.status==200||response.status==204) { proxy.$modal.msgSuccess("代码生成成功"); }