From 247eae081ce7c325798c6a26a6823c5feec6fc86 Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周日, 04 5月 2025 17:18:43 +0800 Subject: [PATCH] 222 --- Weben_CMS专用代码生成器/Code/MainForm.cs | 15 +++++ Weben_CMS专用代码生成器/Code/Templete/AppService/IAppService模板.txt | 46 +++++++++++++++ Weben_CMS专用代码生成器/Code/Templete/AppService/AppService模板.txt | 19 ++++++ Weben_CMS专用代码生成器/Code/GenerateCode_WeiBen_CMS.csproj | 12 +++- Weben_CMS专用代码生成器/Code/Generate/AppService/AppService_Generate.cs | 27 +++++++++ Weben_CMS专用代码生成器/Code/Generate/AppService/IAppService_Generate.cs | 27 +++++++++ 6 files changed, 143 insertions(+), 3 deletions(-) diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Generate/AppService/AppService_Generate.cs" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Generate/AppService/AppService_Generate.cs" new file mode 100644 index 0000000..96fc72a --- /dev/null +++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Generate/AppService/AppService_Generate.cs" @@ -0,0 +1,27 @@ +锘� + +using GenerateCode_WeiBen_WMS.Model; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace GenerateCode_GEBrilliantFactory +{ + /// <summary> + /// 鐢熸垚鏌ヨ瀹炰綋绫� + /// </summary> + public class AppService_Generate : BaseGenerate + { + public static string CreateText(GenerateCodeParam param) + { + var str = TextHelper.ReadText(@"Templete\AppService\AppService妯℃澘.txt"); + CommonReplace(ref str); + + CommonHelper.CommonReplaceStr(param, ref str); + + + return str; + } + } +} diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Generate/AppService/IAppService_Generate.cs" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Generate/AppService/IAppService_Generate.cs" new file mode 100644 index 0000000..11d40a4 --- /dev/null +++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Generate/AppService/IAppService_Generate.cs" @@ -0,0 +1,27 @@ +锘� + +using GenerateCode_WeiBen_WMS.Model; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace GenerateCode_GEBrilliantFactory +{ + /// <summary> + /// 鐢熸垚鏌ヨ瀹炰綋绫� + /// </summary> + public class IAppService_Generate : BaseGenerate + { + public static string CreateText(GenerateCodeParam param) + { + var str = TextHelper.ReadText(@"Templete\AppService\IAppService妯℃澘.txt"); + CommonReplace(ref str); + + CommonHelper.CommonReplaceStr(param, ref str); + + + return str; + } + } +} diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/GenerateCode_WeiBen_CMS.csproj" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/GenerateCode_WeiBen_CMS.csproj" index ce71fc2..4d0bec6 100644 --- "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/GenerateCode_WeiBen_CMS.csproj" +++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/GenerateCode_WeiBen_CMS.csproj" @@ -106,6 +106,8 @@ <Compile Include="DataBaseFactory\DataBaseServiceFactory.cs" /> <Compile Include="DataBaseFactory\Default\SqlServerDataBaseServiceHandle.cs" /> <Compile Include="DataBaseFactory\Default\MySqlDataBaseServiceHandle.cs" /> + <Compile Include="Generate\AppService\AppService_Generate.cs" /> + <Compile Include="Generate\AppService\IAppService_Generate.cs" /> <Compile Include="Generate\BaseGenerate.cs" /> <Compile Include="Generate\Controller\Controller_Generate.cs" /> <Compile Include="Generate\Entity\AddModel_Generate.cs" /> @@ -191,6 +193,12 @@ </ItemGroup> <ItemGroup> <Content Include="Robot.ico" /> + <Content Include="Templete\AppService\AppService妯℃澘.txt"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Content> + <Content Include="Templete\AppService\IAppService妯℃澘.txt"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Content> <Content Include="Templete\Controller妯℃澘.txt"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> @@ -265,9 +273,7 @@ </Content> <Content Include="甯哥敤.txt" /> </ItemGroup> - <ItemGroup> - <Folder Include="Generate\AppService\" /> - </ItemGroup> + <ItemGroup /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/MainForm.cs" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/MainForm.cs" index 369e292..97ce64e 100644 --- "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/MainForm.cs" +++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/MainForm.cs" @@ -219,6 +219,21 @@ #endregion + #region AppSerivice + + //8銆佺敓鎴� IAppService 鏂囦欢 + var appServiceFilePath = tbPath.Text + @"\server\src\CMS.Plugin." + tb_WCF_NameSpacePath.Text.Trim() + @".Application.Contracts\Services"; + str_generate = IAppService_Generate.CreateText(param); + tf = TextHelper.Export2File_V2(appServiceFilePath, $"I{param.EntityName}AppService.cs", tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo); + + //9銆佺敓鎴� AppService 鏂囦欢 + appServiceFilePath = tbPath.Text + @"\server\src\CMS.Plugin." + tb_WCF_NameSpacePath.Text.Trim() + @".Application\Implements"; + str_generate = AppService_Generate.CreateText(param); + tf = TextHelper.Export2File_V2(appServiceFilePath, $"I{param.EntityName}AppService.cs", tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo); + + + #endregion + ////鐢熸垚 OutputModel 鏂囦欢 //str_generate = OutputModel_Generate.CreateQueryModelLText(modulelogo, chinaComment, columnList, entityName); diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Templete/AppService/AppService\346\250\241\346\235\277.txt" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Templete/AppService/AppService\346\250\241\346\235\277.txt" new file mode 100644 index 0000000..27e202b --- /dev/null +++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Templete/AppService/AppService\346\250\241\346\235\277.txt" @@ -0,0 +1,19 @@ +using CMS.Plugin.$NameSpacePath$.Domain.Shared.Enums; +using Volo.Abp.Application.Dtos; + +namespace CMS.Plugin.$NameSpacePath$.Application.Contracts.Dtos.$EntityName$; + +/// <summary> +/// $ChinaComment$创建或更新基类 +/// </summary> +public abstract class $EntityName$CreateOrUpdateDtoBase : ExtensibleEntityDto +{ + $AddAttributes$ + + /// <summary> + /// Initializes a new instance of the <see cref="$EntityName$CreateOrUpdateDtoBase"/> class. + /// </summary> + public $EntityName$CreateOrUpdateDtoBase() : base(false) + { + } +} diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Templete/AppService/IAppService\346\250\241\346\235\277.txt" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Templete/AppService/IAppService\346\250\241\346\235\277.txt" new file mode 100644 index 0000000..44ebadb --- /dev/null +++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Templete/AppService/IAppService\346\250\241\346\235\277.txt" @@ -0,0 +1,46 @@ +using CMS.Plugin.$NameSpacePath$.Application.Contracts.Dtos.$EntityName$s; +using Volo.Abp.Application.Services; + +namespace CMS.Plugin.$NameSpacePath$.Application.Contracts.Services; + +/// <summary> +/// $ChinaComment$应用服务接口 +/// </summary> +public interface I$EntityName$AppService : ICrudAppService<$EntityName$Dto, Guid, Get$EntityName$Input, $EntityName$CreateDto, $EntityName$UpdateDto> +{ + /// <summary> + /// 克隆$ChinaComment$ + /// </summary> + /// <param name="ids"></param> + /// <returns></returns> + Task<List<$EntityName$Dto>> CloneAsync(IEnumerable<Guid> ids); + + /// <summary> + /// 删除$ChinaComment$ + /// </summary> + /// <param name="ids"></param> + /// <returns></returns> + Task DeleteManyAsync(IEnumerable<Guid> ids); + + /// <summary> + /// 调整排序$ChinaComment$ + /// </summary> + /// <param name="id"></param> + /// <param name="sort"></param> + /// <returns></returns> + Task AdjustSortAsync(Guid id, int sort); + + /// <summary> + /// 导入$ChinaComment$ + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + Task ImportAsync($EntityName$sImportModel input); + + /// <summary> + /// 导出$ChinaComment$ + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + Task<(Dictionary<string, object> Sheets, string FileName)> ExportAsync(Get$EntityName$Input input); +} -- Gitblit v1.9.3