├── .gitattributes ├── .gitignore ├── CodeGenerator.sln ├── README.md ├── build └── module.build.targets ├── src ├── Directory.Build.props ├── Library │ ├── Application │ │ ├── Application.csproj │ │ ├── ClassService │ │ │ ├── ClassService.cs │ │ │ ├── IClassService.cs │ │ │ ├── ViewModels │ │ │ │ ├── ClassAddModel.cs │ │ │ │ ├── ClassMethodModel.cs │ │ │ │ └── ClassUpdateModel.cs │ │ │ └── _MapperConfig.cs │ │ ├── EnumItemService │ │ │ ├── EnumItemService.cs │ │ │ ├── IEnumItemService.cs │ │ │ ├── ViewModels │ │ │ │ ├── EnumItemAddModel.cs │ │ │ │ └── EnumItemUpdateModel.cs │ │ │ └── _MapperConfig.cs │ │ ├── EnumService │ │ │ ├── EnumService.cs │ │ │ ├── IEnumService.cs │ │ │ ├── ViewModels │ │ │ │ ├── EnumAddModel.cs │ │ │ │ └── EnumUpdateModel.cs │ │ │ └── _MapperConfig.cs │ │ ├── ModelPropertyService │ │ │ ├── IModelPropertyService.cs │ │ │ ├── ModelPropertyService.cs │ │ │ ├── ViewModels │ │ │ │ ├── ModelPropertyAddModel.cs │ │ │ │ ├── ModelPropertyBaseModel.cs │ │ │ │ ├── ModelPropertyImportModel.cs │ │ │ │ ├── ModelPropertyUpdateModel.cs │ │ │ │ └── ModelPropertyUpdateNullableModel.cs │ │ │ └── _MapperConfig.cs │ │ ├── ModuleService │ │ │ ├── IModuleService.cs │ │ │ ├── ModuleService.cs │ │ │ ├── ResultModels │ │ │ │ └── ModuleBuildCodeResultModel.cs │ │ │ ├── ViewModels │ │ │ │ ├── ModuleAddModel.cs │ │ │ │ ├── ModuleBuildCodeModel.cs │ │ │ │ └── ModuleUpdateModel.cs │ │ │ └── _MapperConfig.cs │ │ ├── OnlineModuleService │ │ │ ├── IOnlineModuleService.cs │ │ │ ├── OnlineModuleService.cs │ │ │ ├── ViewModels │ │ │ │ ├── OnlineModuleAddModel.cs │ │ │ │ └── OnlineModuleUpdateModel.cs │ │ │ └── _MapperConfig.cs │ │ └── PropertyService │ │ │ ├── IPropertyService.cs │ │ │ ├── PropertyService.cs │ │ │ ├── ViewModels │ │ │ ├── PropertyAddModel.cs │ │ │ ├── PropertyBaseModel.cs │ │ │ ├── PropertyUpdateModel.cs │ │ │ ├── PropertyUpdateNullableModel.cs │ │ │ └── PropertyUpdateShowInListModel.cs │ │ │ └── _MapperConfig.cs │ ├── Domain │ │ ├── Class │ │ │ ├── ActionType.cs │ │ │ ├── BaseEntityType.cs │ │ │ ├── ClassEntity.Extend.cs │ │ │ ├── ClassEntity.cs │ │ │ ├── IClassRepository.cs │ │ │ └── Models │ │ │ │ └── ClassQueryModel.cs │ │ ├── ClassMethod │ │ │ ├── ClassMethodEntity.cs │ │ │ └── IClassMethodRepository.cs │ │ ├── Domain.csproj │ │ ├── Enum │ │ │ ├── EnumEntity.cs │ │ │ ├── IEnumRepository.cs │ │ │ └── Models │ │ │ │ └── EnumQueryModel.cs │ │ ├── EnumItem │ │ │ ├── EnumItemEntity.cs │ │ │ ├── IEnumItemRepository.cs │ │ │ └── Models │ │ │ │ └── EnumItemQueryModel.cs │ │ ├── ModelProperty │ │ │ ├── IModelPropertyRepository.cs │ │ │ ├── ModelPropertyEntity.Extend.cs │ │ │ ├── ModelPropertyEntity.cs │ │ │ ├── ModelType.cs │ │ │ └── Models │ │ │ │ └── ModelPropertyQueryModel.cs │ │ ├── Module │ │ │ ├── IModuleRepository.cs │ │ │ ├── Models │ │ │ │ └── ModuleQueryModel.cs │ │ │ ├── ModuleEntity.Extend.cs │ │ │ └── ModuleEntity.cs │ │ ├── OnlineModule │ │ │ ├── IOnlineModuleRepository.cs │ │ │ ├── Models │ │ │ │ └── OnlineModuleQueryModel.cs │ │ │ ├── OnlineModuleEntity.Extend.cs │ │ │ └── OnlineModuleEntity.cs │ │ └── Property │ │ │ ├── IPropertyRepository.cs │ │ │ ├── Models │ │ │ └── PropertyQueryModel.cs │ │ │ ├── PropertyEntity.Extend.cs │ │ │ ├── PropertyEntity.cs │ │ │ └── PropertyType.cs │ └── Infrastructure │ │ ├── BaseEntityPropertyCollection.cs │ │ ├── CodeGeneratorConfig.cs │ │ ├── Infrastructure.csproj │ │ ├── NuGet │ │ ├── NuGetPackageVersions.cs │ │ └── NugetHelper.cs │ │ ├── Repositories │ │ ├── CodeGeneratorDbContext.cs │ │ ├── MySql │ │ │ ├── ClassMethodRepository.cs │ │ │ ├── ClassRepository.cs │ │ │ ├── EnumItemRepository.cs │ │ │ ├── EnumRepository.cs │ │ │ ├── ModelPropertyRepository.cs │ │ │ ├── ModuleRepository.cs │ │ │ ├── OnlineModuleRepository.cs │ │ │ └── PropertyRepository.cs │ │ ├── PostgreSQL │ │ │ ├── ClassMethodRepository.cs │ │ │ ├── ClassRepository.cs │ │ │ ├── EnumItemRepository.cs │ │ │ ├── EnumRepository.cs │ │ │ ├── ModelPropertyRepository.cs │ │ │ ├── ModuleRepository.cs │ │ │ ├── OnlineModuleRepository.cs │ │ │ └── PropertyRepository.cs │ │ ├── SQLite │ │ │ ├── ClassMethodRepository.cs │ │ │ ├── ClassRepository.cs │ │ │ ├── EnumItemRepository.cs │ │ │ ├── EnumRepository.cs │ │ │ ├── ModelPropertyRepository.cs │ │ │ ├── ModuleRepository.cs │ │ │ ├── OnlineModuleRepository.cs │ │ │ └── PropertyRepository.cs │ │ └── SqlServer │ │ │ ├── ClassMethodRepository.cs │ │ │ ├── ClassRepository.cs │ │ │ ├── EnumItemRepository.cs │ │ │ ├── EnumRepository.cs │ │ │ ├── ModelPropertyRepository.cs │ │ │ ├── ModuleRepository.cs │ │ │ ├── OnlineModuleRepository.cs │ │ │ └── PropertyRepository.cs │ │ └── Templates │ │ ├── Default │ │ ├── DefaultTemplateBuilder.cs │ │ └── T4 │ │ │ ├── Gitattributes.Extend.cs │ │ │ ├── Gitattributes.cs │ │ │ ├── Gitattributes.tt │ │ │ ├── Gitignore.Extend.cs │ │ │ ├── Gitignore.cs │ │ │ ├── Gitignore.tt │ │ │ ├── Readme.Extend.cs │ │ │ ├── Readme.cs │ │ │ ├── Readme.tt │ │ │ ├── Solution.Extend.cs │ │ │ ├── Solution.cs │ │ │ ├── Solution.tt │ │ │ ├── build │ │ │ ├── ModuleBuildTargets.Extend.cs │ │ │ ├── ModuleBuildTargets.cs │ │ │ └── ModuleBuildTargets.tt │ │ │ └── src │ │ │ ├── DirectoryBuildProps.Extend.cs │ │ │ ├── DirectoryBuildProps.cs │ │ │ ├── DirectoryBuildProps.tt │ │ │ ├── Library │ │ │ ├── Application │ │ │ │ ├── Csproj.Extend.cs │ │ │ │ ├── Csproj.cs │ │ │ │ ├── Csproj.tt │ │ │ │ ├── MapperConfig.Extend.cs │ │ │ │ ├── MapperConfig.cs │ │ │ │ ├── MapperConfig.tt │ │ │ │ ├── ServiceImpl.Extend.cs │ │ │ │ ├── ServiceImpl.cs │ │ │ │ ├── ServiceImpl.tt │ │ │ │ ├── ServiceInterface.Extend.cs │ │ │ │ ├── ServiceInterface.cs │ │ │ │ ├── ServiceInterface.tt │ │ │ │ └── ViewModels │ │ │ │ │ ├── AddModel.Extend.cs │ │ │ │ │ ├── AddModel.cs │ │ │ │ │ ├── AddModel.tt │ │ │ │ │ ├── UpdateModel.Extend.cs │ │ │ │ │ ├── UpdateModel.cs │ │ │ │ │ └── UpdateModel.tt │ │ │ ├── Domain │ │ │ │ ├── Csproj.Extend.cs │ │ │ │ ├── Csproj.cs │ │ │ │ ├── Csproj.tt │ │ │ │ ├── Entity.Extend.cs │ │ │ │ ├── Entity.cs │ │ │ │ ├── Entity.tt │ │ │ │ ├── EntityEnum.Extend.cs │ │ │ │ ├── EntityEnum.cs │ │ │ │ ├── EntityEnum.tt │ │ │ │ ├── EntityExtend.Extend.cs │ │ │ │ ├── EntityExtend.cs │ │ │ │ ├── EntityExtend.tt │ │ │ │ ├── Models │ │ │ │ │ ├── QueryModel.Extend.cs │ │ │ │ │ ├── QueryModel.cs │ │ │ │ │ └── QueryModel.tt │ │ │ │ ├── Repository.Extend.cs │ │ │ │ ├── Repository.cs │ │ │ │ └── Repository.tt │ │ │ └── Infrastructure │ │ │ │ ├── Config.Extend.cs │ │ │ │ ├── Config.cs │ │ │ │ ├── Config.tt │ │ │ │ ├── Csproj.Extend.cs │ │ │ │ ├── Csproj.cs │ │ │ │ ├── Csproj.tt │ │ │ │ ├── ModuleServicesConfigurator.Extend.cs │ │ │ │ ├── ModuleServicesConfigurator.cs │ │ │ │ ├── ModuleServicesConfigurator.tt │ │ │ │ └── Repositories │ │ │ │ ├── DbContext.Extend.cs │ │ │ │ ├── DbContext.cs │ │ │ │ ├── DbContext.tt │ │ │ │ ├── MySqlRepository.Extend.cs │ │ │ │ ├── MySqlRepository.cs │ │ │ │ ├── MySqlRepository.tt │ │ │ │ ├── PostgreSQLRepository.Extend.cs │ │ │ │ ├── PostgreSQLRepository.cs │ │ │ │ ├── PostgreSQLRepository.tt │ │ │ │ ├── SQLiteRepository.Extend.cs │ │ │ │ ├── SQLiteRepository.cs │ │ │ │ ├── SQLiteRepository.tt │ │ │ │ ├── SqlServerRepository.Extend.cs │ │ │ │ ├── SqlServerRepository.cs │ │ │ │ └── SqlServerRepository.tt │ │ │ ├── UI │ │ │ └── App │ │ │ │ ├── BabelConfig.Extend.cs │ │ │ │ ├── BabelConfig.cs │ │ │ │ ├── BabelConfig.tt │ │ │ │ ├── Browserslistrc.Extend.cs │ │ │ │ ├── Browserslistrc.cs │ │ │ │ ├── Browserslistrc.tt │ │ │ │ ├── Eslintrc.Extend.cs │ │ │ │ ├── Eslintrc.cs │ │ │ │ ├── Eslintrc.tt │ │ │ │ ├── Package.Extend.cs │ │ │ │ ├── Package.cs │ │ │ │ ├── Package.tt │ │ │ │ ├── PostcssConfig.Extend.cs │ │ │ │ ├── PostcssConfig.cs │ │ │ │ ├── PostcssConfig.tt │ │ │ │ ├── Prettierrc.Extend.cs │ │ │ │ ├── Prettierrc.cs │ │ │ │ ├── Prettierrc.tt │ │ │ │ ├── VueConfig.Extend.cs │ │ │ │ ├── VueConfig.cs │ │ │ │ ├── VueConfig.tt │ │ │ │ ├── src │ │ │ │ ├── Index.Extend.cs │ │ │ │ ├── Index.cs │ │ │ │ ├── Index.tt │ │ │ │ ├── Main.Extend.cs │ │ │ │ ├── Main.cs │ │ │ │ ├── Main.tt │ │ │ │ ├── Module.Extend.cs │ │ │ │ ├── Module.cs │ │ │ │ ├── Module.tt │ │ │ │ ├── api │ │ │ │ │ ├── Index.Extend.cs │ │ │ │ │ ├── Index.cs │ │ │ │ │ ├── Index.tt │ │ │ │ │ └── components │ │ │ │ │ │ ├── Entity.Extend.cs │ │ │ │ │ │ ├── Entity.cs │ │ │ │ │ │ └── Entity.tt │ │ │ │ ├── components │ │ │ │ │ ├── Components.Extend.cs │ │ │ │ │ ├── Components.cs │ │ │ │ │ ├── Components.tt │ │ │ │ │ ├── ConfigPage.Extend.cs │ │ │ │ │ ├── ConfigPage.cs │ │ │ │ │ └── ConfigPage.tt │ │ │ │ ├── config │ │ │ │ │ ├── Config.Extend.cs │ │ │ │ │ ├── Config.cs │ │ │ │ │ └── Config.tt │ │ │ │ ├── routes │ │ │ │ │ ├── Routes.Extend.cs │ │ │ │ │ ├── Routes.cs │ │ │ │ │ └── Routes.tt │ │ │ │ ├── store │ │ │ │ │ ├── Store.Extend.cs │ │ │ │ │ ├── Store.cs │ │ │ │ │ └── Store.tt │ │ │ │ └── views │ │ │ │ │ ├── components │ │ │ │ │ ├── SavePage.Extend.cs │ │ │ │ │ ├── SavePage.cs │ │ │ │ │ └── SavePage.tt │ │ │ │ │ └── index │ │ │ │ │ ├── Cols.Extend.cs │ │ │ │ │ ├── Cols.cs │ │ │ │ │ ├── Cols.tt │ │ │ │ │ ├── Index.Extend.cs │ │ │ │ │ ├── Index.cs │ │ │ │ │ ├── Index.tt │ │ │ │ │ ├── Page.Extend.cs │ │ │ │ │ ├── Page.cs │ │ │ │ │ └── Page.tt │ │ │ │ └── vscode │ │ │ │ ├── settings.Extend.cs │ │ │ │ ├── settings.cs │ │ │ │ └── settings.tt │ │ │ ├── Web │ │ │ ├── Controllers │ │ │ │ ├── Controller.Extend.cs │ │ │ │ ├── Controller.cs │ │ │ │ └── Controller.tt │ │ │ ├── Csproj.Extend.cs │ │ │ ├── Csproj.cs │ │ │ ├── Csproj.tt │ │ │ ├── ModuleController.Extend.cs │ │ │ ├── ModuleController.cs │ │ │ ├── ModuleController.tt │ │ │ ├── ModuleInitializer.Extend.cs │ │ │ ├── ModuleInitializer.cs │ │ │ └── ModuleInitializer.tt │ │ │ └── WebHost │ │ │ ├── AppSettings.Extend.cs │ │ │ ├── AppSettings.cs │ │ │ ├── AppSettings.tt │ │ │ ├── AppSettingsDevelopment.Extend.cs │ │ │ ├── AppSettingsDevelopment.cs │ │ │ ├── AppSettingsDevelopment.tt │ │ │ ├── Csproj.Extend.cs │ │ │ ├── Csproj.cs │ │ │ ├── Csproj.tt │ │ │ ├── Program.Extend.cs │ │ │ ├── Program.cs │ │ │ ├── Program.tt │ │ │ ├── Properties │ │ │ ├── LaunchSettings.Extend.cs │ │ │ ├── LaunchSettings.cs │ │ │ └── LaunchSettings.tt │ │ │ ├── Startup.Extend.cs │ │ │ ├── Startup.cs │ │ │ └── Startup.tt │ │ ├── ITemplateBuilder.cs │ │ ├── ITemplateHandler.cs │ │ ├── Models │ │ ├── ClassBuildModel.cs │ │ ├── EnumBuildModel.cs │ │ ├── EnumItemBuildModel.cs │ │ ├── ModelPropertyBuildModel.cs │ │ ├── ModuleBuildModel.cs │ │ ├── PropertyBuildModel.cs │ │ └── TemplateBuildModel.cs │ │ └── TemplateBuilderAbstract.cs ├── UI │ └── module-codegenerator │ │ ├── .browserslistrc │ │ ├── .eslintrc.js │ │ ├── .prettierrc │ │ ├── .vscode │ │ └── settings.json │ │ ├── babel.config.js │ │ ├── package.json │ │ ├── postcss.config.js │ │ ├── src │ │ ├── api │ │ │ ├── components │ │ │ │ ├── class.js │ │ │ │ ├── enum.js │ │ │ │ ├── enumItem.js │ │ │ │ ├── modelProperty.js │ │ │ │ ├── module.js │ │ │ │ ├── onlineModule.js │ │ │ │ └── property.js │ │ │ └── index.js │ │ ├── components │ │ │ ├── config-codegenerator │ │ │ │ └── index.vue │ │ │ └── index.js │ │ ├── config │ │ │ └── index.js │ │ ├── index.js │ │ ├── main.js │ │ ├── module.js │ │ ├── routes │ │ │ └── index.js │ │ ├── store │ │ │ └── index.js │ │ └── views │ │ │ ├── class │ │ │ ├── components │ │ │ │ ├── code-preview │ │ │ │ │ └── index.vue │ │ │ │ └── save │ │ │ │ │ └── index.vue │ │ │ └── index │ │ │ │ ├── cols.js │ │ │ │ └── index.vue │ │ │ ├── enum │ │ │ ├── components │ │ │ │ ├── save │ │ │ │ │ └── index.vue │ │ │ │ └── select │ │ │ │ │ └── index.js │ │ │ └── index │ │ │ │ ├── cols.js │ │ │ │ ├── index.vue │ │ │ │ └── page.js │ │ │ ├── enumItem │ │ │ ├── components │ │ │ │ └── save │ │ │ │ │ └── index.vue │ │ │ └── index │ │ │ │ ├── cols.js │ │ │ │ └── index.vue │ │ │ ├── modelProperty │ │ │ ├── components │ │ │ │ ├── add │ │ │ │ │ └── index.vue │ │ │ │ ├── edit │ │ │ │ │ └── index.vue │ │ │ │ ├── import │ │ │ │ │ └── index.vue │ │ │ │ └── list │ │ │ │ │ ├── cols.js │ │ │ │ │ └── index.vue │ │ │ └── index │ │ │ │ └── index.vue │ │ │ ├── module │ │ │ ├── components │ │ │ │ ├── save │ │ │ │ │ └── index.vue │ │ │ │ └── select │ │ │ │ │ └── index.vue │ │ │ └── index │ │ │ │ ├── cols.js │ │ │ │ ├── index.vue │ │ │ │ └── page.js │ │ │ └── property │ │ │ ├── components │ │ │ ├── save │ │ │ │ └── index.vue │ │ │ └── type-select │ │ │ │ └── index.js │ │ │ └── index │ │ │ ├── cols.js │ │ │ └── index.vue │ │ └── vue.config.js ├── Web │ ├── Controllers │ │ ├── ClassController.cs │ │ ├── EnumController.cs │ │ ├── EnumItemController.cs │ │ ├── ModelPropertyController.cs │ │ ├── ModuleController.cs │ │ ├── OnlineModuleController.cs │ │ └── PropertyController.cs │ ├── ModuleController.cs │ ├── ModuleInitializer.cs │ ├── Validators │ │ ├── PropertyAddValidator.cs │ │ └── PropertyUpdateValidator.cs │ └── Web.csproj └── WebHost │ ├── Program.cs │ ├── Properties │ └── launchSettings.json │ ├── Startup.cs │ ├── WebHost.csproj │ ├── _modules │ └── 02_CodeGenerator │ │ └── _module.json │ ├── appsettings.Development.json │ └── appsettings.json └── test └── Infrastructure.Test ├── Infrastructure.Test.csproj └── NugetHelperTest.cs /.gitattributes: -------------------------------------------------------------------------------- 1 | *.sql linguist-language=C# 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NetModular 代码生成器模块 2 | 3 | 该仓储是基于[NetModular](https://github.com/iamoldli/NetModular)框架开发的代码生成器模块。 4 | 5 | # 启动方式 6 | 7 | 进入 UI 目录,执行以下命令 8 | 9 | ``` 10 | npm install #安装包 11 | npm run build #打包 12 | ``` 13 | 14 | 在 VS 中启动 WebHost 或者进入 WebHost 目录执行以下命令 15 | 16 | ``` 17 | dotnet watch run 18 | ``` 19 | 20 | 打开 [http://localhost:6222](http://localhost:6222),输入账户密码 admin/admin 21 | -------------------------------------------------------------------------------- /build/module.build.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | _modules\$(Id)_$(Code) 5 | $(ModulesDir)\_module.json 6 | {"Id": "$(Id)","Name":"$(Name)","Code":"$(Code)","Icon":"$(Icon)","Version":"$(Version)","Description":"$(Description)"} 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 02 4 | CodeGenerator 5 | 代码生成 6 | develop 7 | Oldli 8 | 1.8.3 9 | net9.0 10 | NetModular Module $(Code)($(Name)) - $(MSBuildProjectName) 11 | $(NoWarn);1591 12 | Latest 13 | NetModular.Module.$(Code) 14 | $(RootNamespacePrefix).$(MSBuildProjectName) 15 | $(AssemblyName) 16 | true 17 | true 18 | 19 | $(SolutionDir)\_packages 20 | Oldli 21 | Oldli 22 | https://docs.17mkh.com/ 23 | https://github.com/iamoldli/NetModular.Module.CodeGenerator 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/Library/Application/Application.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/Library/Application/ClassService/ViewModels/ClassAddModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using NetModular.Module.CodeGenerator.Domain.Class; 4 | 5 | namespace NetModular.Module.CodeGenerator.Application.ClassService.ViewModels 6 | { 7 | public class ClassAddModel 8 | { 9 | /// 10 | /// 项目编号 11 | /// 12 | public Guid ModuleId { get; set; } 13 | 14 | /// 15 | /// 类名称 16 | /// 17 | [Required(ErrorMessage = "请输入名称")] 18 | public string Name { get; set; } 19 | 20 | /// 21 | /// 表名称 22 | /// 23 | [Required(ErrorMessage = "请输入表名")] 24 | public string TableName { get; set; } 25 | 26 | /// 27 | /// 基类类型 28 | /// 29 | public BaseEntityType BaseEntityType { get; set; } 30 | 31 | /// 32 | /// 说明 33 | /// 34 | [Required(ErrorMessage = "请输入类名")] 35 | public string Remarks { get; set; } 36 | 37 | /// 38 | /// 菜单图标 39 | /// 40 | public string MenuIcon { get; set; } 41 | 42 | /// 43 | /// 方法 44 | /// 45 | public ClassMethodModel Method { get; set; } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Library/Application/ClassService/ViewModels/ClassMethodModel.cs: -------------------------------------------------------------------------------- 1 | namespace NetModular.Module.CodeGenerator.Application.ClassService.ViewModels 2 | { 3 | /// 4 | /// 实体方法模型 5 | /// 6 | public class ClassMethodModel 7 | { 8 | /// 9 | /// 查询 10 | /// 11 | public bool Query { get; set; } 12 | 13 | /// 14 | /// 添加 15 | /// 16 | public bool Add { get; set; } 17 | 18 | /// 19 | /// 删除 20 | /// 21 | public bool Delete { get; set; } 22 | 23 | /// 24 | /// 编辑 25 | /// 26 | public bool Edit { get; set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Library/Application/ClassService/ViewModels/ClassUpdateModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using NetModular.Module.CodeGenerator.Domain.Class; 4 | 5 | namespace NetModular.Module.CodeGenerator.Application.ClassService.ViewModels 6 | { 7 | public class ClassUpdateModel 8 | { 9 | [Required(ErrorMessage = "请选择要修改的类")] 10 | public Guid Id { get; set; } 11 | 12 | /// 13 | /// 名称 14 | /// 15 | [Required(ErrorMessage = "请输入名称")] 16 | public string Name { get; set; } 17 | 18 | /// 19 | /// 表名称 20 | /// 21 | [Required(ErrorMessage = "请输入表名")] 22 | public string TableName { get; set; } 23 | 24 | /// 25 | /// 说明 26 | /// 27 | [Required(ErrorMessage = "请输入类名")] 28 | public string Remarks { get; set; } 29 | 30 | /// 31 | /// 菜单图标 32 | /// 33 | public string MenuIcon { get; set; } 34 | 35 | /// 36 | /// 基类类型 37 | /// 38 | public BaseEntityType BaseEntityType { get; set; } 39 | 40 | /// 41 | /// 方法 42 | /// 43 | public ClassMethodModel Method { get; set; } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Library/Application/ClassService/_MapperConfig.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using NetModular.Lib.Mapper.AutoMapper; 3 | using NetModular.Module.CodeGenerator.Application.ClassService.ViewModels; 4 | using NetModular.Module.CodeGenerator.Domain.Class; 5 | using NetModular.Module.CodeGenerator.Domain.ClassMethod; 6 | 7 | namespace NetModular.Module.CodeGenerator.Application.ClassService 8 | { 9 | public class MapperConfig : IMapperConfig 10 | { 11 | public void Bind(IMapperConfigurationExpression cfg) 12 | { 13 | cfg.CreateMap(); 14 | cfg.CreateMap(); 15 | cfg.CreateMap(); 16 | 17 | cfg.CreateMap(); 18 | cfg.CreateMap(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Library/Application/EnumItemService/ViewModels/EnumItemAddModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace NetModular.Module.CodeGenerator.Application.EnumItemService.ViewModels 5 | { 6 | public class EnumItemAddModel 7 | { 8 | /// 9 | /// 所属枚举编号 10 | /// 11 | [Required(ErrorMessage = "请选择枚举")] 12 | public Guid EnumId { get; set; } 13 | 14 | /// 15 | /// 名称 16 | /// 17 | [Required(ErrorMessage = "请输入名称")] 18 | public string Name { get; set; } 19 | 20 | /// 21 | /// 值 22 | /// 23 | [Required(ErrorMessage = "请输入值")] 24 | public int Value { get; set; } 25 | 26 | /// 27 | /// 备注 28 | /// 29 | [Required(ErrorMessage = "请输入备注")] 30 | public string Remarks { get; set; } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Library/Application/EnumItemService/ViewModels/EnumItemUpdateModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace NetModular.Module.CodeGenerator.Application.EnumItemService.ViewModels 5 | { 6 | public class EnumItemUpdateModel 7 | { 8 | [Required(ErrorMessage = "请选择数据")] 9 | public Guid Id { get; set; } 10 | 11 | /// 12 | /// 名称 13 | /// 14 | [Required(ErrorMessage = "请输入名称")] 15 | public string Name { get; set; } 16 | 17 | /// 18 | /// 值 19 | /// 20 | [Required(ErrorMessage = "请输入值")] 21 | public int Value { get; set; } 22 | 23 | /// 24 | /// 备注 25 | /// 26 | [Required(ErrorMessage = "请输入备注")] 27 | public string Remarks { get; set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Library/Application/EnumItemService/_MapperConfig.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using NetModular.Lib.Mapper.AutoMapper; 3 | using NetModular.Module.CodeGenerator.Application.EnumItemService.ViewModels; 4 | using NetModular.Module.CodeGenerator.Domain.EnumItem; 5 | 6 | namespace NetModular.Module.CodeGenerator.Application.EnumItemService 7 | { 8 | public class MapperConfig : IMapperConfig 9 | { 10 | public void Bind(IMapperConfigurationExpression cfg) 11 | { 12 | cfg.CreateMap(); 13 | cfg.CreateMap(); 14 | cfg.CreateMap(); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Library/Application/EnumService/IEnumService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using NetModular.Module.CodeGenerator.Application.EnumService.ViewModels; 4 | using NetModular.Module.CodeGenerator.Domain.Enum.Models; 5 | 6 | namespace NetModular.Module.CodeGenerator.Application.EnumService 7 | { 8 | /// 9 | /// 枚举服务接口 10 | /// 11 | public interface IEnumService 12 | { 13 | /// 14 | /// 查询 15 | /// 16 | /// 17 | /// 18 | Task Query(EnumQueryModel model); 19 | 20 | /// 21 | /// 创建 22 | /// 23 | /// 24 | /// 25 | Task Add(EnumAddModel model); 26 | 27 | /// 28 | /// 删除 29 | /// 30 | /// 编号 31 | /// 32 | Task Delete(Guid id); 33 | 34 | /// 35 | /// 编辑 36 | /// 37 | /// 38 | /// 39 | Task Edit(Guid id); 40 | 41 | /// 42 | /// 修改 43 | /// 44 | /// 45 | /// 46 | Task Update(EnumUpdateModel model); 47 | 48 | /// 49 | /// 下拉列表 50 | /// 51 | /// 52 | Task Select(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Library/Application/EnumService/ViewModels/EnumAddModel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace NetModular.Module.CodeGenerator.Application.EnumService.ViewModels 4 | { 5 | /// 6 | /// 添加模型 7 | /// 8 | public class EnumAddModel 9 | { 10 | /// 11 | /// 名称 12 | /// 13 | [Required(ErrorMessage = "请输入名称")] 14 | public string Name { get; set; } 15 | 16 | /// 17 | /// 备注 18 | /// 19 | [Required(ErrorMessage = "请输入备注")] 20 | public string Remarks { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Library/Application/EnumService/ViewModels/EnumUpdateModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace NetModular.Module.CodeGenerator.Application.EnumService.ViewModels 5 | { 6 | public class EnumUpdateModel : EnumAddModel 7 | { 8 | [Required(ErrorMessage = "请选择要修改的枚举")] 9 | public Guid Id { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Library/Application/EnumService/_MapperConfig.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using NetModular.Lib.Mapper.AutoMapper; 3 | using NetModular.Module.CodeGenerator.Application.EnumService.ViewModels; 4 | using NetModular.Module.CodeGenerator.Domain.Enum; 5 | 6 | namespace NetModular.Module.CodeGenerator.Application.EnumService 7 | { 8 | public class MapperConfig : IMapperConfig 9 | { 10 | public void Bind(IMapperConfigurationExpression cfg) 11 | { 12 | cfg.CreateMap(); 13 | cfg.CreateMap(); 14 | cfg.CreateMap(); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Library/Application/ModelPropertyService/ViewModels/ModelPropertyAddModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace NetModular.Module.CodeGenerator.Application.ModelPropertyService.ViewModels 5 | { 6 | public class ModelPropertyAddModel : ModelPropertyBaseModel 7 | { 8 | /// 9 | /// 所属实体 10 | /// 11 | [Required(ErrorMessage = "选择实体")] 12 | public Guid ClassId { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Library/Application/ModelPropertyService/ViewModels/ModelPropertyBaseModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using NetModular.Module.CodeGenerator.Domain.ModelProperty; 4 | using NetModular.Module.CodeGenerator.Domain.Property; 5 | 6 | namespace NetModular.Module.CodeGenerator.Application.ModelPropertyService.ViewModels 7 | { 8 | public class ModelPropertyBaseModel 9 | { 10 | /// 11 | /// 模型类型 12 | /// 13 | [Required(ErrorMessage = "请选择模型类型")] 14 | public ModelType ModelType { get; set; } 15 | 16 | /// 17 | /// 名称 18 | /// 19 | [Required(ErrorMessage = "请输入名称")] 20 | public string Name { get; set; } 21 | 22 | /// 23 | /// 类型 24 | /// 25 | [Required(ErrorMessage = "请选择模型类型")] 26 | public PropertyType Type { get; set; } 27 | 28 | /// 29 | /// 可空 30 | /// 31 | public bool Nullable { get; set; } 32 | 33 | /// 34 | /// 关联枚举 35 | /// 36 | public Guid? EnumId { get; set; } 37 | 38 | /// 39 | /// 备注 40 | /// 41 | [Required(ErrorMessage = "请输入备注")] 42 | public string Remarks { get; set; } 43 | 44 | /// 45 | /// 序号 46 | /// 47 | public int Sort { get; set; } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Library/Application/ModelPropertyService/ViewModels/ModelPropertyImportModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using NetModular.Module.CodeGenerator.Domain.ModelProperty; 5 | 6 | namespace NetModular.Module.CodeGenerator.Application.ModelPropertyService.ViewModels 7 | { 8 | /// 9 | /// 从实体导入模型 10 | /// 11 | public class ModelPropertyImportModel 12 | { 13 | /// 14 | /// 所属实体 15 | /// 16 | [Required(ErrorMessage = "选择实体")] 17 | public Guid ClassId { get; set; } 18 | 19 | /// 20 | /// 模型类型 21 | /// 22 | [Required(ErrorMessage = "请选择模型类型")] 23 | public ModelType ModelType { get; set; } 24 | 25 | /// 26 | /// 序号 27 | /// 28 | public int Sort { get; set; } 29 | 30 | /// 31 | /// 实体属性ID列表 32 | /// 33 | public List Ids { get; set; } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Library/Application/ModelPropertyService/ViewModels/ModelPropertyUpdateModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace NetModular.Module.CodeGenerator.Application.ModelPropertyService.ViewModels 4 | { 5 | public class ModelPropertyUpdateModel : ModelPropertyBaseModel 6 | { 7 | /// 8 | /// 编号 9 | /// 10 | public Guid Id { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Library/Application/ModelPropertyService/ViewModels/ModelPropertyUpdateNullableModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace NetModular.Module.CodeGenerator.Application.ModelPropertyService.ViewModels 5 | { 6 | public class ModelPropertyUpdateNullableModel 7 | { 8 | [Required(ErrorMessage = "请选择属性")] 9 | public Guid Id { get; set; } 10 | 11 | /// 12 | /// 是否可空 13 | /// 14 | public bool Nullable { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Library/Application/ModelPropertyService/_MapperConfig.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using NetModular.Lib.Mapper.AutoMapper; 3 | using NetModular.Module.CodeGenerator.Application.ModelPropertyService.ViewModels; 4 | using NetModular.Module.CodeGenerator.Domain.ModelProperty; 5 | 6 | namespace NetModular.Module.CodeGenerator.Application.ModelPropertyService 7 | { 8 | public class MapperConfig : IMapperConfig 9 | { 10 | public void Bind(IMapperConfigurationExpression cfg) 11 | { 12 | cfg.CreateMap(); 13 | cfg.CreateMap(); 14 | cfg.CreateMap(); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Library/Application/ModuleService/ResultModels/ModuleBuildCodeResultModel.cs: -------------------------------------------------------------------------------- 1 | namespace NetModular.Module.CodeGenerator.Application.ModuleService.ResultModels 2 | { 3 | /// 4 | /// 项目生成代码返回模型 5 | /// 6 | public class ModuleBuildCodeResultModel 7 | { 8 | public string Id { get; set; } 9 | 10 | public string Name { get; set; } 11 | 12 | /// 13 | /// 压缩文件路径 14 | /// 15 | public string ZipPath { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Library/Application/ModuleService/ViewModels/ModuleAddModel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace NetModular.Module.CodeGenerator.Application.ModuleService.ViewModels 4 | { 5 | /// 6 | /// 添加模块 7 | /// 8 | public class ModuleAddModel 9 | { 10 | /// 11 | /// 名称 12 | /// 13 | [Required(ErrorMessage = "请输入名称")] 14 | public string Name { get; set; } 15 | 16 | /// 17 | /// 编号 18 | /// 19 | [Range(0, 59315, ErrorMessage = "编码在 0 到 59315 之间")] 20 | public int No { get; set; } 21 | 22 | /// 23 | /// 编码 24 | /// 25 | [Required(ErrorMessage = "请输入编码")] 26 | public string Code { get; set; } 27 | 28 | /// 29 | /// 图标 30 | /// 31 | [Required(ErrorMessage = "请选择图标")] 32 | public string Icon { get; set; } 33 | 34 | /// 35 | /// 版权声明 36 | /// 37 | public string Copyright { get; set; } 38 | 39 | /// 40 | /// 公司单位 41 | /// 42 | public string Company { get; set; } 43 | 44 | /// 45 | /// 官方地址 46 | /// 47 | public string ProjectUrl { get; set; } 48 | 49 | /// 50 | /// 仓库地址 51 | /// 52 | public string RepositoryUrl { get; set; } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Library/Application/ModuleService/ViewModels/ModuleBuildCodeModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace NetModular.Module.CodeGenerator.Application.ModuleService.ViewModels 5 | { 6 | /// 7 | /// 生成代码模型 8 | /// 9 | public class ModuleBuildCodeModel 10 | { 11 | /// 12 | /// 项目编号 13 | /// 14 | [Required(ErrorMessage = "请选择项目")] 15 | public Guid Id { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Library/Application/ModuleService/ViewModels/ModuleUpdateModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace NetModular.Module.CodeGenerator.Application.ModuleService.ViewModels 5 | { 6 | /// 7 | /// 项目编辑 8 | /// 9 | public class ModuleUpdateModel : ModuleAddModel 10 | { 11 | /// 12 | /// 编号 13 | /// 14 | [Required(ErrorMessage = "请选择模块")] 15 | public Guid Id { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Library/Application/ModuleService/_MapperConfig.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using NetModular.Lib.Mapper.AutoMapper; 3 | using NetModular.Module.CodeGenerator.Application.ModuleService.ViewModels; 4 | using NetModular.Module.CodeGenerator.Domain.Class; 5 | using NetModular.Module.CodeGenerator.Domain.ModelProperty; 6 | using NetModular.Module.CodeGenerator.Domain.Module; 7 | using NetModular.Module.CodeGenerator.Domain.Property; 8 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 9 | 10 | namespace NetModular.Module.CodeGenerator.Application.ModuleService 11 | { 12 | public class MapperConfig : IMapperConfig 13 | { 14 | public void Bind(IMapperConfigurationExpression cfg) 15 | { 16 | cfg.CreateMap(); 17 | cfg.CreateMap(); 18 | cfg.CreateMap(); 19 | 20 | //代码生成 21 | cfg.CreateMap(); 22 | cfg.CreateMap(); 23 | cfg.CreateMap(); 24 | cfg.CreateMap(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Library/Application/OnlineModuleService/IOnlineModuleService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using NetModular.Module.CodeGenerator.Application.OnlineModuleService.ViewModels; 4 | using NetModular.Module.CodeGenerator.Domain.OnlineModule.Models; 5 | 6 | namespace NetModular.Module.CodeGenerator.Application.OnlineModuleService 7 | { 8 | /// 9 | /// 在线模块服务 10 | /// 11 | public interface IOnlineModuleService 12 | { 13 | /// 14 | /// 查询 15 | /// 16 | /// 17 | /// 18 | Task Query(OnlineModuleQueryModel model); 19 | 20 | /// 21 | /// 创建 22 | /// 23 | /// 24 | /// 25 | Task Add(OnlineModuleAddModel model); 26 | 27 | /// 28 | /// 删除 29 | /// 30 | /// 编号 31 | /// 32 | Task Delete(Guid id); 33 | 34 | /// 35 | /// 编辑 36 | /// 37 | /// 38 | /// 39 | Task Edit(Guid id); 40 | 41 | /// 42 | /// 修改 43 | /// 44 | /// 45 | /// 46 | Task Update(OnlineModuleUpdateModel model); 47 | 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Library/Application/OnlineModuleService/ViewModels/OnlineModuleAddModel.cs: -------------------------------------------------------------------------------- 1 | namespace NetModular.Module.CodeGenerator.Application.OnlineModuleService.ViewModels 2 | { 3 | /// 4 | /// 在线模块添加模型 5 | /// 6 | public class OnlineModuleAddModel 7 | { 8 | /// 9 | /// 名称 10 | /// 11 | public string Name { get; set; } 12 | 13 | /// 14 | /// 编码 15 | /// 16 | public string Code { get; set; } 17 | 18 | /// 19 | /// 图标 20 | /// 21 | public string Icon { get; set; } 22 | 23 | /// 24 | /// 介绍说明 25 | /// 26 | public string Description { get; set; } 27 | 28 | /// 29 | /// NuGet包ID 30 | /// 31 | public string NuGetId { get; set; } 32 | 33 | /// 34 | /// NPM包ID 35 | /// 36 | public string NpmId { get; set; } 37 | 38 | /// 39 | /// 公司名称 40 | /// 41 | public string Company { get; set; } 42 | 43 | /// 44 | /// 项目地址 45 | /// 46 | public string ProjectUrl { get; set; } 47 | 48 | /// 49 | /// 仓库地址 50 | /// 51 | public string RepositoryUrl { get; set; } 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Library/Application/OnlineModuleService/ViewModels/OnlineModuleUpdateModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace NetModular.Module.CodeGenerator.Application.OnlineModuleService.ViewModels 5 | { 6 | /// 7 | /// 在线模块添加模型 8 | /// 9 | public class OnlineModuleUpdateModel : OnlineModuleAddModel 10 | { 11 | [Required(ErrorMessage = "请选择要修改的在线模块")] 12 | public Guid Id { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Library/Application/OnlineModuleService/_MapperConfig.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using NetModular.Lib.Mapper.AutoMapper; 3 | using NetModular.Module.CodeGenerator.Application.OnlineModuleService.ViewModels; 4 | using NetModular.Module.CodeGenerator.Domain.OnlineModule; 5 | 6 | namespace NetModular.Module.CodeGenerator.Application.OnlineModuleService 7 | { 8 | public class MapperConfig : IMapperConfig 9 | { 10 | public void Bind(IMapperConfigurationExpression cfg) 11 | { 12 | cfg.CreateMap(); 13 | cfg.CreateMap(); 14 | cfg.CreateMap(); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Library/Application/PropertyService/ViewModels/PropertyAddModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace NetModular.Module.CodeGenerator.Application.PropertyService.ViewModels 5 | { 6 | public class PropertyAddModel : PropertyBaseModel 7 | { 8 | /// 9 | /// 类编号 10 | /// 11 | [Required(ErrorMessage = "请选择类")] 12 | public Guid ClassId { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Library/Application/PropertyService/ViewModels/PropertyUpdateModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace NetModular.Module.CodeGenerator.Application.PropertyService.ViewModels 5 | { 6 | public class PropertyUpdateModel : PropertyBaseModel 7 | { 8 | [Required(ErrorMessage = "请选择要编辑的属性")] 9 | public Guid Id { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Library/Application/PropertyService/ViewModels/PropertyUpdateNullableModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace NetModular.Module.CodeGenerator.Application.PropertyService.ViewModels 5 | { 6 | public class PropertyUpdateNullableModel 7 | { 8 | [Required(ErrorMessage = "请选择属性")] 9 | public Guid Id { get; set; } 10 | 11 | /// 12 | /// 是否可空 13 | /// 14 | public bool Nullable { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Library/Application/PropertyService/ViewModels/PropertyUpdateShowInListModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace NetModular.Module.CodeGenerator.Application.PropertyService.ViewModels 5 | { 6 | public class PropertyUpdateShowInListModel 7 | { 8 | [Required(ErrorMessage = "请选择属性")] 9 | public Guid Id { get; set; } 10 | 11 | /// 12 | /// 是否可空 13 | /// 14 | public bool ShowInList { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Library/Application/PropertyService/_MapperConfig.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using NetModular.Lib.Mapper.AutoMapper; 3 | using NetModular.Module.CodeGenerator.Application.PropertyService.ViewModels; 4 | using NetModular.Module.CodeGenerator.Domain.Property; 5 | 6 | namespace NetModular.Module.CodeGenerator.Application.PropertyService 7 | { 8 | public class MapperConfig : IMapperConfig 9 | { 10 | public void Bind(IMapperConfigurationExpression cfg) 11 | { 12 | cfg.CreateMap(); 13 | cfg.CreateMap(); 14 | cfg.CreateMap(); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Library/Domain/Class/ActionType.cs: -------------------------------------------------------------------------------- 1 | namespace NetModular.Module.CodeGenerator.Domain.Class 2 | { 3 | class ActionType 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/Library/Domain/Class/ClassEntity.Extend.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Abstractions.Attributes; 2 | 3 | namespace NetModular.Module.CodeGenerator.Domain.Class 4 | { 5 | public partial class ClassEntity 6 | { 7 | /// 8 | /// 基类名称 9 | /// 10 | [Ignore] 11 | public string BaseEntityName => BaseEntityType.ToDescription(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Library/Domain/Class/ClassEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NetModular.Lib.Data.Abstractions.Attributes; 3 | using NetModular.Lib.Data.Core.Entities.Extend; 4 | 5 | namespace NetModular.Module.CodeGenerator.Domain.Class 6 | { 7 | /// 8 | /// 类信息 9 | /// 10 | [Table("Class")] 11 | public partial class ClassEntity : EntityBase 12 | { 13 | /// 14 | /// 模块ID 15 | /// 16 | public Guid ModuleId { get; set; } 17 | 18 | /// 19 | /// 名称 20 | /// 21 | public string Name { get; set; } 22 | 23 | /// 24 | /// 表名称 25 | /// 26 | public string TableName { get; set; } 27 | 28 | /// 29 | /// 基类类型 30 | /// 31 | public BaseEntityType BaseEntityType { get; set; } 32 | 33 | /// 34 | /// 说明 35 | /// 36 | public string Remarks { get; set; } 37 | 38 | /// 39 | /// 菜单图标 40 | /// 41 | public string MenuIcon { get; set; } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Library/Domain/Class/IClassRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Threading.Tasks; 4 | using NetModular.Lib.Data.Abstractions; 5 | using NetModular.Module.CodeGenerator.Domain.Class.Models; 6 | 7 | namespace NetModular.Module.CodeGenerator.Domain.Class 8 | { 9 | /// 10 | /// 实体信息仓储 11 | /// 12 | public interface IClassRepository : IRepository 13 | { 14 | /// 15 | /// 查询 16 | /// 17 | /// 18 | /// 19 | Task> Query(ClassQueryModel model); 20 | 21 | /// 22 | /// 查询指定模块的所有类列表 23 | /// 24 | /// 25 | /// 26 | Task> QueryAllByModule(Guid moduleId); 27 | 28 | /// 29 | /// 是否存在 30 | /// 31 | /// 32 | Task Exists(ClassEntity entity); 33 | 34 | /// 35 | /// 删除制定模块的所有类 36 | /// 37 | /// 38 | /// 39 | /// 40 | Task DeleteByModule(Guid moduleId, IUnitOfWork uow); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Library/Domain/Class/Models/ClassQueryModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using NetModular.Lib.Data.Query; 4 | 5 | namespace NetModular.Module.CodeGenerator.Domain.Class.Models 6 | { 7 | public class ClassQueryModel : QueryModel 8 | { 9 | /// 10 | /// 所有模块 11 | /// 12 | [Required(ErrorMessage = "选择模块")] 13 | public Guid ModuleId { get; set; } 14 | 15 | /// 16 | /// 名称 17 | /// 18 | public string Name { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Library/Domain/ClassMethod/ClassMethodEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NetModular.Lib.Data.Abstractions.Attributes; 3 | using NetModular.Lib.Data.Core.Entities.Extend; 4 | 5 | namespace NetModular.Module.CodeGenerator.Domain.ClassMethod 6 | { 7 | /// 8 | /// 实体方法 9 | /// 10 | [Table("Class_Method")] 11 | public class ClassMethodEntity : EntityBase 12 | { 13 | /// 14 | /// 实体编号 15 | /// 16 | public Guid ClassId { get; set; } 17 | 18 | /// 19 | /// 查询 20 | /// 21 | public bool Query { get; set; } 22 | 23 | /// 24 | /// 添加 25 | /// 26 | public bool Add { get; set; } 27 | 28 | /// 29 | /// 删除 30 | /// 31 | public bool Delete { get; set; } 32 | 33 | /// 34 | /// 编辑 35 | /// 36 | public bool Edit { get; set; } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Library/Domain/ClassMethod/IClassMethodRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using NetModular.Lib.Data.Abstractions; 4 | 5 | namespace NetModular.Module.CodeGenerator.Domain.ClassMethod 6 | { 7 | public interface IClassMethodRepository : IRepository 8 | { 9 | /// 10 | /// 根据实体删除方法 11 | /// 12 | /// 13 | /// 14 | /// 15 | Task DeleteByClass(Guid classId, IUnitOfWork uow); 16 | 17 | /// 18 | /// 根据实体查询 19 | /// 20 | /// 21 | /// 22 | /// 23 | Task GetByClass(Guid classId, IUnitOfWork uow = null); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Library/Domain/Domain.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Library/Domain/Enum/EnumEntity.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Abstractions.Attributes; 2 | using NetModular.Lib.Data.Core.Entities.Extend; 3 | 4 | namespace NetModular.Module.CodeGenerator.Domain.Enum 5 | { 6 | /// 7 | /// 枚举实体 8 | /// 9 | [Table("Enum")] 10 | public class EnumEntity : EntityBase 11 | { 12 | /// 13 | /// 名称 14 | /// 15 | public string Name { get; set; } 16 | 17 | /// 18 | /// 备注 19 | /// 20 | public string Remarks { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Library/Domain/Enum/IEnumRepository.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | using NetModular.Lib.Data.Abstractions; 4 | using NetModular.Module.CodeGenerator.Domain.Enum.Models; 5 | 6 | namespace NetModular.Module.CodeGenerator.Domain.Enum 7 | { 8 | /// 9 | /// 枚举仓储 10 | /// 11 | public interface IEnumRepository : IRepository 12 | { 13 | /// 14 | /// 查询 15 | /// 16 | /// 17 | /// 18 | Task> Query(EnumQueryModel model); 19 | 20 | /// 21 | /// 是否存在 22 | /// 23 | /// 24 | /// 25 | Task Exists(EnumEntity entity); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Library/Domain/Enum/Models/EnumQueryModel.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Query; 2 | 3 | namespace NetModular.Module.CodeGenerator.Domain.Enum.Models 4 | { 5 | public class EnumQueryModel : QueryModel 6 | { 7 | /// 8 | /// 名称 9 | /// 10 | public string Name { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Library/Domain/EnumItem/EnumItemEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NetModular.Lib.Data.Abstractions.Attributes; 3 | using NetModular.Lib.Data.Core.Entities; 4 | 5 | namespace NetModular.Module.CodeGenerator.Domain.EnumItem 6 | { 7 | /// 8 | /// 枚举项实体 9 | /// 10 | [Table("Enum_Item")] 11 | public class EnumItemEntity : Entity 12 | { 13 | /// 14 | /// 所属枚举编号 15 | /// 16 | public Guid EnumId { get; set; } 17 | 18 | /// 19 | /// 名称 20 | /// 21 | public string Name { get; set; } 22 | 23 | /// 24 | /// 值 25 | /// 26 | public int Value { get; set; } 27 | 28 | /// 29 | /// 备注 30 | /// 31 | [Length(200)] 32 | public string Remarks { get; set; } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Library/Domain/EnumItem/IEnumItemRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Threading.Tasks; 4 | using NetModular.Lib.Data.Abstractions; 5 | using NetModular.Module.CodeGenerator.Domain.EnumItem.Models; 6 | 7 | namespace NetModular.Module.CodeGenerator.Domain.EnumItem 8 | { 9 | /// 10 | /// 枚举项仓储 11 | /// 12 | public interface IEnumItemRepository : IRepository 13 | { 14 | /// 15 | /// 查询 16 | /// 17 | /// 18 | /// 19 | Task> Query(EnumItemQueryModel model); 20 | 21 | /// 22 | /// 查询指定枚举的所有项列表 23 | /// 24 | /// 25 | /// 26 | Task> QueryByEnum(Guid enumId); 27 | 28 | /// 29 | /// 是否存在 30 | /// 31 | /// 32 | /// 33 | Task Exists(EnumItemEntity entity); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Library/Domain/EnumItem/Models/EnumItemQueryModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using NetModular.Lib.Data.Query; 4 | 5 | namespace NetModular.Module.CodeGenerator.Domain.EnumItem.Models 6 | { 7 | public class EnumItemQueryModel : QueryModel 8 | { 9 | /// 10 | /// 枚举编号 11 | /// 12 | [Required(ErrorMessage = "请选择枚举")] 13 | public Guid EnumId { get; set; } 14 | 15 | /// 16 | /// 名称 17 | /// 18 | public string Name { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Library/Domain/ModelProperty/IModelPropertyRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Threading.Tasks; 4 | using NetModular.Lib.Data.Abstractions; 5 | using NetModular.Module.CodeGenerator.Domain.ModelProperty.Models; 6 | 7 | namespace NetModular.Module.CodeGenerator.Domain.ModelProperty 8 | { 9 | public interface IModelPropertyRepository : IRepository 10 | { 11 | /// 12 | /// 查询指定类的模型属性列表 13 | /// 14 | /// 15 | Task> Query(ModelPropertyQueryModel model); 16 | 17 | /// 18 | /// 查询所有属性列表 19 | /// 20 | /// 21 | /// 22 | Task> QueryAll(ModelPropertyQueryModel model); 23 | 24 | /// 25 | /// 查询指定实体的模型属性列表 26 | /// 27 | /// 28 | /// 29 | Task> QueryByClass(Guid classId); 30 | 31 | /// 32 | /// 是否存在 33 | /// 34 | /// 35 | /// 36 | Task Exists(ModelPropertyEntity entity); 37 | 38 | /// 39 | /// 删除指定模块的所有属性 40 | /// 41 | /// 42 | /// 43 | /// 44 | Task DeleteByModule(Guid moduleId, IUnitOfWork uow); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Library/Domain/ModelProperty/ModelPropertyEntity.Extend.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Abstractions.Attributes; 2 | using NetModular.Lib.Utils.Core.Extensions; 3 | 4 | namespace NetModular.Module.CodeGenerator.Domain.ModelProperty 5 | { 6 | public partial class ModelPropertyEntity 7 | { 8 | /// 9 | /// 类型名称 10 | /// 11 | [Ignore] 12 | public string TypeName => Type.ToDescription(); 13 | 14 | /// 15 | /// 枚举名称 16 | /// 17 | [Ignore] 18 | public string EnumName { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Library/Domain/ModelProperty/ModelPropertyEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NetModular.Lib.Data.Abstractions.Attributes; 3 | using NetModular.Lib.Data.Core.Entities.Extend; 4 | using NetModular.Module.CodeGenerator.Domain.Property; 5 | 6 | namespace NetModular.Module.CodeGenerator.Domain.ModelProperty 7 | { 8 | [Table("Model_Property")] 9 | public partial class ModelPropertyEntity : EntityBase 10 | { 11 | /// 12 | /// 模块编号 13 | /// 14 | public Guid ModuleId { get; set; } 15 | 16 | /// 17 | /// 所属类 18 | /// 19 | public Guid ClassId { get; set; } 20 | 21 | /// 22 | /// 模型类型 23 | /// 24 | public ModelType ModelType { get; set; } 25 | 26 | /// 27 | /// 名称 28 | /// 29 | public string Name { get; set; } 30 | 31 | /// 32 | /// 类型 33 | /// 34 | public PropertyType Type { get; set; } 35 | 36 | /// 37 | /// 可空 38 | /// 39 | public bool Nullable { get; set; } 40 | 41 | /// 42 | /// 关联枚举 43 | /// 44 | public Guid EnumId { get; set; } 45 | 46 | /// 47 | /// 备注 48 | /// 49 | [Length(200)] 50 | public string Remarks { get; set; } 51 | 52 | /// 53 | /// 序号 54 | /// 55 | public int Sort { get; set; } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/Library/Domain/ModelProperty/ModelType.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace NetModular.Module.CodeGenerator.Domain.ModelProperty 4 | { 5 | /// 6 | /// 模型类型 7 | /// 8 | public enum ModelType 9 | { 10 | [Description("未知")] 11 | UnKnown, 12 | [Description("查询")] 13 | Query, 14 | [Description("添加")] 15 | Add, 16 | [Description("编辑")] 17 | Edit 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Library/Domain/ModelProperty/Models/ModelPropertyQueryModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using NetModular.Lib.Data.Query; 4 | 5 | namespace NetModular.Module.CodeGenerator.Domain.ModelProperty.Models 6 | { 7 | public class ModelPropertyQueryModel : QueryModel 8 | { 9 | [Required(ErrorMessage = "请选择实体")] 10 | public Guid ClassId { get; set; } 11 | 12 | /// 13 | /// 模型类型 14 | /// 15 | public ModelType ModelType { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Library/Domain/Module/IModuleRepository.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | using NetModular.Lib.Data.Abstractions; 4 | using NetModular.Module.CodeGenerator.Domain.Module.Models; 5 | 6 | namespace NetModular.Module.CodeGenerator.Domain.Module 7 | { 8 | /// 9 | /// 项目仓储 10 | /// 11 | public interface IModuleRepository : IRepository 12 | { 13 | /// 14 | /// 查询 15 | /// 16 | /// 17 | /// 18 | Task> Query(ModuleQueryModel model); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Library/Domain/Module/Models/ModuleQueryModel.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Query; 2 | 3 | namespace NetModular.Module.CodeGenerator.Domain.Module.Models 4 | { 5 | public class ModuleQueryModel : QueryModel 6 | { 7 | /// 8 | /// 名称 9 | /// 10 | public string Name { get; set; } 11 | 12 | /// 13 | /// 编码 14 | /// 15 | public string Code { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Library/Domain/Module/ModuleEntity.Extend.cs: -------------------------------------------------------------------------------- 1 | namespace NetModular.Module.CodeGenerator.Domain.Module 2 | { 3 | public partial class ModuleEntity 4 | { 5 | 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/Library/Domain/Module/ModuleEntity.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Abstractions.Attributes; 2 | using NetModular.Lib.Data.Core.Entities.Extend; 3 | 4 | namespace NetModular.Module.CodeGenerator.Domain.Module 5 | { 6 | /// 7 | /// 模块信息 8 | /// 9 | [Table("Module")] 10 | public partial class ModuleEntity : EntityBaseWithSoftDelete 11 | { 12 | /// 13 | /// 名称 14 | /// 15 | [Length(100)] 16 | public string Name { get; set; } 17 | 18 | /// 19 | /// 编号 20 | /// 21 | public int No { get; set; } 22 | 23 | /// 24 | /// 编码 25 | /// 26 | public string Code { get; set; } 27 | 28 | /// 29 | /// 图标 30 | /// 31 | [Nullable] 32 | public string Icon { get; set; } 33 | 34 | /// 35 | /// 版权声明 36 | /// 37 | [Nullable] 38 | [Length(200)] 39 | public string Copyright { get; set; } 40 | 41 | /// 42 | /// 公司单位 43 | /// 44 | [Nullable] 45 | [Length(100)] 46 | public string Company { get; set; } 47 | 48 | /// 49 | /// 官方地址 50 | /// 51 | [Nullable] 52 | [Length(300)] 53 | public string ProjectUrl { get; set; } 54 | 55 | /// 56 | /// 仓库地址 57 | /// 58 | [Nullable] 59 | [Length(300)] 60 | public string RepositoryUrl { get; set; } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/Library/Domain/OnlineModule/IOnlineModuleRepository.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | using NetModular.Lib.Data.Abstractions; 4 | using NetModular.Module.CodeGenerator.Domain.OnlineModule.Models; 5 | 6 | namespace NetModular.Module.CodeGenerator.Domain.OnlineModule 7 | { 8 | /// 9 | /// 在线模块仓储 10 | /// 11 | public interface IOnlineModuleRepository : IRepository 12 | { 13 | /// 14 | /// 查询 15 | /// 16 | /// 17 | /// 18 | Task> Query(OnlineModuleQueryModel model); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Library/Domain/OnlineModule/Models/OnlineModuleQueryModel.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Query; 2 | 3 | namespace NetModular.Module.CodeGenerator.Domain.OnlineModule.Models 4 | { 5 | public class OnlineModuleQueryModel : QueryModel 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/Library/Domain/OnlineModule/OnlineModuleEntity.Extend.cs: -------------------------------------------------------------------------------- 1 | namespace NetModular.Module.CodeGenerator.Domain.OnlineModule 2 | { 3 | public partial class OnlineModuleEntity 4 | { 5 | 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/Library/Domain/Property/Models/PropertyQueryModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using NetModular.Lib.Data.Query; 4 | 5 | namespace NetModular.Module.CodeGenerator.Domain.Property.Models 6 | { 7 | public class PropertyQueryModel : QueryModel 8 | { 9 | /// 10 | /// 类编号 11 | /// 12 | [Required(ErrorMessage = "请选择类")] 13 | public Guid ClassId { get; set; } 14 | 15 | /// 16 | /// 名称 17 | /// 18 | public string Name { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Library/Domain/Property/PropertyEntity.Extend.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Abstractions.Attributes; 2 | using NetModular.Lib.Utils.Core.Extensions; 3 | 4 | namespace NetModular.Module.CodeGenerator.Domain.Property 5 | { 6 | public partial class PropertyEntity 7 | { 8 | /// 9 | /// 类型名称 10 | /// 11 | [Ignore] 12 | public string TypeName 13 | { 14 | get 15 | { 16 | var name = Type.ToDescription(); 17 | if (Type == PropertyType.String) 18 | { 19 | name = $"{name}({Length})"; 20 | } 21 | else if (Type == PropertyType.Decimal) 22 | { 23 | name = $"{name}({Precision},{Scale})"; 24 | } 25 | else if(Type == PropertyType.Double) 26 | { 27 | name = $"{name}({Precision})"; 28 | } 29 | else if (Type == PropertyType.Enum) 30 | { 31 | name = $"{name}({EnumName})"; 32 | } 33 | return name; 34 | } 35 | } 36 | 37 | /// 38 | /// 枚举名称 39 | /// 40 | [Ignore] 41 | public string EnumName { get; set; } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Library/Domain/Property/PropertyType.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace NetModular.Module.CodeGenerator.Domain.Property 4 | { 5 | public enum PropertyType 6 | { 7 | [Description("string")] 8 | String, 9 | [Description("byte")] 10 | Byte, 11 | [Description("short")] 12 | Short, 13 | [Description("int")] 14 | Int, 15 | [Description("long")] 16 | Long, 17 | [Description("double")] 18 | Double, 19 | [Description("decimal")] 20 | Decimal, 21 | [Description("bool")] 22 | Bool, 23 | [Description("Guid")] 24 | Guid, 25 | [Description("DateTime")] 26 | DateTime, 27 | [Description("Enum")] 28 | Enum 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/CodeGeneratorConfig.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Config.Abstractions; 2 | 3 | namespace NetModular.Module.CodeGenerator.Infrastructure 4 | { 5 | public class CodeGeneratorConfig : IConfig 6 | { 7 | /// 8 | /// 生成代码存储路径 9 | /// 10 | public string BuildCodePath { get; set; } 11 | 12 | /// 13 | /// 模块前缀(后端命名空间) 14 | /// 15 | public string Prefix { get; set; } = "NetModular"; 16 | 17 | /// 18 | /// 前端组件前缀 19 | /// 20 | public string UiPrefix { get; set; } = "Nm"; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/NuGet/NuGetPackageVersions.cs: -------------------------------------------------------------------------------- 1 | namespace NetModular.Module.CodeGenerator.Infrastructure.NuGet 2 | { 3 | /// 4 | /// Nuget包版本信息 5 | /// 6 | public class NuGetPackageVersions 7 | { 8 | public string Lib_Utils_Core { get; set; } 9 | 10 | public string Lib_Utils_Mvc { get; set; } 11 | 12 | public string Lib_Data_Core { get; set; } 13 | 14 | public string Lib_Data_Query { get; set; } 15 | 16 | public string Lib_Data_MySql { get; set; } 17 | 18 | public string Lib_Data_SQLite { get; set; } 19 | 20 | public string Lib_Data_SqlServer { get; set; } 21 | 22 | public string Lib_Config_Abstractions { get; set; } 23 | 24 | public string Lib_Mapper_AutoMapper { get; set; } 25 | 26 | public string Lib_Auth_Web { get; set; } 27 | 28 | public string Lib_Module_Abstractions { get; set; } 29 | 30 | public string Lib_Module_AspNetCore { get; set; } 31 | 32 | public string Lib_Validation_FluentValidation { get; set; } 33 | 34 | public string Lib_Cache_MemoryCache { get; set; } 35 | 36 | public string Lib_Excel_EPPlus { get; set; } 37 | 38 | public string Lib_Host_Web { get; set; } 39 | 40 | public string Module_Admin_Domain { get; set; } 41 | 42 | public string Module_Admin_Web { get; set; } 43 | 44 | public string Lib_OSS_Local { get; set; } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Repositories/CodeGeneratorDbContext.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Abstractions; 2 | using NetModular.Lib.Data.Core; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Repositories 5 | { 6 | public class CodeGeneratorDbContext : DbContext 7 | { 8 | public CodeGeneratorDbContext(IDbContextOptions options) : base(options) 9 | { 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Repositories/MySql/ClassMethodRepository.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Abstractions; 2 | 3 | namespace NetModular.Module.CodeGenerator.Infrastructure.Repositories.MySql 4 | { 5 | public class ClassMethodRepository : SqlServer.ClassMethodRepository 6 | { 7 | public ClassMethodRepository(IDbContext context) : base(context) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Repositories/MySql/ClassRepository.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Abstractions; 2 | 3 | namespace NetModular.Module.CodeGenerator.Infrastructure.Repositories.MySql 4 | { 5 | public class ClassRepository : SqlServer.ClassRepository 6 | { 7 | public ClassRepository(IDbContext context) : base(context) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Repositories/MySql/EnumItemRepository.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Abstractions; 2 | 3 | namespace NetModular.Module.CodeGenerator.Infrastructure.Repositories.MySql 4 | { 5 | public class EnumItemRepository : SqlServer.EnumItemRepository 6 | { 7 | public EnumItemRepository(IDbContext context) : base(context) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Repositories/MySql/EnumRepository.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Abstractions; 2 | 3 | namespace NetModular.Module.CodeGenerator.Infrastructure.Repositories.MySql 4 | { 5 | public class EnumRepository : SqlServer.EnumRepository 6 | { 7 | public EnumRepository(IDbContext context) : base(context) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Repositories/MySql/ModelPropertyRepository.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Abstractions; 2 | 3 | namespace NetModular.Module.CodeGenerator.Infrastructure.Repositories.MySql 4 | { 5 | public class ModelPropertyRepository : SqlServer.ModelPropertyRepository 6 | { 7 | public ModelPropertyRepository(IDbContext context) : base(context) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Repositories/MySql/ModuleRepository.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Abstractions; 2 | 3 | namespace NetModular.Module.CodeGenerator.Infrastructure.Repositories.MySql 4 | { 5 | public class ModuleRepository : SqlServer.ModuleRepository 6 | { 7 | public ModuleRepository(IDbContext context) : base(context) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Repositories/MySql/OnlineModuleRepository.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Abstractions; 2 | 3 | namespace NetModular.Module.CodeGenerator.Infrastructure.Repositories.MySql 4 | { 5 | public class OnlineModuleRepository : SqlServer.OnlineModuleRepository 6 | { 7 | public OnlineModuleRepository(IDbContext dbContext) : base(dbContext) 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/Library/Infrastructure/Repositories/MySql/PropertyRepository.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Abstractions; 2 | 3 | namespace NetModular.Module.CodeGenerator.Infrastructure.Repositories.MySql 4 | { 5 | public class PropertyRepository : SqlServer.PropertyRepository 6 | { 7 | public PropertyRepository(IDbContext context) : base(context) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Repositories/PostgreSQL/ClassMethodRepository.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Abstractions; 2 | 3 | namespace NetModular.Module.CodeGenerator.Infrastructure.Repositories.PostgreSQL 4 | { 5 | public class ClassMethodRepository : SqlServer.ClassMethodRepository 6 | { 7 | public ClassMethodRepository(IDbContext context) : base(context) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Repositories/PostgreSQL/ClassRepository.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Abstractions; 2 | 3 | namespace NetModular.Module.CodeGenerator.Infrastructure.Repositories.PostgreSQL 4 | { 5 | public class ClassRepository : SqlServer.ClassRepository 6 | { 7 | public ClassRepository(IDbContext context) : base(context) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Repositories/PostgreSQL/EnumItemRepository.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Abstractions; 2 | 3 | namespace NetModular.Module.CodeGenerator.Infrastructure.Repositories.PostgreSQL 4 | { 5 | public class EnumItemRepository : SqlServer.EnumItemRepository 6 | { 7 | public EnumItemRepository(IDbContext context) : base(context) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Repositories/PostgreSQL/EnumRepository.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Abstractions; 2 | 3 | namespace NetModular.Module.CodeGenerator.Infrastructure.Repositories.PostgreSQL 4 | { 5 | public class EnumRepository : SqlServer.EnumRepository 6 | { 7 | public EnumRepository(IDbContext context) : base(context) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Repositories/PostgreSQL/ModelPropertyRepository.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Abstractions; 2 | 3 | namespace NetModular.Module.CodeGenerator.Infrastructure.Repositories.PostgreSQL 4 | { 5 | public class ModelPropertyRepository : SqlServer.ModelPropertyRepository 6 | { 7 | public ModelPropertyRepository(IDbContext context) : base(context) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Repositories/PostgreSQL/ModuleRepository.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Abstractions; 2 | 3 | namespace NetModular.Module.CodeGenerator.Infrastructure.Repositories.PostgreSQL 4 | { 5 | public class ModuleRepository : SqlServer.ModuleRepository 6 | { 7 | public ModuleRepository(IDbContext context) : base(context) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Repositories/PostgreSQL/OnlineModuleRepository.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Abstractions; 2 | 3 | namespace NetModular.Module.CodeGenerator.Infrastructure.Repositories.PostgreSQL 4 | { 5 | public class OnlineModuleRepository : SqlServer.OnlineModuleRepository 6 | { 7 | public OnlineModuleRepository(IDbContext dbContext) : base(dbContext) 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/Library/Infrastructure/Repositories/PostgreSQL/PropertyRepository.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Abstractions; 2 | 3 | namespace NetModular.Module.CodeGenerator.Infrastructure.Repositories.PostgreSQL 4 | { 5 | public class PropertyRepository : SqlServer.PropertyRepository 6 | { 7 | public PropertyRepository(IDbContext context) : base(context) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Repositories/SQLite/ClassMethodRepository.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Abstractions; 2 | 3 | namespace NetModular.Module.CodeGenerator.Infrastructure.Repositories.SQLite 4 | { 5 | public class ClassMethodRepository : SqlServer.ClassMethodRepository 6 | { 7 | public ClassMethodRepository(IDbContext context) : base(context) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Repositories/SQLite/ClassRepository.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Abstractions; 2 | 3 | namespace NetModular.Module.CodeGenerator.Infrastructure.Repositories.SQLite 4 | { 5 | public class ClassRepository : SqlServer.ClassRepository 6 | { 7 | public ClassRepository(IDbContext context) : base(context) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Repositories/SQLite/EnumItemRepository.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Abstractions; 2 | 3 | namespace NetModular.Module.CodeGenerator.Infrastructure.Repositories.SQLite 4 | { 5 | public class EnumItemRepository : SqlServer.EnumItemRepository 6 | { 7 | public EnumItemRepository(IDbContext context) : base(context) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Repositories/SQLite/EnumRepository.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Abstractions; 2 | 3 | namespace NetModular.Module.CodeGenerator.Infrastructure.Repositories.SQLite 4 | { 5 | public class EnumRepository : SqlServer.EnumRepository 6 | { 7 | public EnumRepository(IDbContext context) : base(context) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Repositories/SQLite/ModelPropertyRepository.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Abstractions; 2 | 3 | namespace NetModular.Module.CodeGenerator.Infrastructure.Repositories.SQLite 4 | { 5 | public class ModelPropertyRepository : SqlServer.ModelPropertyRepository 6 | { 7 | public ModelPropertyRepository(IDbContext context) : base(context) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Repositories/SQLite/ModuleRepository.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Abstractions; 2 | 3 | namespace NetModular.Module.CodeGenerator.Infrastructure.Repositories.SQLite 4 | { 5 | public class ModuleRepository : SqlServer.ModuleRepository 6 | { 7 | public ModuleRepository(IDbContext context) : base(context) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Repositories/SQLite/OnlineModuleRepository.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Abstractions; 2 | 3 | namespace NetModular.Module.CodeGenerator.Infrastructure.Repositories.SQLite 4 | { 5 | public class OnlineModuleRepository : SqlServer.OnlineModuleRepository 6 | { 7 | public OnlineModuleRepository(IDbContext dbContext) : base(dbContext) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Repositories/SQLite/PropertyRepository.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Lib.Data.Abstractions; 2 | 3 | namespace NetModular.Module.CodeGenerator.Infrastructure.Repositories.SQLite 4 | { 5 | public class PropertyRepository : SqlServer.PropertyRepository 6 | { 7 | public PropertyRepository(IDbContext context) : base(context) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Repositories/SqlServer/ClassMethodRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using NetModular.Lib.Data.Abstractions; 4 | using NetModular.Lib.Data.Core; 5 | using NetModular.Module.CodeGenerator.Domain.ClassMethod; 6 | 7 | namespace NetModular.Module.CodeGenerator.Infrastructure.Repositories.SqlServer 8 | { 9 | public class ClassMethodRepository : RepositoryAbstract, IClassMethodRepository 10 | { 11 | public ClassMethodRepository(IDbContext context) : base(context) 12 | { 13 | 14 | } 15 | 16 | public Task DeleteByClass(Guid classId, IUnitOfWork uow) 17 | { 18 | return Db.Find(m => m.ClassId == classId).UseUow(uow).DeleteAsync(); 19 | } 20 | 21 | public Task GetByClass(Guid classId, IUnitOfWork uow) 22 | { 23 | return Db.Find(m => m.ClassId == classId).UseUow(uow).FirstAsync(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Repositories/SqlServer/ModuleRepository.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Threading.Tasks; 4 | using NetModular.Lib.Data.Abstractions; 5 | using NetModular.Lib.Data.Core; 6 | using NetModular.Lib.Data.Query; 7 | using NetModular.Module.Admin.Domain.Account; 8 | using NetModular.Module.CodeGenerator.Domain.Module; 9 | using NetModular.Module.CodeGenerator.Domain.Module.Models; 10 | 11 | namespace NetModular.Module.CodeGenerator.Infrastructure.Repositories.SqlServer 12 | { 13 | public class ModuleRepository : RepositoryAbstract, IModuleRepository 14 | { 15 | public ModuleRepository(IDbContext context) : base(context) 16 | { 17 | } 18 | 19 | public async Task> Query(ModuleQueryModel model) 20 | { 21 | var paging = model.Paging(); 22 | 23 | var query = Db.Find(); 24 | query.WhereNotNull(model.Name, m => m.Name.Contains(model.Name)); 25 | query.WhereNotNull(model.Code, m => m.Code.Contains(model.Code)); 26 | 27 | var joinQuery = query.LeftJoin((x, y) => x.CreatedBy == y.Id); 28 | if (!paging.OrderBy.Any()) 29 | { 30 | joinQuery.OrderByDescending((x, y) => x.Id); 31 | } 32 | 33 | joinQuery.Select((x, y) => new { x, Creator = y.Name }); 34 | 35 | var result = await joinQuery.PaginationAsync(paging); 36 | model.TotalCount = paging.TotalCount; 37 | 38 | return result; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Repositories/SqlServer/OnlineModuleRepository.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Threading.Tasks; 4 | using NetModular.Lib.Data.Abstractions; 5 | using NetModular.Lib.Data.Core; 6 | using NetModular.Lib.Data.Query; 7 | using NetModular.Module.CodeGenerator.Domain.OnlineModule; 8 | using NetModular.Module.CodeGenerator.Domain.OnlineModule.Models; 9 | 10 | namespace NetModular.Module.CodeGenerator.Infrastructure.Repositories.SqlServer 11 | { 12 | public class OnlineModuleRepository : RepositoryAbstract, IOnlineModuleRepository 13 | { 14 | public OnlineModuleRepository(IDbContext context) : base(context) 15 | { 16 | } 17 | 18 | public async Task> Query(OnlineModuleQueryModel model) 19 | { 20 | var paging = model.Paging(); 21 | 22 | var query = Db.Find(); 23 | 24 | if (!paging.OrderBy.Any()) 25 | { 26 | query.OrderByDescending(m => m.Id); 27 | } 28 | 29 | var result = await query.PaginationAsync(paging); 30 | 31 | model.TotalCount = paging.TotalCount; 32 | 33 | return result; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/DefaultTemplateBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default 2 | { 3 | public class DefaultTemplateBuilder : TemplateBuilderAbstract 4 | { 5 | public DefaultTemplateBuilder() : base("Default") 6 | { 7 | 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/Gitattributes.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4 5 | { 6 | public partial class Gitattributes : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | 10 | public Gitattributes(TemplateBuildModel model) 11 | { 12 | _model = model; 13 | } 14 | 15 | public bool IsGlobal => true; 16 | 17 | public void Save() 18 | { 19 | var content = TransformText(); 20 | var filePath = Path.Combine(_model.RootPath, ".gitattributes"); 21 | File.WriteAllText(filePath, content); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/Gitattributes.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamoldli/NetModular.Module.CodeGenerator/a7c1992045e6e926aa61a34ff52e6bdec191413f/src/Library/Infrastructure/Templates/Default/T4/Gitattributes.cs -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/Gitignore.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4 5 | { 6 | public partial class Gitignore : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | 10 | public Gitignore(TemplateBuildModel model) 11 | { 12 | _model = model; 13 | } 14 | 15 | public bool IsGlobal => true; 16 | 17 | public void Save() 18 | { 19 | var content = TransformText(); 20 | var filePath = Path.Combine(_model.RootPath, ".gitignore"); 21 | File.WriteAllText(filePath, content); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/Gitignore.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamoldli/NetModular.Module.CodeGenerator/a7c1992045e6e926aa61a34ff52e6bdec191413f/src/Library/Infrastructure/Templates/Default/T4/Gitignore.cs -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/Readme.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4 5 | { 6 | public partial class Readme : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | 10 | public Readme(TemplateBuildModel model) 11 | { 12 | _model = model; 13 | } 14 | 15 | public bool IsGlobal => true; 16 | 17 | public void Save() 18 | { 19 | var content = TransformText(); 20 | var filePath = Path.Combine(_model.RootPath, "README.md"); 21 | File.WriteAllText(filePath, content); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/Readme.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamoldli/NetModular.Module.CodeGenerator/a7c1992045e6e926aa61a34ff52e6bdec191413f/src/Library/Infrastructure/Templates/Default/T4/Readme.cs -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/Readme.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | ## <#= _model.Module.Name #> 3 | 4 | ### 配置项 5 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/Solution.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4 5 | { 6 | public partial class Solution : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | 10 | public Solution(TemplateBuildModel model) 11 | { 12 | _model = model; 13 | } 14 | 15 | public bool IsGlobal => true; 16 | 17 | public void Save() 18 | { 19 | var content = TransformText(); 20 | var dir = Path.Combine(_model.RootPath); 21 | if (!Directory.Exists(dir)) 22 | { 23 | Directory.CreateDirectory(dir); 24 | } 25 | var filePath = Path.Combine(dir, _model.Module.Code + ".sln"); 26 | File.WriteAllText(filePath, content); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/build/ModuleBuildTargets.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.build 5 | { 6 | public partial class ModuleBuildTargets : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | 10 | public ModuleBuildTargets(TemplateBuildModel model) 11 | { 12 | _model = model; 13 | } 14 | 15 | public bool IsGlobal => true; 16 | 17 | public void Save() 18 | { 19 | var dir = Path.Combine(_model.RootPath, "build"); 20 | if (!Directory.Exists(dir)) 21 | Directory.CreateDirectory(dir); 22 | 23 | var content = TransformText(); 24 | 25 | var filePath = Path.Combine(dir, "module.build.targets"); 26 | File.WriteAllText(filePath, content); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/build/ModuleBuildTargets.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamoldli/NetModular.Module.CodeGenerator/a7c1992045e6e926aa61a34ff52e6bdec191413f/src/Library/Infrastructure/Templates/Default/T4/build/ModuleBuildTargets.cs -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/build/ModuleBuildTargets.tt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | _modules\$(Id)_$(Code) 5 | $(ModulesDir)\_module.json 6 | {"Id": "$(Id)","Name":"$(Name)","Code":"$(Code)","Icon":"$(Icon)","Version":"$(Version)","Description":"$(Description)"} 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/DirectoryBuildProps.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src 5 | { 6 | public partial class DirectoryBuildProps : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | private readonly string _prefix; 10 | private readonly string _company; 11 | private readonly string _copyright; 12 | private readonly string _projectUrl; 13 | private readonly string _repositoryUrl; 14 | 15 | public DirectoryBuildProps(TemplateBuildModel model) 16 | { 17 | _model = model; 18 | _prefix = model.Module.Prefix; 19 | _company = model.Module.Company ?? ""; 20 | _copyright = model.Module.Copyright ?? ""; 21 | _projectUrl = model.Module.ProjectUrl ?? ""; 22 | _repositoryUrl = model.Module.RepositoryUrl ?? ""; 23 | } 24 | 25 | public bool IsGlobal => true; 26 | 27 | public void Save() 28 | { 29 | var dir = Path.Combine(_model.RootPath, "src"); 30 | if (!Directory.Exists(dir)) 31 | Directory.CreateDirectory(dir); 32 | 33 | var content = TransformText(); 34 | var filePath = Path.Combine(dir, "Directory.Build.props"); 35 | File.WriteAllText(filePath, content); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/DirectoryBuildProps.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | 3 | 4 | net9.0 5 | <#= _model.Module.No<10 ? "0" + _model.Module.No : _model.Module.No + "" #> 6 | <#= _model.Module.Code #> 7 | <#= _model.Module.Name #> 8 | Oldli 9 | <#= _model.Module.Icon #> 10 | 1.0.0 11 | NetModular Module $(Code)($(Name)) - $(MSBuildProjectName) 12 | $(NoWarn);1591 13 | Latest 14 | <#= _prefix #>.Module.$(Code) 15 | $(RootNamespacePrefix).$(MSBuildProjectName) 16 | $(AssemblyName) 17 | true 18 | true 19 | 20 | $(SolutionDir)\_packages 21 | <#= _company #> 22 | <#= _copyright #> 23 | <#= _projectUrl #> 24 | <#= _repositoryUrl #> 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Library/Application/Csproj.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.NuGet; 3 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 4 | 5 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.Library.Application 6 | { 7 | public partial class Csproj : ITemplateHandler 8 | { 9 | private readonly TemplateBuildModel _model; 10 | private readonly string _prefix; 11 | private readonly NuGetPackageVersions _versions; 12 | 13 | public Csproj(TemplateBuildModel model) 14 | { 15 | _model = model; 16 | _prefix = model.Module.Prefix; 17 | _versions = _model.NuGetPackageVersions; 18 | } 19 | 20 | public bool IsGlobal => true; 21 | 22 | public void Save() 23 | { 24 | var dir = Path.Combine(_model.RootPath, "src/Library/Application"); 25 | if (!Directory.Exists(dir)) 26 | Directory.CreateDirectory(dir); 27 | 28 | var content = TransformText(); 29 | var filePath = Path.Combine(dir, "Application.csproj"); 30 | File.WriteAllText(filePath, content); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Library/Application/Csproj.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Library/Application/MapperConfig.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Linq; 3 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 4 | 5 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.Library.Application 6 | { 7 | public partial class MapperConfig : ITemplateHandler 8 | { 9 | private readonly TemplateBuildModel _model; 10 | private readonly string _prefix; 11 | private ClassBuildModel _class; 12 | 13 | public MapperConfig(TemplateBuildModel model) 14 | { 15 | _model = model; 16 | _prefix = model.Module.Prefix; 17 | } 18 | 19 | public bool IsGlobal => false; 20 | 21 | public void Save() 22 | { 23 | if (_model.Module.ClassList != null && _model.Module.ClassList.Any()) 24 | { 25 | foreach (var classModel in _model.Module.ClassList) 26 | { 27 | _class = classModel; 28 | 29 | var dir = Path.Combine(_model.RootPath, "src/Library/Application", _class.Name + "Service"); 30 | if (!Directory.Exists(dir)) 31 | Directory.CreateDirectory(dir); 32 | 33 | //清空 34 | GenerationEnvironment.Clear(); 35 | 36 | var content = TransformText(); 37 | 38 | var filePath = Path.Combine(dir, "_MapperConfig.cs"); 39 | File.WriteAllText(filePath, content); 40 | } 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Library/Application/MapperConfig.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | using AutoMapper; 3 | using <#= _prefix #>.Lib.Mapper.AutoMapper; 4 | using <#= _prefix #>.Module.<#= _model.Module.Code #>.Application.<#= _class.Name #>Service.ViewModels; 5 | using <#= _prefix #>.Module.<#= _model.Module.Code #>.Domain.<#= _class.Name #>; 6 | 7 | namespace <#= _prefix #>.Module.<#= _model.Module.Code #>.Application.<#= _class.Name #>Service 8 | { 9 | public class MapperConfig : IMapperConfig 10 | { 11 | public void Bind(IMapperConfigurationExpression cfg) 12 | { 13 | cfg.CreateMap<<#= _class.Name #>AddModel, <#= _class.Name #>Entity>(); 14 | cfg.CreateMap<<#= _class.Name #>Entity, <#= _class.Name #>UpdateModel>(); 15 | cfg.CreateMap<<#= _class.Name #>UpdateModel, <#= _class.Name #>Entity>(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Library/Application/ServiceImpl.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Linq; 3 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 4 | 5 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.Library.Application 6 | { 7 | public partial class ServiceImpl : ITemplateHandler 8 | { 9 | private readonly TemplateBuildModel _model; 10 | private readonly string _prefix; 11 | private ClassBuildModel _class; 12 | 13 | public ServiceImpl(TemplateBuildModel model) 14 | { 15 | _model = model; 16 | _prefix = model.Module.Prefix; 17 | } 18 | 19 | public bool IsGlobal => false; 20 | 21 | public void Save() 22 | { 23 | if (_model.Module.ClassList != null && _model.Module.ClassList.Any()) 24 | { 25 | foreach (var classModel in _model.Module.ClassList) 26 | { 27 | _class = classModel; 28 | 29 | var dir = Path.Combine(_model.RootPath, "src/Library/Application", _class.Name + "Service"); 30 | if (!Directory.Exists(dir)) 31 | Directory.CreateDirectory(dir); 32 | 33 | //清空 34 | GenerationEnvironment.Clear(); 35 | 36 | var content = TransformText(); 37 | 38 | var filePath = Path.Combine(dir, $"{_class.Name}Service.cs"); 39 | File.WriteAllText(filePath, content); 40 | } 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Library/Application/ViewModels/AddModel.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | <#@ import namespace="NetModular.Lib.Utils.Core.Extensions" #> 3 | <#@ import namespace="NetModular.Module.CodeGenerator.Domain.Property" #> 4 | using System; 5 | using System.ComponentModel.DataAnnotations; 6 | using <#= _prefix #>.Module.<#= _model.Module.Code #>.Domain.<#= _class.Name #>; 7 | 8 | namespace <#= _prefix #>.Module.<#= _model.Module.Code #>.Application.<#= _class.Name #>Service.ViewModels 9 | { 10 | /// 11 | /// <#= _class.Remarks #>添加模型 12 | /// 13 | public class <#= _class.Name #>AddModel 14 | { 15 | <# foreach(var p in _class.AddModelPropertyList){ #> 16 | /// 17 | /// <#= p.Remarks #> 18 | /// 19 | public <#= p.Type == PropertyType.Enum ? p.Enum.Name : p.Type.ToDescription() #> <#= p.Name #> { get; set; } 20 | 21 | <# } #> 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Library/Application/ViewModels/UpdateModel.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | <#@ import namespace="NetModular.Lib.Utils.Core.Extensions" #> 3 | <#@ import namespace="NetModular.Module.CodeGenerator.Domain.Property" #> 4 | using System; 5 | using System.ComponentModel.DataAnnotations; 6 | using <#= _prefix #>.Module.<#= _model.Module.Code #>.Domain.<#= _class.Name #>; 7 | 8 | namespace <#= _prefix #>.Module.<#= _model.Module.Code #>.Application.<#= _class.Name #>Service.ViewModels 9 | { 10 | /// 11 | /// <#= _class.Remarks #>添加模型 12 | /// 13 | public class <#= _class.Name #>UpdateModel : <#= _class.Name #>AddModel 14 | { 15 | [Required(ErrorMessage = "请选择要修改的<#= _class.Remarks #>")] 16 | public <#= _class.PrimaryKeyTypeName #> Id { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Library/Domain/Csproj.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.NuGet; 3 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 4 | 5 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.Library.Domain 6 | { 7 | public partial class Csproj : ITemplateHandler 8 | { 9 | private readonly TemplateBuildModel _model; 10 | private readonly string _prefix; 11 | private readonly NuGetPackageVersions _versions; 12 | 13 | public Csproj(TemplateBuildModel model) 14 | { 15 | _model = model; 16 | _prefix = model.Module.Prefix; 17 | _versions = _model.NuGetPackageVersions; 18 | } 19 | 20 | public bool IsGlobal => true; 21 | 22 | public void Save() 23 | { 24 | var dir = Path.Combine(_model.RootPath, "src/Library/Domain"); 25 | if (!Directory.Exists(dir)) 26 | Directory.CreateDirectory(dir); 27 | 28 | var content = TransformText(); 29 | var filePath = Path.Combine(dir, "Domain.csproj"); 30 | File.WriteAllText(filePath, content); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Library/Domain/Csproj.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Library/Domain/Entity.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | <#@ import namespace="NetModular.Lib.Utils.Core.Extensions" #> 3 | <#@ import namespace="NetModular.Module.CodeGenerator.Domain.Property" #> 4 | using System; 5 | using <#= _prefix #>.Lib.Data.Abstractions.Attributes; 6 | <# if(_baseEntityName=="IEntity" || _baseEntityName=="Entity" || _baseEntityName.StartsWith("Entity<")){ #> 7 | using <#= _prefix #>.Lib.Data.Core.Entities; 8 | <#}else{ #> 9 | using <#= _prefix #>.Lib.Data.Core.Entities.Extend; 10 | <#} #> 11 | 12 | namespace <#= _prefix #>.Module.<#= _model.Module.Code #>.Domain.<#= _class.Name #> 13 | { 14 | /// 15 | /// <#= _class.Remarks #> 16 | /// 17 | [Table("<#= _class.TableName #>")] 18 | public partial class <#= _class.Name #>Entity : <#= _baseEntityName #> 19 | { 20 | <# foreach(var p in _propertyList){ if(p.IsInherit) continue;#> 21 | /// 22 | /// <#= p.Remarks #> 23 | /// 24 | <# if(p.Nullable && p.Type == PropertyType.String){ #> 25 | [Nullable] 26 | <# } #> 27 | <# if(p.Type == PropertyType.String){ #> 28 | <# if(p.Length == 0){ #> 29 | [Max] 30 | <# } else if(p.Length !=50) { #> 31 | [Length(<#= p.Length #>)] 32 | <# } #> 33 | <# } #> 34 | <# if(p.Type == PropertyType.Decimal||p.Type == PropertyType.Double){ #> 35 | [Precision] 36 | <# } #> 37 | public <#= p.Type == PropertyType.Enum ? p.Enum.Name : p.Type.ToDescription() #><#= p.Nullable && p.Type != PropertyType.String ? "?" : "" #> <#= p.Name #> { get; set; }<#= GetDefaultValue(p) #> 38 | 39 | <# } #> 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Library/Domain/EntityEnum.Extend.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 2 | 3 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.Library.Domain 4 | { 5 | public partial class EntityEnum 6 | { 7 | private readonly TemplateBuildModel _model; 8 | private readonly ClassBuildModel _class; 9 | private readonly string _prefix; 10 | private readonly EnumBuildModel _enum; 11 | 12 | public EntityEnum(TemplateBuildModel model, ClassBuildModel @class,EnumBuildModel @enum) 13 | { 14 | _model = model; 15 | _class = @class; 16 | _prefix = model.Module.Prefix; 17 | _enum = @enum; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Library/Domain/EntityEnum.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | <#@ import namespace="System.Linq" #> 3 | using System.ComponentModel; 4 | 5 | namespace <#= _prefix #>.Module.<#= _model.Module.Code #>.Domain.<#= _class.Name #> 6 | { 7 | /// 8 | /// <#= _enum.Remarks #> 9 | /// 10 | public enum <#= _enum.Name #> 11 | { 12 | <# for(var i=0;i<_enum.ItemList.Count;i++){ #> 13 | <# var item = _enum.ItemList[i]; #> 14 | [Description("<#= item.Remarks #>")] 15 | <#= item.Name #> = <#= item.Value #><#= i == _enum.ItemList.Count - 1 ? "" : "," #> 16 | <# } #> 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Library/Domain/EntityExtend.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Linq; 3 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 4 | 5 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.Library.Domain 6 | { 7 | public partial class EntityExtend : ITemplateHandler 8 | { 9 | private readonly TemplateBuildModel _model; 10 | private readonly string _prefix; 11 | private ClassBuildModel _class; 12 | 13 | public EntityExtend(TemplateBuildModel model) 14 | { 15 | _model = model; 16 | _prefix = model.Module.Prefix; 17 | } 18 | 19 | public bool IsGlobal => false; 20 | 21 | public void Save() 22 | { 23 | if (_model.Module.ClassList != null && _model.Module.ClassList.Any()) 24 | { 25 | foreach (var classModel in _model.Module.ClassList) 26 | { 27 | _class = classModel; 28 | 29 | var dir = Path.Combine(_model.RootPath, "src/Library/Domain", _class.Name); 30 | if (!Directory.Exists(dir)) 31 | Directory.CreateDirectory(dir); 32 | 33 | //清空 34 | GenerationEnvironment.Clear(); 35 | 36 | var content = TransformText(); 37 | 38 | var filePath = Path.Combine(dir, _class.Name + "Entity.Extend.cs"); 39 | File.WriteAllText(filePath, content); 40 | } 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Library/Domain/EntityExtend.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | namespace <#= _prefix #>.Module.<#= _model.Module.Code #>.Domain.<#= _class.Name #> 3 | { 4 | public partial class <#= _class.Name #>Entity 5 | { 6 | 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Library/Domain/Models/QueryModel.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | <#@ import namespace="NetModular.Lib.Utils.Core.Extensions" #> 3 | <#@ import namespace="NetModular.Module.CodeGenerator.Domain.Property" #> 4 | using System; 5 | using <#= _prefix #>.Lib.Data.Query; 6 | 7 | namespace <#= _prefix #>.Module.<#= _model.Module.Code #>.Domain.<#= _class.Name #>.Models 8 | { 9 | public class <#= _class.Name #>QueryModel : QueryModel 10 | { 11 | <# foreach(var property in _propertyList){ #> 12 | /// 13 | /// <#= property.Remarks #> 14 | /// 15 | public <#= property.Type == PropertyType.Enum ? property.Enum.Name : property.Type.ToDescription() #><#= property.Nullable && property.Type != PropertyType.String ? "?" : "" #> <#= property.Name #> { get; set; } 16 | 17 | <# } #> 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Library/Domain/Repository.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Linq; 3 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 4 | 5 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.Library.Domain 6 | { 7 | public partial class Repository : ITemplateHandler 8 | { 9 | private readonly TemplateBuildModel _model; 10 | private readonly string _prefix; 11 | private ClassBuildModel _class; 12 | 13 | public Repository(TemplateBuildModel model) 14 | { 15 | _model = model; 16 | _prefix = model.Module.Prefix; 17 | } 18 | 19 | public bool IsGlobal => false; 20 | 21 | public void Save() 22 | { 23 | if (_model.Module.ClassList != null && _model.Module.ClassList.Any()) 24 | { 25 | foreach (var classModel in _model.Module.ClassList) 26 | { 27 | _class = classModel; 28 | 29 | var dir = Path.Combine(_model.RootPath, "src/Library/Domain", _class.Name); 30 | if (!Directory.Exists(dir)) 31 | Directory.CreateDirectory(dir); 32 | 33 | //清空 34 | GenerationEnvironment.Clear(); 35 | 36 | var content = TransformText(); 37 | 38 | var filePath = Path.Combine(dir, $"I{_class.Name}Repository.cs"); 39 | File.WriteAllText(filePath, content); 40 | } 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Library/Domain/Repository.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | using System.Collections.Generic; 3 | using System.Threading.Tasks; 4 | using <#= _prefix #>.Lib.Data.Abstractions; 5 | using <#= _prefix #>.Module.<#= _model.Module.Code #>.Domain.<#= _class.Name #>.Models; 6 | 7 | namespace <#= _prefix #>.Module.<#= _model.Module.Code #>.Domain.<#= _class.Name #> 8 | { 9 | /// 10 | /// <#= _class.Remarks #>仓储 11 | /// 12 | public interface I<#= _class.Name #>Repository : IRepository<<#= _class.Name #>Entity> 13 | { 14 | /// 15 | /// 查询 16 | /// 17 | /// 18 | /// 19 | TaskEntity>> Query(<#= _class.Name #>QueryModel model); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Library/Infrastructure/Config.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.Library.Infrastructure 5 | { 6 | public partial class Config : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | private readonly string _prefix; 10 | 11 | public Config(TemplateBuildModel model) 12 | { 13 | _model = model; 14 | _prefix = model.Module.Prefix; 15 | } 16 | 17 | public bool IsGlobal => true; 18 | 19 | public void Save() 20 | { 21 | var dir = Path.Combine(_model.RootPath, "src/Library/Infrastructure"); 22 | if (!Directory.Exists(dir)) 23 | Directory.CreateDirectory(dir); 24 | 25 | var content = TransformText(); 26 | var filePath = Path.Combine(dir, $"{_model.Module.Code}Config.cs"); 27 | File.WriteAllText(filePath, content); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Library/Infrastructure/Config.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | using <#= _prefix #>.Lib.Config.Abstractions; 3 | 4 | namespace <#= _prefix #>.Module.<#= _model.Module.Code #>.Infrastructure 5 | { 6 | /// 7 | /// <#= _model.Module.Name #>配置项 8 | /// 9 | public class <#= _model.Module.Code #>Config : IConfig 10 | { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Library/Infrastructure/Csproj.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.NuGet; 3 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 4 | 5 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.Library.Infrastructure 6 | { 7 | public partial class Csproj : ITemplateHandler 8 | { 9 | private readonly TemplateBuildModel _model; 10 | private readonly string _prefix; 11 | private readonly NuGetPackageVersions _versions; 12 | 13 | public Csproj(TemplateBuildModel model) 14 | { 15 | _model = model; 16 | _prefix = model.Module.Prefix; 17 | _versions = _model.NuGetPackageVersions; 18 | } 19 | 20 | public bool IsGlobal => true; 21 | 22 | public void Save() 23 | { 24 | var dir = Path.Combine(_model.RootPath, "src/Library/Infrastructure"); 25 | if (!Directory.Exists(dir)) 26 | Directory.CreateDirectory(dir); 27 | 28 | var content = TransformText(); 29 | var filePath = Path.Combine(dir, "Infrastructure.csproj"); 30 | File.WriteAllText(filePath, content); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Library/Infrastructure/Csproj.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamoldli/NetModular.Module.CodeGenerator/a7c1992045e6e926aa61a34ff52e6bdec191413f/src/Library/Infrastructure/Templates/Default/T4/src/Library/Infrastructure/Csproj.cs -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Library/Infrastructure/Csproj.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Library/Infrastructure/ModuleServicesConfigurator.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.Library.Infrastructure 5 | { 6 | public partial class ModuleServicesConfigurator : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | private readonly string _prefix; 10 | 11 | public ModuleServicesConfigurator(TemplateBuildModel model) 12 | { 13 | _model = model; 14 | _prefix = model.Module.Prefix; 15 | } 16 | 17 | public bool IsGlobal => true; 18 | 19 | public void Save() 20 | { 21 | var dir = Path.Combine(_model.RootPath, "src/Library/Infrastructure"); 22 | if (!Directory.Exists(dir)) 23 | Directory.CreateDirectory(dir); 24 | 25 | var content = TransformText(); 26 | var filePath = Path.Combine(dir, "ModuleServicesConfigurator.cs"); 27 | File.WriteAllText(filePath, content); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Library/Infrastructure/ModuleServicesConfigurator.tt: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Configuration; 2 | using Microsoft.Extensions.DependencyInjection; 3 | using Microsoft.Extensions.Hosting; 4 | using <#= _prefix #>.Lib.Module.Abstractions; 5 | 6 | namespace <#= _prefix #>.Module.<#= _model.Module.Code #>.Infrastructure 7 | { 8 | public class ModuleServicesConfigurator : IModuleServicesConfigurator 9 | { 10 | public void Configure(IServiceCollection services, IModuleCollection modules, IHostEnvironment env, IConfiguration cfg) 11 | { 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Library/Infrastructure/Repositories/DbContext.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.Library.Infrastructure.Repositories 5 | { 6 | public partial class DbContext : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | private readonly string _prefix; 10 | 11 | public DbContext(TemplateBuildModel model) 12 | { 13 | _model = model; 14 | _prefix = model.Module.Prefix; 15 | } 16 | 17 | public bool IsGlobal => true; 18 | 19 | public void Save() 20 | { 21 | var dir = Path.Combine(_model.RootPath, "src/Library/Infrastructure/Repositories"); 22 | if (!Directory.Exists(dir)) 23 | Directory.CreateDirectory(dir); 24 | 25 | var content = TransformText(); 26 | var filePath = Path.Combine(dir, $"{_model.Module.Code}DbContext.cs"); 27 | File.WriteAllText(filePath, content); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Library/Infrastructure/Repositories/DbContext.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | using <#= _prefix #>.Lib.Data.Abstractions; 3 | using <#= _prefix #>.Lib.Data.Core; 4 | 5 | namespace <#= _prefix #>.Module.<#= _model.Module.Code #>.Infrastructure.Repositories 6 | { 7 | public class <#= _model.Module.Code #>DbContext : DbContext 8 | { 9 | public <#= _model.Module.Code #>DbContext(IDbContextOptions options) : base(options) 10 | { 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Library/Infrastructure/Repositories/MySqlRepository.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | using <#= _prefix #>.Lib.Data.Abstractions; 3 | 4 | namespace <#= _prefix #>.Module.<#= _model.Module.Code #>.Infrastructure.Repositories.MySql 5 | { 6 | public class <#= _class.Name #>Repository : SqlServer.<#= _class.Name #>Repository 7 | { 8 | public <#= _class.Name #>Repository(IDbContext dbContext) : base(dbContext) 9 | { 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Library/Infrastructure/Repositories/PostgreSQLRepository.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | using <#= _prefix #>.Lib.Data.Abstractions; 3 | 4 | namespace <#= _prefix #>.Module.<#= _model.Module.Code #>.Infrastructure.Repositories.PostgreSQL 5 | { 6 | public class <#= _class.Name #>Repository : SqlServer.<#= _class.Name #>Repository 7 | { 8 | public <#= _class.Name #>Repository(IDbContext dbContext) : base(dbContext) 9 | { 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Library/Infrastructure/Repositories/SQLiteRepository.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | using <#= _prefix #>.Lib.Data.Abstractions; 3 | 4 | namespace <#= _prefix #>.Module.<#= _model.Module.Code #>.Infrastructure.Repositories.SQLite 5 | { 6 | public class <#= _class.Name #>Repository : SqlServer.<#= _class.Name #>Repository 7 | { 8 | public <#= _class.Name #>Repository(IDbContext dbContext) : base(dbContext) 9 | { 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/BabelConfig.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.UI.App 5 | { 6 | public partial class BabelConfig : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | 10 | public BabelConfig(TemplateBuildModel model) 11 | { 12 | _model = model; 13 | } 14 | 15 | public bool IsGlobal => true; 16 | 17 | public void Save() 18 | { 19 | var dir = Path.Combine(_model.RootPath, $"src/UI/{_model.Module.WebUIDicName}"); 20 | if (!Directory.Exists(dir)) 21 | Directory.CreateDirectory(dir); 22 | 23 | var content = TransformText(); 24 | var filePath = Path.Combine(dir, "babel.config.js"); 25 | File.WriteAllText(filePath, content); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/BabelConfig.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamoldli/NetModular.Module.CodeGenerator/a7c1992045e6e926aa61a34ff52e6bdec191413f/src/Library/Infrastructure/Templates/Default/T4/src/UI/App/BabelConfig.cs -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/BabelConfig.tt: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | [ 4 | '@vue/cli-plugin-babel/preset', 5 | { 6 | useBuiltIns: 'entry' 7 | } 8 | ] 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/Browserslistrc.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.UI.App 5 | { 6 | public partial class Browserslistrc : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | 10 | public Browserslistrc(TemplateBuildModel model) 11 | { 12 | _model = model; 13 | } 14 | 15 | public bool IsGlobal => true; 16 | 17 | public void Save() 18 | { 19 | var dir = Path.Combine(_model.RootPath, $"src/UI/{_model.Module.WebUIDicName}"); 20 | if (!Directory.Exists(dir)) 21 | Directory.CreateDirectory(dir); 22 | 23 | var content = TransformText(); 24 | var filePath = Path.Combine(dir, ".browserslistrc"); 25 | File.WriteAllText(filePath, content); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/Browserslistrc.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamoldli/NetModular.Module.CodeGenerator/a7c1992045e6e926aa61a34ff52e6bdec191413f/src/Library/Infrastructure/Templates/Default/T4/src/UI/App/Browserslistrc.cs -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/Browserslistrc.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | > 1% 3 | last 2 versions -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/Eslintrc.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.UI.App 5 | { 6 | public partial class Eslintrc : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | 10 | public Eslintrc(TemplateBuildModel model) 11 | { 12 | _model = model; 13 | } 14 | 15 | public bool IsGlobal => true; 16 | 17 | public void Save() 18 | { 19 | var dir = Path.Combine(_model.RootPath, $"src/UI/{_model.Module.WebUIDicName}"); 20 | if (!Directory.Exists(dir)) 21 | Directory.CreateDirectory(dir); 22 | 23 | var content = TransformText(); 24 | var filePath = Path.Combine(dir, ".eslintrc.js"); 25 | File.WriteAllText(filePath, content); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/Eslintrc.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamoldli/NetModular.Module.CodeGenerator/a7c1992045e6e926aa61a34ff52e6bdec191413f/src/Library/Infrastructure/Templates/Default/T4/src/UI/App/Eslintrc.cs -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/Eslintrc.tt: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true 5 | }, 6 | extends: ['plugin:vue/essential', '@vue/prettier'], 7 | rules: { 8 | 'no-console': 'off', 9 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' 10 | }, 11 | parserOptions: { 12 | parser: 'babel-eslint' 13 | }, 14 | globals: { 15 | $http: 'readonly', 16 | $api: 'readonly', 17 | $const: 'readonly' 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/Package.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.UI.App 5 | { 6 | public partial class Package : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | private readonly string _prefix; 10 | 11 | public Package(TemplateBuildModel model) 12 | { 13 | _model = model; 14 | _prefix = _model.Module.Prefix.ToLower(); 15 | } 16 | 17 | public bool IsGlobal => true; 18 | 19 | public void Save() 20 | { 21 | var dir = Path.Combine(_model.RootPath, $"src/UI/{_model.Module.WebUIDicName}"); 22 | if (!Directory.Exists(dir)) 23 | Directory.CreateDirectory(dir); 24 | 25 | var content = TransformText(); 26 | var filePath = Path.Combine(dir, "package.json"); 27 | File.WriteAllText(filePath, content); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/Package.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamoldli/NetModular.Module.CodeGenerator/a7c1992045e6e926aa61a34ff52e6bdec191413f/src/Library/Infrastructure/Templates/Default/T4/src/UI/App/Package.cs -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/PostcssConfig.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.UI.App 5 | { 6 | public partial class PostcssConfig : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | 10 | public PostcssConfig(TemplateBuildModel model) 11 | { 12 | _model = model; 13 | } 14 | 15 | public bool IsGlobal => true; 16 | 17 | public void Save() 18 | { 19 | var dir = Path.Combine(_model.RootPath, $"src/UI/{_model.Module.WebUIDicName}"); 20 | if (!Directory.Exists(dir)) 21 | Directory.CreateDirectory(dir); 22 | 23 | var content = TransformText(); 24 | var filePath = Path.Combine(dir, "postcss.config.js"); 25 | File.WriteAllText(filePath, content); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/PostcssConfig.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamoldli/NetModular.Module.CodeGenerator/a7c1992045e6e926aa61a34ff52e6bdec191413f/src/Library/Infrastructure/Templates/Default/T4/src/UI/App/PostcssConfig.cs -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/PostcssConfig.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | module.exports = { 3 | plugins: { 4 | autoprefixer: {} 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/Prettierrc.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.UI.App 5 | { 6 | public partial class Prettierrc : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | 10 | public Prettierrc(TemplateBuildModel model) 11 | { 12 | _model = model; 13 | } 14 | 15 | public bool IsGlobal => true; 16 | 17 | public void Save() 18 | { 19 | var dir = Path.Combine(_model.RootPath, $"src/UI/{_model.Module.WebUIDicName}"); 20 | if (!Directory.Exists(dir)) 21 | Directory.CreateDirectory(dir); 22 | 23 | var content = TransformText(); 24 | var filePath = Path.Combine(dir, ".prettierrc"); 25 | File.WriteAllText(filePath, content); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/Prettierrc.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | { 3 | "tabWidth": 2, 4 | "semi": false, 5 | "singleQuote": true, 6 | "printWidth": 200 7 | } 8 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/VueConfig.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.UI.App 5 | { 6 | public partial class VueConfig : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | private readonly string _prefix; 10 | 11 | public VueConfig(TemplateBuildModel model) 12 | { 13 | _model = model; 14 | _prefix = _model.Module.Prefix.ToLower(); 15 | } 16 | 17 | public bool IsGlobal => true; 18 | 19 | public void Save() 20 | { 21 | var dir = Path.Combine(_model.RootPath, $"src/UI/{_model.Module.WebUIDicName}"); 22 | if (!Directory.Exists(dir)) 23 | Directory.CreateDirectory(dir); 24 | 25 | var content = TransformText(); 26 | var filePath = Path.Combine(dir, "vue.config.js"); 27 | File.WriteAllText(filePath, content); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/VueConfig.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamoldli/NetModular.Module.CodeGenerator/a7c1992045e6e926aa61a34ff52e6bdec191413f/src/Library/Infrastructure/Templates/Default/T4/src/UI/App/VueConfig.cs -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/Index.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.UI.App.src 5 | { 6 | public partial class Index : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | 10 | public Index(TemplateBuildModel model) 11 | { 12 | _model = model; 13 | } 14 | 15 | public bool IsGlobal => true; 16 | 17 | public void Save() 18 | { 19 | var dir = Path.Combine(_model.RootPath, $"src/UI/{_model.Module.WebUIDicName}/src"); 20 | if (!Directory.Exists(dir)) 21 | Directory.CreateDirectory(dir); 22 | 23 | var content = TransformText(); 24 | var filePath = Path.Combine(dir, "index.js"); 25 | File.WriteAllText(filePath, content); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/Index.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamoldli/NetModular.Module.CodeGenerator/a7c1992045e6e926aa61a34ff52e6bdec191413f/src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/Index.cs -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/Index.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | import './api' 3 | import store from './store' 4 | import routes from './routes' 5 | import components from './components' 6 | import module from './module' 7 | 8 | export default { 9 | module, 10 | routes, 11 | store, 12 | components 13 | } 14 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/Main.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.UI.App.src 5 | { 6 | public partial class Main : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | private readonly string _prefix; 10 | 11 | public Main(TemplateBuildModel model) 12 | { 13 | _model = model; 14 | _prefix = _model.Module.Prefix.ToLower(); 15 | } 16 | 17 | public bool IsGlobal => true; 18 | 19 | public void Save() 20 | { 21 | var dir = Path.Combine(_model.RootPath, $"src/UI/{_model.Module.WebUIDicName}/src"); 22 | if (!Directory.Exists(dir)) 23 | Directory.CreateDirectory(dir); 24 | 25 | var content = TransformText(); 26 | var filePath = Path.Combine(dir, "main.js"); 27 | File.WriteAllText(filePath, content); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/Main.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamoldli/NetModular.Module.CodeGenerator/a7c1992045e6e926aa61a34ff52e6bdec191413f/src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/Main.cs -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/Main.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | import WebHost from '<#= _prefix #>-module-admin' 3 | import config from './config' 4 | import <#= _model.Module.Code #> from './index' 5 | 6 | // 注入模块 7 | WebHost.registerModule(<#= _model.Module.Code #>) 8 | 9 | // 启动 10 | WebHost.start(config) 11 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/Module.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.UI.App.src 5 | { 6 | public partial class Module : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | 10 | public Module(TemplateBuildModel model) 11 | { 12 | _model = model; 13 | } 14 | 15 | public bool IsGlobal => true; 16 | 17 | public void Save() 18 | { 19 | var dir = Path.Combine(_model.RootPath, $"src/UI/{_model.Module.WebUIDicName}/src"); 20 | if (!Directory.Exists(dir)) 21 | Directory.CreateDirectory(dir); 22 | 23 | var content = TransformText(); 24 | var filePath = Path.Combine(dir, "module.js"); 25 | File.WriteAllText(filePath, content); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/Module.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamoldli/NetModular.Module.CodeGenerator/a7c1992045e6e926aa61a34ff52e6bdec191413f/src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/Module.cs -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/Module.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | /** 模块信息 */ 3 | const pack = require('../package.json') 4 | 5 | export default { 6 | id: pack.id, 7 | name: pack.title, 8 | code: pack.code, 9 | version: pack.version, 10 | description: pack.description 11 | } 12 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/api/Index.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.UI.App.src.api 5 | { 6 | public partial class Index : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | 10 | public Index(TemplateBuildModel model) 11 | { 12 | _model = model; 13 | } 14 | 15 | public bool IsGlobal => true; 16 | 17 | public void Save() 18 | { 19 | var dir = Path.Combine(_model.RootPath, $"src/UI/{_model.Module.WebUIDicName}/src/api"); 20 | if (!Directory.Exists(dir)) 21 | Directory.CreateDirectory(dir); 22 | 23 | var content = TransformText(); 24 | var filePath = Path.Combine(dir, "index.js"); 25 | File.WriteAllText(filePath, content); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/api/Index.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamoldli/NetModular.Module.CodeGenerator/a7c1992045e6e926aa61a34ff52e6bdec191413f/src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/api/Index.cs -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/api/Index.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | import module from '../module' 3 | 4 | let apis = {} 5 | const requireComponent = require.context('./components', true, /\.*\.js$/) 6 | requireComponent.keys().map(fileName => { 7 | const name = fileName.replace('./', '').replace('.js', '') 8 | const func = requireComponent(fileName).default 9 | apis[name] = func(name) 10 | }) 11 | 12 | $api[module.code] = apis 13 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/api/components/Entity.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Linq; 3 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 4 | 5 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.UI.App.src.api.components 6 | { 7 | public partial class Entity : ITemplateHandler 8 | { 9 | private readonly TemplateBuildModel _model; 10 | private ClassBuildModel _class; 11 | 12 | public Entity(TemplateBuildModel model) 13 | { 14 | _model = model; 15 | } 16 | 17 | public bool IsGlobal => false; 18 | 19 | public void Save() 20 | { 21 | var dir = Path.Combine(_model.RootPath, 22 | $"src/UI/{_model.Module.WebUIDicName}/src/api/components"); 23 | 24 | if (!Directory.Exists(dir)) 25 | Directory.CreateDirectory(dir); 26 | 27 | if (_model.Module.ClassList != null && _model.Module.ClassList.Any()) 28 | { 29 | foreach (var classModel in _model.Module.ClassList) 30 | { 31 | _class = classModel; 32 | 33 | //清空 34 | GenerationEnvironment.Clear(); 35 | 36 | var content = TransformText(); 37 | 38 | var filePath = Path.Combine(dir, $"{_class.Name.FirstCharToLower()}.js"); 39 | File.WriteAllText(filePath, content); 40 | } 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/api/components/Entity.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamoldli/NetModular.Module.CodeGenerator/a7c1992045e6e926aa61a34ff52e6bdec191413f/src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/api/components/Entity.cs -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/api/components/Entity.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | import module from '../../module' 3 | 4 | export default name => { 5 | const root = `${module.code}/${name}/` 6 | const crud = $http.crud(root) 7 | 8 | return { 9 | ...crud 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/components/Components.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.UI.App.src.components 5 | { 6 | public partial class Components : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | private readonly string _prefix; 10 | 11 | public Components(TemplateBuildModel model) 12 | { 13 | _model = model; 14 | _prefix = _model.Module.Prefix.ToLower(); 15 | } 16 | 17 | public bool IsGlobal => true; 18 | 19 | public void Save() 20 | { 21 | var dir = Path.Combine(_model.RootPath, $"src/UI/{_model.Module.WebUIDicName}/src/components"); 22 | if (!Directory.Exists(dir)) 23 | Directory.CreateDirectory(dir); 24 | 25 | var content = TransformText(); 26 | var filePath = Path.Combine(dir, "index.js"); 27 | File.WriteAllText(filePath, content); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/components/Components.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamoldli/NetModular.Module.CodeGenerator/a7c1992045e6e926aa61a34ff52e6bdec191413f/src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/components/Components.cs -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/components/Components.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | import library from '<#= _prefix #>-ui/packages/library' 3 | let components = [] 4 | const requireComponent = require.context('./', true, /index\.vue$/) 5 | requireComponent.keys().map(fileName => { 6 | components.push({ 7 | name: `${library.prefix.toLowerCase()}-${fileName.split('/')[1]}`, 8 | component: requireComponent(fileName).default 9 | }) 10 | }) 11 | export default components 12 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/components/ConfigPage.Extend.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Text; 5 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 6 | 7 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.UI.App.src.components 8 | { 9 | public partial class ConfigPage : ITemplateHandler 10 | { 11 | private readonly TemplateBuildModel _model; 12 | private readonly string _prefix; 13 | private readonly string _uiPrefix; 14 | 15 | public ConfigPage(TemplateBuildModel model) 16 | { 17 | _model = model; 18 | _prefix = _model.Module.Prefix.ToLower(); 19 | _uiPrefix = _model.Module.UiPrefix.ToLower(); 20 | } 21 | 22 | public bool IsGlobal => true; 23 | 24 | public void Save() 25 | { 26 | var dir = Path.Combine(_model.RootPath, $"src/UI/{_model.Module.WebUIDicName}/src/components/config-{_model.Module.Code.ToLower()}"); 27 | if (!Directory.Exists(dir)) 28 | Directory.CreateDirectory(dir); 29 | 30 | var content = TransformText(); 31 | var filePath = Path.Combine(dir, "index.vue"); 32 | File.WriteAllText(filePath, content); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/components/ConfigPage.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamoldli/NetModular.Module.CodeGenerator/a7c1992045e6e926aa61a34ff52e6bdec191413f/src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/components/ConfigPage.cs -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/components/ConfigPage.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | 7 | 34 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/config/Config.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.UI.App.src.config 5 | { 6 | public partial class Config : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | 10 | public Config(TemplateBuildModel model) 11 | { 12 | _model = model; 13 | } 14 | 15 | public bool IsGlobal => true; 16 | 17 | public void Save() 18 | { 19 | var dir = Path.Combine(_model.RootPath, $"src/UI/{_model.Module.WebUIDicName}/src/config"); 20 | if (!Directory.Exists(dir)) 21 | Directory.CreateDirectory(dir); 22 | 23 | var content = TransformText(); 24 | var filePath = Path.Combine(dir, "index.js"); 25 | File.WriteAllText(filePath, content); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/config/Config.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamoldli/NetModular.Module.CodeGenerator/a7c1992045e6e926aa61a34ff52e6bdec191413f/src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/config/Config.cs -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/config/Config.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | const isDev = process.env.NODE_ENV !== 'production' 3 | 4 | const config = { 5 | baseUrl: '../api/' 6 | } 7 | 8 | // 开发模式 9 | if (isDev) { 10 | config.baseUrl = 'http://localhost:<#= 6220 + _model.Module.No #>/api/' 11 | } 12 | export default config 13 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/routes/Routes.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.UI.App.src.routes 5 | { 6 | public partial class Routes : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | private readonly string _prefix; 10 | 11 | public Routes(TemplateBuildModel model) 12 | { 13 | _model = model; 14 | _prefix = _model.Module.Prefix.ToLower(); 15 | } 16 | 17 | public bool IsGlobal => true; 18 | 19 | public void Save() 20 | { 21 | var dir = Path.Combine(_model.RootPath, $"src/UI/{_model.Module.WebUIDicName}/src/routes"); 22 | if (!Directory.Exists(dir)) 23 | Directory.CreateDirectory(dir); 24 | 25 | var content = TransformText(); 26 | var filePath = Path.Combine(dir, "index.js"); 27 | File.WriteAllText(filePath, content); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/routes/Routes.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamoldli/NetModular.Module.CodeGenerator/a7c1992045e6e926aa61a34ff52e6bdec191413f/src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/routes/Routes.cs -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/routes/Routes.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | import loadRoutes from '<#= _prefix #>-ui/packages/utils/load-routes' 3 | const requireComponent = require.context('../views', true, /\page.js$/) 4 | export default loadRoutes(requireComponent.keys().map(fileName => requireComponent(fileName).route)) 5 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/store/Store.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.UI.App.src.store 5 | { 6 | public partial class Store : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | 10 | public Store(TemplateBuildModel model) 11 | { 12 | _model = model; 13 | } 14 | 15 | public bool IsGlobal => true; 16 | 17 | public void Save() 18 | { 19 | var dir = Path.Combine(_model.RootPath, $"src/UI/{_model.Module.WebUIDicName}/src/store"); 20 | if (!Directory.Exists(dir)) 21 | Directory.CreateDirectory(dir); 22 | 23 | var content = TransformText(); 24 | var filePath = Path.Combine(dir, "index.js"); 25 | File.WriteAllText(filePath, content); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/store/Store.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamoldli/NetModular.Module.CodeGenerator/a7c1992045e6e926aa61a34ff52e6bdec191413f/src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/store/Store.cs -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/store/Store.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | export default { 3 | modules: {} 4 | } 5 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/views/components/SavePage.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamoldli/NetModular.Module.CodeGenerator/a7c1992045e6e926aa61a34ff52e6bdec191413f/src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/views/components/SavePage.cs -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/views/components/SavePage.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | <#@ import namespace="NetModular.Lib.Utils.Core.Extensions" #> 3 | 16 | 40 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/views/index/Cols.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamoldli/NetModular.Module.CodeGenerator/a7c1992045e6e926aa61a34ff52e6bdec191413f/src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/views/index/Cols.cs -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/views/index/Cols.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | export default [ 3 | <# for(var i = 0;i < _properties.Count;i++){ var p = _properties[i]; #> 4 | <# if(p.Name == "Id"){ #> 5 | { 6 | name: 'id', 7 | label: '编号', 8 | width: 250, 9 | show: false 10 | }, 11 | <# } else {#> 12 | { 13 | name: '<#= p.CamelName #>', 14 | label: '<#= p.Remarks #>' 15 | }<#= _class.IsEntityBase || i < _properties.Count - 1 ? ",":"" #> 16 | <# } #> 17 | <# } #> 18 | <# if(_class.IsEntityBase){ #> 19 | { 20 | name: 'creator', 21 | label: '创建人', 22 | width: 100, 23 | show: false 24 | }, 25 | { 26 | name: 'createdTime', 27 | label: '创建时间', 28 | width: 150, 29 | show: false 30 | } 31 | <# } #> 32 | ] 33 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/views/index/Index.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamoldli/NetModular.Module.CodeGenerator/a7c1992045e6e926aa61a34ff52e6bdec191413f/src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/views/index/Index.cs -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/views/index/Page.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Linq; 3 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 4 | 5 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.UI.App.src.views.index 6 | { 7 | public partial class Page : ITemplateHandler 8 | { 9 | private readonly TemplateBuildModel _model; 10 | private ClassBuildModel _class; 11 | 12 | public Page(TemplateBuildModel model) 13 | { 14 | _model = model; 15 | } 16 | 17 | public bool IsGlobal => false; 18 | 19 | public void Save() 20 | { 21 | if (_model.Module.ClassList != null && _model.Module.ClassList.Any()) 22 | { 23 | foreach (var classModel in _model.Module.ClassList) 24 | { 25 | _class = classModel; 26 | 27 | var dir = Path.Combine(_model.RootPath, $"src/UI/{_model.Module.WebUIDicName}/src/views", _class.Name.FirstCharToLower(), "index"); 28 | if (!Directory.Exists(dir)) 29 | Directory.CreateDirectory(dir); 30 | 31 | //清空 32 | GenerationEnvironment.Clear(); 33 | 34 | var content = TransformText(); 35 | 36 | var filePath = Path.Combine(dir, $"page.js"); 37 | File.WriteAllText(filePath, content); 38 | } 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/views/index/Page.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamoldli/NetModular.Module.CodeGenerator/a7c1992045e6e926aa61a34ff52e6bdec191413f/src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/views/index/Page.cs -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/src/views/index/Page.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | /** 页面信息 */ 3 | const page = new (function() { 4 | this.title = '<#= _class.Remarks #>列表' 5 | this.icon = '<#= _class.MenuIcon #>' 6 | this.name = '<#= _model.Module.Code.ToLower() #>_<#= _class.Name.ToLower() #>' 7 | this.path = '/<#= _model.Module.Code.ToLower() #>/<#= _class.Name.ToLower() #>' 8 | 9 | // 关联权限 10 | this.permissions = [`${this.name}_query_get`] 11 | 12 | // 按钮 13 | this.buttons = { 14 | add: { 15 | text: '添加', 16 | type: 'success', 17 | icon: 'add', 18 | code: `${this.name}_add`, 19 | permissions: [`${this.name}_add_post`] 20 | }, 21 | edit: { 22 | text: '编辑', 23 | type: 'text', 24 | icon: 'edit', 25 | code: `${this.name}_edit`, 26 | permissions: [`${this.name}_edit_get`, `${this.name}_update_post`] 27 | }, 28 | del: { 29 | text: '删除', 30 | type: 'text', 31 | icon: 'delete', 32 | code: `${this.name}_del`, 33 | permissions: [`${this.name}_delete_delete`] 34 | } 35 | } 36 | })() 37 | 38 | /** 路由信息 */ 39 | export const route = { 40 | page, 41 | component: () => import(/* webpackChunkName: "<#= _model.Module.Code #>.<#= _class.Name #>" */ './index') 42 | } 43 | 44 | export default page 45 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/vscode/settings.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.UI.App.vscode 5 | { 6 | public partial class settings : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | 10 | public settings(TemplateBuildModel model) 11 | { 12 | _model = model; 13 | } 14 | 15 | public bool IsGlobal => true; 16 | 17 | public void Save() 18 | { 19 | var content = TransformText(); 20 | var dir = Path.Combine(_model.RootPath, $"src/UI/{_model.Module.WebUIDicName}/.vscode"); 21 | if (!Directory.Exists(dir)) 22 | { 23 | Directory.CreateDirectory(dir); 24 | } 25 | 26 | var filePath = Path.Combine(dir, "settings.json"); 27 | File.WriteAllText(filePath, content); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/vscode/settings.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamoldli/NetModular.Module.CodeGenerator/a7c1992045e6e926aa61a34ff52e6bdec191413f/src/Library/Infrastructure/Templates/Default/T4/src/UI/App/vscode/settings.cs -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/UI/App/vscode/settings.tt: -------------------------------------------------------------------------------- 1 | { 2 | "editor.defaultFormatter": "esbenp.prettier-vscode", 3 | "editor.formatOnPaste": true, 4 | "editor.formatOnSave": true, 5 | "editor.formatOnType": true, 6 | "editor.codeActionsOnSave": { 7 | "source.fixAll.tslint": true, 8 | "source.fixAll.eslint": true 9 | } 10 | } -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Web/Controllers/Controller.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Linq; 3 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 4 | 5 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.Web.Controllers 6 | { 7 | public partial class Controller : ITemplateHandler 8 | { 9 | private readonly TemplateBuildModel _model; 10 | private readonly string _prefix; 11 | private ClassBuildModel _class; 12 | 13 | public Controller(TemplateBuildModel model) 14 | { 15 | _model = model; 16 | _prefix = model.Module.Prefix; 17 | } 18 | 19 | public bool IsGlobal => false; 20 | 21 | public void Save() 22 | { 23 | var dir = Path.Combine(_model.RootPath, "src/Web/Controllers"); 24 | if (!Directory.Exists(dir)) 25 | Directory.CreateDirectory(dir); 26 | 27 | if (_model.Module.ClassList != null && _model.Module.ClassList.Any()) 28 | { 29 | foreach (var classModel in _model.Module.ClassList) 30 | { 31 | _class = classModel; 32 | 33 | //清空 34 | GenerationEnvironment.Clear(); 35 | 36 | var content = TransformText(); 37 | 38 | var filePath = Path.Combine(dir, $"{_class.Name}Controller.cs"); 39 | File.WriteAllText(filePath, content); 40 | } 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Web/Csproj.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.NuGet; 3 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 4 | 5 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.Web 6 | { 7 | public partial class Csproj : ITemplateHandler 8 | { 9 | private readonly TemplateBuildModel _model; 10 | private readonly string _prefix; 11 | private readonly NuGetPackageVersions _versions; 12 | 13 | public Csproj(TemplateBuildModel model) 14 | { 15 | _model = model; 16 | _prefix = model.Module.Prefix; 17 | _versions = _model.NuGetPackageVersions; 18 | } 19 | 20 | public bool IsGlobal => true; 21 | 22 | public void Save() 23 | { 24 | var dir = Path.Combine(_model.RootPath, "src/Web"); 25 | if (!Directory.Exists(dir)) 26 | Directory.CreateDirectory(dir); 27 | 28 | var content = TransformText(); 29 | var filePath = Path.Combine(dir, "Web.csproj"); 30 | File.WriteAllText(filePath, content); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Web/Csproj.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | 3 | 4 | 5 | false 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | true 23 | true 24 | Always 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Web/ModuleController.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.Web 5 | { 6 | public partial class ModuleController : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | private readonly string _prefix; 10 | 11 | public ModuleController(TemplateBuildModel model) 12 | { 13 | _model = model; 14 | _prefix = model.Module.Prefix; 15 | } 16 | 17 | public bool IsGlobal => true; 18 | 19 | public void Save() 20 | { 21 | var dir = Path.Combine(_model.RootPath, "src/Web"); 22 | if (!Directory.Exists(dir)) 23 | Directory.CreateDirectory(dir); 24 | 25 | var content = TransformText(); 26 | var filePath = Path.Combine(dir, "ModuleController.cs"); 27 | File.WriteAllText(filePath, content); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Web/ModuleController.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | using Microsoft.AspNetCore.Mvc; 3 | using <#= _prefix #>.Lib.Auth.Web; 4 | 5 | namespace <#= _prefix #>.Module.<#= _model.Module.Code #>.Web 6 | { 7 | [Area("<#= _model.Module.Code #>")] 8 | public abstract class ModuleController : ControllerAbstract 9 | { 10 | 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Web/ModuleInitializer.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.Web 5 | { 6 | public partial class ModuleInitializer : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | private readonly string _prefix; 10 | 11 | public ModuleInitializer(TemplateBuildModel model) 12 | { 13 | _model = model; 14 | _prefix = model.Module.Prefix; 15 | } 16 | 17 | public bool IsGlobal => true; 18 | 19 | public void Save() 20 | { 21 | var dir = Path.Combine(_model.RootPath, "src/Web"); 22 | if (!Directory.Exists(dir)) 23 | Directory.CreateDirectory(dir); 24 | 25 | var content = TransformText(); 26 | var filePath = Path.Combine(dir, "ModuleInitializer.cs"); 27 | File.WriteAllText(filePath, content); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/Web/ModuleInitializer.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | using Microsoft.AspNetCore.Builder; 3 | using Microsoft.AspNetCore.Mvc; 4 | using Microsoft.Extensions.Configuration; 5 | using Microsoft.Extensions.DependencyInjection; 6 | using Microsoft.Extensions.Hosting; 7 | using <#= _prefix #>.Lib.Module.Abstractions; 8 | using <#= _prefix #>.Lib.Module.AspNetCore; 9 | 10 | namespace <#= _prefix #>.Module.<#= _model.Module.Code #>.Web 11 | { 12 | public class ModuleInitializer : IModuleInitializer 13 | { 14 | /// 15 | /// 注入服务 16 | /// 17 | public void ConfigureServices(IServiceCollection services, IModuleCollection modules, IHostEnvironment env, IConfiguration cfg) 18 | { 19 | } 20 | 21 | /// 22 | /// 配置中间件 23 | /// 24 | public void Configure(IApplicationBuilder app, IHostEnvironment env) 25 | { 26 | } 27 | 28 | /// 29 | /// 配置MVC功能 30 | /// 31 | public void ConfigureMvc(MvcOptions mvcOptions) 32 | { 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/WebHost/AppSettings.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.WebHost 5 | { 6 | public partial class AppSettings : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | private readonly string _dbPrefix; 10 | 11 | public AppSettings(TemplateBuildModel model) 12 | { 13 | _model = model; 14 | _dbPrefix = model.Module.UiPrefix; 15 | } 16 | 17 | public bool IsGlobal => true; 18 | 19 | public void Save() 20 | { 21 | var dir = Path.Combine(_model.RootPath, "src/WebHost"); 22 | if (!Directory.Exists(dir)) 23 | Directory.CreateDirectory(dir); 24 | 25 | var content = TransformText(); 26 | var filePath = Path.Combine(dir, "appsettings.json"); 27 | File.WriteAllText(filePath, content); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/WebHost/AppSettingsDevelopment.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.WebHost 5 | { 6 | public partial class AppSettingsDevelopment : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | 10 | public AppSettingsDevelopment(TemplateBuildModel model) 11 | { 12 | _model = model; 13 | } 14 | 15 | public bool IsGlobal => true; 16 | 17 | public void Save() 18 | { 19 | var dir = Path.Combine(_model.RootPath, "src/WebHost"); 20 | if (!Directory.Exists(dir)) 21 | Directory.CreateDirectory(dir); 22 | 23 | var content = TransformText(); 24 | var filePath = Path.Combine(dir, "appsettings.Development.json"); 25 | File.WriteAllText(filePath, content); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/WebHost/AppSettingsDevelopment.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | { 3 | "Serilog": { 4 | "MinimumLevel": { 5 | "Default": "Debug", 6 | "Override": { 7 | "Microsoft": "Debug", 8 | "System": "Debug" 9 | } 10 | }, 11 | "WriteTo": [ 12 | //输入到控制台 13 | { 14 | "Name": "Console", 15 | "Args": { 16 | "theme": "Serilog.Sinks.SystemConsole.Themes.AnsiConsoleTheme::Code, Serilog.Sinks.Console", 17 | "outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj} {NewLine}{Exception}" 18 | } 19 | }, 20 | //输出到文件 21 | { 22 | "Name": "File", 23 | "Args": { 24 | //文件路径 25 | "path": "log/log.log", 26 | //文件滚动方式 27 | "rollingInterval": "Day", 28 | //消息输出格式 29 | "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}{Exception}", 30 | //文件数量 31 | "retainedFileCountLimit": 60, 32 | //使用缓冲,提高写入效率 33 | "buffered": false 34 | } 35 | } 36 | ] 37 | }, 38 | "Db": { 39 | "Logging": true 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/WebHost/Csproj.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.NuGet; 3 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 4 | 5 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.WebHost 6 | { 7 | public partial class Csproj : ITemplateHandler 8 | { 9 | private readonly TemplateBuildModel _model; 10 | private readonly string _prefix; 11 | private readonly NuGetPackageVersions _versions; 12 | 13 | public Csproj(TemplateBuildModel model) 14 | { 15 | _model = model; 16 | _prefix = model.Module.Prefix; 17 | _versions = _model.NuGetPackageVersions; 18 | } 19 | 20 | public bool IsGlobal => true; 21 | 22 | public void Save() 23 | { 24 | var dir = Path.Combine(_model.RootPath, "src/WebHost"); 25 | if (!Directory.Exists(dir)) 26 | Directory.CreateDirectory(dir); 27 | 28 | var content = TransformText(); 29 | var filePath = Path.Combine(dir, "WebHost.csproj"); 30 | File.WriteAllText(filePath, content); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/WebHost/Program.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.WebHost 5 | { 6 | public partial class Program : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | private readonly string _prefix; 10 | 11 | public Program(TemplateBuildModel model) 12 | { 13 | _model = model; 14 | _prefix = model.Module.Prefix; 15 | } 16 | 17 | public bool IsGlobal => true; 18 | 19 | public void Save() 20 | { 21 | var dir = Path.Combine(_model.RootPath, "src/WebHost"); 22 | if (!Directory.Exists(dir)) 23 | Directory.CreateDirectory(dir); 24 | 25 | var content = TransformText(); 26 | var filePath = Path.Combine(dir, "Program.cs"); 27 | File.WriteAllText(filePath, content); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/WebHost/Program.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | using <#= _prefix #>.Lib.Host.Web; 3 | 4 | namespace <#= _prefix #>.Module.<#= _model.Module.Code #>.WebHost 5 | { 6 | public class Program 7 | { 8 | public static void Main(string[] args) 9 | { 10 | new HostBuilder().Run(args); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/WebHost/Properties/LaunchSettings.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.WebHost.Properties 5 | { 6 | public partial class LaunchSettings : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | 10 | public LaunchSettings(TemplateBuildModel model) 11 | { 12 | _model = model; 13 | } 14 | 15 | public bool IsGlobal => true; 16 | 17 | public void Save() 18 | { 19 | var dir = Path.Combine(_model.RootPath, "src/WebHost/Properties/"); 20 | if (!Directory.Exists(dir)) 21 | Directory.CreateDirectory(dir); 22 | 23 | var content = TransformText(); 24 | var filePath = Path.Combine(dir, "launchSettings.json"); 25 | File.WriteAllText(filePath, content); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/WebHost/Properties/LaunchSettings.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamoldli/NetModular.Module.CodeGenerator/a7c1992045e6e926aa61a34ff52e6bdec191413f/src/Library/Infrastructure/Templates/Default/T4/src/WebHost/Properties/LaunchSettings.cs -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/WebHost/Properties/LaunchSettings.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | { 3 | "$schema": "http://json.schemastore.org/launchsettings.json", 4 | "profiles": { 5 | "WebHost": { 6 | "commandName": "Project", 7 | "launchBrowser": true, 8 | "launchUrl": "swagger", 9 | "environmentVariables": { 10 | "ASPNETCORE_ENVIRONMENT": "Development" 11 | }, 12 | "applicationUrl": "http://localhost:<#= _model.Module.No + 6220 #>" 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/WebHost/Startup.Extend.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Default.T4.src.WebHost 5 | { 6 | public partial class Startup : ITemplateHandler 7 | { 8 | private readonly TemplateBuildModel _model; 9 | private readonly string _prefix; 10 | 11 | public Startup(TemplateBuildModel model) 12 | { 13 | _model = model; 14 | _prefix = model.Module.Prefix; 15 | } 16 | 17 | public bool IsGlobal => true; 18 | 19 | public void Save() 20 | { 21 | var dir = Path.Combine(_model.RootPath, "src/WebHost"); 22 | if (!Directory.Exists(dir)) 23 | Directory.CreateDirectory(dir); 24 | 25 | var content = TransformText(); 26 | var filePath = Path.Combine(dir, "Startup.cs"); 27 | File.WriteAllText(filePath, content); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Default/T4/src/WebHost/Startup.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | using Microsoft.Extensions.Configuration; 3 | using Microsoft.Extensions.Hosting; 4 | using <#= _prefix #>.Lib.Host.Web; 5 | 6 | namespace <#= _prefix #>.Module.<#= _model.Module.Code #>.WebHost 7 | { 8 | public class Startup : StartupAbstract 9 | { 10 | public Startup(IHostEnvironment env, IConfiguration cfg) : base(env, cfg) 11 | { 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/ITemplateBuilder.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 2 | 3 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates 4 | { 5 | /// 6 | /// 模板生成器接口 7 | /// 8 | public interface ITemplateBuilder 9 | { 10 | /// 11 | /// 生成 12 | /// 13 | /// 14 | void Build(TemplateBuildModel model); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/ITemplateHandler.cs: -------------------------------------------------------------------------------- 1 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates 2 | { 3 | /// 4 | /// 模板处理 5 | /// 6 | public interface ITemplateHandler 7 | { 8 | /// 9 | /// 是否是全局文件 10 | /// 11 | bool IsGlobal { get; } 12 | 13 | /// 14 | /// 保存 15 | /// 16 | void Save(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Models/EnumBuildModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Models 5 | { 6 | /// 7 | /// 枚举生成模型 8 | /// 9 | public class EnumBuildModel 10 | { 11 | public Guid Id { get; set; } 12 | 13 | /// 14 | /// 名称 15 | /// 16 | public string Name { get; set; } 17 | 18 | /// 19 | /// 备注 20 | /// 21 | public string Remarks { get; set; } 22 | 23 | /// 24 | /// 项列表 25 | /// 26 | public List ItemList { get; set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Models/EnumItemBuildModel.cs: -------------------------------------------------------------------------------- 1 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Models 2 | { 3 | /// 4 | /// 枚举项生成模型 5 | /// 6 | public class EnumItemBuildModel 7 | { 8 | /// 9 | /// 名称 10 | /// 11 | public string Name { get; set; } 12 | 13 | /// 14 | /// 值 15 | /// 16 | public int Value { get; set; } 17 | 18 | /// 19 | /// 备注 20 | /// 21 | public string Remarks { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Models/ModelPropertyBuildModel.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using NetModular.Module.CodeGenerator.Domain.ModelProperty; 3 | using NetModular.Module.CodeGenerator.Domain.Property; 4 | 5 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Models 6 | { 7 | /// 8 | /// 模型属性模型 9 | /// 10 | public class ModelPropertyBuildModel 11 | { 12 | /// 13 | /// 模型类型 14 | /// 15 | public ModelType ModelType { get; set; } 16 | 17 | /// 18 | /// 名称 19 | /// 20 | public string Name { get; set; } 21 | 22 | /// 23 | /// 类型 24 | /// 25 | public PropertyType Type { get; set; } 26 | 27 | /// 28 | /// 可空 29 | /// 30 | public bool Nullable { get; set; } 31 | 32 | /// 33 | /// 备注 34 | /// 35 | public string Remarks { get; set; } 36 | 37 | /// 38 | /// 序号 39 | /// 40 | public int Sort { get; set; } 41 | 42 | /// 43 | /// 关联枚举 44 | /// 45 | public EnumBuildModel Enum { get; set; } 46 | 47 | /// 48 | /// 小驼峰名称 49 | /// 50 | public string CamelName => Name.First().ToString().ToLower() + Name.Substring(1); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/Models/TemplateBuildModel.cs: -------------------------------------------------------------------------------- 1 | using NetModular.Module.CodeGenerator.Infrastructure.NuGet; 2 | 3 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates.Models 4 | { 5 | /// 6 | /// 模板生成模型 7 | /// 8 | public class TemplateBuildModel 9 | { 10 | /// 11 | /// 生成整个解决方案 12 | /// 13 | public bool GenerateSln { get; set; } 14 | 15 | /// 16 | /// 代码存储根路径 17 | /// 18 | public string RootPath { get; set; } 19 | 20 | /// 21 | /// 模块模型 22 | /// 23 | public ModuleBuildModel Module { get; set; } 24 | 25 | /// 26 | /// NuGet包版本 27 | /// 28 | public NuGetPackageVersions NuGetPackageVersions { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Library/Infrastructure/Templates/TemplateBuilderAbstract.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Linq; 4 | using System.Reflection; 5 | using NetModular.Module.CodeGenerator.Infrastructure.Templates.Models; 6 | 7 | namespace NetModular.Module.CodeGenerator.Infrastructure.Templates 8 | { 9 | public class TemplateBuilderAbstract : ITemplateBuilder 10 | { 11 | public string Name { get; } 12 | 13 | protected TemplateBuilderAbstract(string name) 14 | { 15 | Name = name; 16 | } 17 | 18 | public virtual void Build(TemplateBuildModel model) 19 | { 20 | Check.NotNull(model, nameof(TemplateBuildModel), "模板生成模型不能为空"); 21 | 22 | if (!Directory.Exists(model.RootPath)) 23 | Directory.CreateDirectory(model.RootPath); 24 | 25 | var handlerTypeList = Assembly.GetExecutingAssembly().GetTypes().Where(t => 26 | typeof(ITemplateHandler) != t && typeof(ITemplateHandler).IsAssignableFrom(t) 27 | && t.FullName.Contains($"Infrastructure.Templates.{Name}")).ToList(); 28 | 29 | foreach (var type in handlerTypeList) 30 | { 31 | var instance = (ITemplateHandler)Activator.CreateInstance(type, model); 32 | if (model.GenerateSln || !instance.IsGlobal) 33 | instance.Save(); 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true 5 | }, 6 | extends: ['plugin:vue/essential', '@vue/prettier'], 7 | rules: { 8 | 'no-console': 'off', 9 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' 10 | }, 11 | parserOptions: { 12 | parser: 'babel-eslint' 13 | }, 14 | globals: { 15 | $http: 'readonly', 16 | $api: 'readonly', 17 | $const: 'readonly' 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 2, 3 | "semi": false, 4 | "singleQuote": true, 5 | "printWidth": 200 6 | } 7 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.defaultFormatter": "esbenp.prettier-vscode", 3 | "editor.formatOnPaste": true, 4 | "editor.formatOnSave": true, 5 | "editor.formatOnType": true, 6 | "editor.codeActionsOnSave": { 7 | "source.fixAll.tslint": "explicit", 8 | "source.fixAll.eslint": "explicit" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | [ 4 | '@vue/cli-plugin-babel/preset', 5 | { 6 | useBuiltIns: 'entry' 7 | } 8 | ] 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "netmodular-module-codegenerator", 3 | "version": "1.0.7", 4 | "author": "Oldli", 5 | "code": "codeGenerator", 6 | "title": "代码生成", 7 | "description": "NetModular代码生成器前端模块组件", 8 | "main": "src/index.js", 9 | "scripts": { 10 | "serve": "vue-cli-service serve", 11 | "build": "vue-cli-service build", 12 | "lint": "vue-cli-service lint", 13 | "cm": "rimraf node_modules", 14 | "cc": "rimraf node_modules/.cache", 15 | "i": "cd ../../../script && npm_install.ps1", 16 | "up": "cd ../../../script && npm_update.ps1", 17 | "pub": "cd ../../../script && npm_publish.ps1" 18 | }, 19 | "dependencies": { 20 | "netmodular-module-admin": "^1.4.7", 21 | "netmodular-ui": "^2.0.0" 22 | }, 23 | "devDependencies": { 24 | "@vue/cli-plugin-babel": "^4.2.3", 25 | "@vue/cli-plugin-eslint": "^4.2.3", 26 | "@vue/cli-plugin-router": "^4.2.3", 27 | "@vue/cli-plugin-vuex": "^4.2.3", 28 | "@vue/cli-service": "^4.2.3", 29 | "@vue/eslint-config-prettier": "^5.0.0", 30 | "babel-eslint": "^10.1.0", 31 | "eslint": "^5.16.0", 32 | "eslint-plugin-prettier": "^3.1.2", 33 | "eslint-plugin-vue": "^5.0.0", 34 | "prettier": "^1.18.2", 35 | "rimraf": "^3.0.2", 36 | "sass": "^1.26.5", 37 | "sass-loader": "^8.0.2", 38 | "vue-template-compiler": "^2.6.11" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | autoprefixer: {} 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/src/api/components/class.js: -------------------------------------------------------------------------------- 1 | import module from '../../module' 2 | 3 | export default name => { 4 | const root = `${module.code}/${name}/` 5 | const crud = $http.crud(root) 6 | const urls = { 7 | baseEntityTypeSelect: root + 'BaseEntityTypeSelect', 8 | buildCode: root + 'BuildCode' 9 | } 10 | 11 | /** 12 | * @description 获取基类类型下拉列表 13 | */ 14 | const getBaseEntityTypeSelect = () => { 15 | return $http.get(urls.baseEntityTypeSelect) 16 | } 17 | 18 | /** 生成代码 */ 19 | const buildCode = id => { 20 | return $http.get(urls.buildCode, { id }, { responseType: 'blob' }) 21 | } 22 | 23 | return { 24 | ...crud, 25 | getBaseEntityTypeSelect, 26 | buildCode 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/src/api/components/enum.js: -------------------------------------------------------------------------------- 1 | import module from '../../module' 2 | 3 | export default name => { 4 | const root = `${module.code}/${name}/` 5 | const crud = $http.crud(root) 6 | const urls = { 7 | select: root + 'select' 8 | } 9 | 10 | /** 11 | * @description 查询字典下拉列表 12 | * @param {Object} params 参数 13 | */ 14 | const select = params => { 15 | return $http.get(urls.select, params) 16 | } 17 | 18 | return { 19 | ...crud, 20 | select 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/src/api/components/enumItem.js: -------------------------------------------------------------------------------- 1 | import module from '../../module' 2 | 3 | export default name => { 4 | const root = `${module.code}/${name}/` 5 | const crud = $http.crud(root) 6 | const urls = { 7 | sort: root + 'sort' 8 | } 9 | const querySortList = enumId => { 10 | return $http.get(urls.sort, { enumId }) 11 | } 12 | 13 | const updateSortList = params => { 14 | return $http.post(urls.sort, params) 15 | } 16 | 17 | return { 18 | ...crud, 19 | querySortList, 20 | updateSortList 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/src/api/components/modelProperty.js: -------------------------------------------------------------------------------- 1 | import module from '../../module' 2 | 3 | export default name => { 4 | const root = `${module.code}/${name}/` 5 | const crud = $http.crud(root) 6 | const urls = { 7 | sort: root + 'sort', 8 | updateNullable: root + 'UpdateNullable', 9 | select: root + 'select', 10 | importFromEntity: root + 'importFromEntity' 11 | } 12 | 13 | const querySortList = params => { 14 | return $http.get(urls.sort, params) 15 | } 16 | 17 | const updateSortList = params => { 18 | return $http.post(urls.sort, params) 19 | } 20 | 21 | const updateNullable = params => { 22 | return $http.post(urls.updateNullable, params) 23 | } 24 | 25 | const select = params => { 26 | return $http.get(urls.select, params) 27 | } 28 | 29 | const importFromEntity = params => { 30 | return $http.post(urls.importFromEntity, params) 31 | } 32 | 33 | return { 34 | ...crud, 35 | querySortList, 36 | updateSortList, 37 | updateNullable, 38 | select, 39 | importFromEntity 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/src/api/components/module.js: -------------------------------------------------------------------------------- 1 | import module from '../../module' 2 | 3 | export default name => { 4 | const root = `${module.code}/${name}/` 5 | const crud = $http.crud(root) 6 | const urls = { 7 | select: root + 'select', 8 | buildCode: root + 'BuildCode' 9 | } 10 | 11 | /** 12 | * @description 查询字典下拉列表 13 | * @param {Object} params 参数 14 | */ 15 | const select = params => { 16 | return $http.get(urls.select, params) 17 | } 18 | /** 生成代码 */ 19 | const buildCode = params => { 20 | return $http.post(urls.buildCode, params, { responseType: 'blob' }) 21 | } 22 | 23 | return { 24 | ...crud, 25 | select, 26 | buildCode 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/src/api/components/onlineModule.js: -------------------------------------------------------------------------------- 1 | import module from '../../module' 2 | 3 | export default name => { 4 | const root = `${module.code}/${name}/` 5 | const crud = $http.crud(root) 6 | 7 | return { 8 | ...crud 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/src/api/components/property.js: -------------------------------------------------------------------------------- 1 | import module from '../../module' 2 | 3 | export default name => { 4 | const root = `${module.code}/${name}/` 5 | const crud = $http.crud(root) 6 | const urls = { 7 | propertyTypeSelect: root + 'PropertyTypeSelect', 8 | sort: root + 'sort', 9 | updateNullable: root + 'UpdateNullable', 10 | updateShowInList: root + 'UpdateShowInList', 11 | select: root + 'select' 12 | } 13 | 14 | /** 15 | * @description 获取属性类型下拉列表 16 | */ 17 | const getPropertyTypeSelect = () => { 18 | return $http.get(urls.propertyTypeSelect) 19 | } 20 | 21 | const querySortList = classId => { 22 | return $http.get(urls.sort, { classId }) 23 | } 24 | 25 | const updateSortList = params => { 26 | return $http.post(urls.sort, params) 27 | } 28 | 29 | const updateNullable = params => { 30 | return $http.post(urls.updateNullable, params) 31 | } 32 | 33 | const updateShowInList = params => { 34 | return $http.post(urls.updateShowInList, params) 35 | } 36 | 37 | const select = classId => { 38 | return $http.get(urls.select, { classId }) 39 | } 40 | 41 | return { 42 | ...crud, 43 | getPropertyTypeSelect, 44 | querySortList, 45 | updateSortList, 46 | updateNullable, 47 | updateShowInList, 48 | select 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/src/api/index.js: -------------------------------------------------------------------------------- 1 | import module from '../module' 2 | 3 | let apis = {} 4 | const requireComponent = require.context('./components', true, /\.*\.js$/) 5 | requireComponent.keys().map(fileName => { 6 | const name = fileName.replace('./', '').replace('.js', '') 7 | const func = requireComponent(fileName).default 8 | apis[name] = func(name) 9 | }) 10 | 11 | $api[module.code] = apis 12 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/src/components/index.js: -------------------------------------------------------------------------------- 1 | import library from 'netmodular-ui/packages/library' 2 | let components = [] 3 | const requireComponent = require.context('./', true, /index\.vue$/) 4 | requireComponent.keys().map(fileName => { 5 | components.push({ 6 | name: `${library.prefix.toLowerCase()}-${fileName.split('/')[1]}`, 7 | component: requireComponent(fileName).default 8 | }) 9 | }) 10 | export default components 11 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/src/config/index.js: -------------------------------------------------------------------------------- 1 | const isDev = process.env.NODE_ENV !== 'production' 2 | 3 | const config = { 4 | baseUrl: '/api/' 5 | } 6 | 7 | // 开发模式 8 | if (isDev) { 9 | config.baseUrl = 'http://localhost:6222/api/' 10 | } 11 | export default config 12 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/src/index.js: -------------------------------------------------------------------------------- 1 | import './api' 2 | import store from './store' 3 | import routes from './routes' 4 | import components from './components' 5 | import module from './module' 6 | 7 | export default { 8 | module, 9 | routes, 10 | store, 11 | components 12 | } 13 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/src/main.js: -------------------------------------------------------------------------------- 1 | import WebHost from 'netmodular-module-admin' 2 | import config from './config' 3 | import CodeGenerator from './index' 4 | 5 | // 注入模块 6 | WebHost.registerModule(CodeGenerator) 7 | 8 | // 启动 9 | WebHost.start(config) 10 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/src/module.js: -------------------------------------------------------------------------------- 1 | /** 模块信息 */ 2 | const pack = require('../package.json') 3 | 4 | export default { 5 | name: pack.title, 6 | code: pack.code, 7 | version: pack.version, 8 | description: pack.description 9 | } 10 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/src/routes/index.js: -------------------------------------------------------------------------------- 1 | import loadRoutes from 'netmodular-ui/packages/utils/load-routes' 2 | const requireComponent = require.context('../views', true, /\page.js$/) 3 | export default loadRoutes(requireComponent.keys().map(fileName => requireComponent(fileName).route)) 4 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/src/store/index.js: -------------------------------------------------------------------------------- 1 | export default { 2 | modules: {} 3 | } 4 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/src/views/class/components/code-preview/index.vue: -------------------------------------------------------------------------------- 1 | 11 | 27 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/src/views/class/index/cols.js: -------------------------------------------------------------------------------- 1 | export default [ 2 | { 3 | name: 'id', 4 | label: '编号', 5 | width: 240, 6 | show: false 7 | }, 8 | { 9 | name: 'name', 10 | label: '实体名', 11 | width: 250 12 | }, 13 | { 14 | name: 'tableName', 15 | label: '表名' 16 | }, 17 | { 18 | name: 'baseEntityName', 19 | label: '基类类型', 20 | width: 250 21 | }, 22 | { 23 | name: 'menuIcon', 24 | label: '菜单图标' 25 | }, 26 | { 27 | name: 'remarks', 28 | label: '备注' 29 | }, 30 | { 31 | name: 'creator', 32 | label: '创建人', 33 | width: 100, 34 | show: false 35 | }, 36 | { 37 | name: 'createdTime', 38 | label: '创建时间', 39 | width: 150, 40 | show: false 41 | } 42 | ] 43 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/src/views/enum/components/save/index.vue: -------------------------------------------------------------------------------- 1 | 15 | 50 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/src/views/enum/components/select/index.js: -------------------------------------------------------------------------------- 1 | import { mixins } from 'netmodular-ui' 2 | export default { 3 | mixins: [mixins.select], 4 | data() { 5 | return { 6 | action: $api.codeGenerator.enum.select 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/src/views/enum/index/cols.js: -------------------------------------------------------------------------------- 1 | export default [ 2 | { 3 | name: 'id', 4 | label: '编号', 5 | width: 240, 6 | show: false 7 | }, 8 | { 9 | name: 'name', 10 | label: '名称' 11 | }, 12 | { 13 | name: 'remarks', 14 | label: '备注' 15 | }, 16 | { 17 | name: 'creator', 18 | label: '创建人', 19 | width: 100, 20 | show: false 21 | }, 22 | { 23 | name: 'createdTime', 24 | label: '创建时间', 25 | width: 150, 26 | show: false 27 | } 28 | ] 29 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/src/views/enum/index/page.js: -------------------------------------------------------------------------------- 1 | /** 页面信息 */ 2 | const page = new (function() { 3 | this.title = '枚举列表' 4 | this.icon = 'tag' 5 | this.name = 'codegenerator_enum' 6 | this.path = '/codegenerator/enum' 7 | // 关联权限 8 | this.permissions = [`${this.name}_query_get`] 9 | 10 | // 按钮 11 | this.buttons = { 12 | add: { 13 | text: '添加', 14 | type: 'success', 15 | icon: 'add', 16 | code: `${this.name}_add`, 17 | permissions: [`${this.name}_add_post`] 18 | }, 19 | edit: { 20 | text: '编辑', 21 | type: 'text', 22 | icon: 'edit', 23 | code: `${this.name}_edit`, 24 | permissions: [`${this.name}_edit_get`, `${this.name}_update_post`] 25 | }, 26 | del: { 27 | text: '删除', 28 | type: 'text', 29 | icon: 'delete', 30 | code: `${this.name}_del`, 31 | permissions: [`${this.name}_delete_delete`] 32 | }, 33 | item: { 34 | text: '配置项', 35 | type: 'text', 36 | icon: 'tag', 37 | code: `${this.name}_item` 38 | } 39 | } 40 | })() 41 | 42 | /** 路由信息 */ 43 | export const route = { 44 | page, 45 | component: () => import(/* webpackChunkName: "admin.moduleinfo" */ './index') 46 | } 47 | 48 | export default page 49 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/src/views/enumItem/index/cols.js: -------------------------------------------------------------------------------- 1 | export default [ 2 | { 3 | name: 'id', 4 | label: '编号', 5 | show: false 6 | }, 7 | { 8 | name: 'name', 9 | label: '名称' 10 | }, 11 | { 12 | name: 'value', 13 | label: '值' 14 | }, 15 | { 16 | name: 'remarks', 17 | label: '备注' 18 | } 19 | ] 20 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/src/views/modelProperty/components/list/cols.js: -------------------------------------------------------------------------------- 1 | export default [ 2 | { 3 | name: 'id', 4 | label: '编号', 5 | width: 240, 6 | show: false 7 | }, 8 | { 9 | name: 'name', 10 | label: '名称' 11 | }, 12 | { 13 | name: 'typeName', 14 | label: '类型' 15 | }, 16 | { 17 | name: 'nullable', 18 | label: '可空' 19 | }, 20 | { 21 | name: 'remarks', 22 | label: '备注' 23 | }, 24 | { 25 | name: 'sort', 26 | label: '排序', 27 | width: 70 28 | }, 29 | { 30 | name: 'creator', 31 | label: '创建人', 32 | width: 100, 33 | show: false 34 | }, 35 | { 36 | name: 'createdTime', 37 | label: '创建时间', 38 | width: 150, 39 | show: false 40 | } 41 | ] 42 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/src/views/module/components/select/index.vue: -------------------------------------------------------------------------------- 1 | 12 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/src/views/module/index/cols.js: -------------------------------------------------------------------------------- 1 | export default [ 2 | { 3 | name: 'id', 4 | label: '编号', 5 | width: 250, 6 | show: false 7 | }, 8 | { 9 | name: 'name', 10 | label: '名称' 11 | }, 12 | { 13 | name: 'no', 14 | label: '编号' 15 | }, 16 | { 17 | name: 'code', 18 | label: '编码' 19 | }, 20 | { 21 | name: 'icon', 22 | label: '图标' 23 | }, 24 | { 25 | name: 'copyright', 26 | label: '版权声明' 27 | }, 28 | { 29 | name: 'company', 30 | label: '公司名称' 31 | }, 32 | { 33 | name: 'projectUrl', 34 | label: '官方地址' 35 | }, 36 | { 37 | name: 'repositoryUrl', 38 | label: '仓库地址' 39 | }, 40 | { 41 | name: 'creator', 42 | label: '创建人', 43 | width: 100, 44 | show: false 45 | }, 46 | { 47 | name: 'createdTime', 48 | label: '创建时间', 49 | width: 150, 50 | show: false 51 | } 52 | ] 53 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/src/views/module/index/page.js: -------------------------------------------------------------------------------- 1 | /** 页面信息 */ 2 | const page = new (function() { 3 | this.title = '模块列表' 4 | this.icon = 'product' 5 | this.name = 'codegenerator_module' 6 | this.path = '/codegenerator/module' 7 | 8 | // 关联权限 9 | this.permissions = [`${this.name}_query_get`] 10 | 11 | // 按钮 12 | this.buttons = { 13 | add: { 14 | text: '添加', 15 | type: 'success', 16 | icon: 'add', 17 | code: `${this.name}_add`, 18 | permissions: [`${this.name}_add_post`] 19 | }, 20 | edit: { 21 | text: '编辑', 22 | type: 'text', 23 | icon: 'edit', 24 | code: `${this.name}_edit`, 25 | permissions: [`${this.name}_edit_get`, `${this.name}_update_post`] 26 | }, 27 | del: { 28 | text: '删除', 29 | type: 'text', 30 | icon: 'delete', 31 | code: `${this.name}_del`, 32 | permissions: [`${this.name}_delete_delete`] 33 | }, 34 | buildCode: { 35 | text: '生成代码', 36 | type: 'text', 37 | icon: 'download', 38 | code: `${this.name}_build_code`, 39 | permissions: [`${this.name}_buildcode_post`] 40 | }, 41 | classManage: { 42 | text: '实体管理', 43 | type: 'text', 44 | icon: 'database', 45 | code: `${this.name}_class_manage`, 46 | permissions: [] 47 | } 48 | } 49 | })() 50 | 51 | /** 路由信息 */ 52 | export const route = { 53 | page, 54 | component: () => import(/* webpackChunkName: "codegenerator.module" */ './index') 55 | } 56 | 57 | export default page 58 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/src/views/property/components/type-select/index.js: -------------------------------------------------------------------------------- 1 | import { mixins } from 'netmodular-ui' 2 | const typeArr = ['String', 'Byte', 'Short', 'Int', 'Long', 'Double', 'Decimal', 'Bool', 'Guid', 'DateTime', 'Enum'] 3 | let i = 0 4 | const options = typeArr.map(item => { 5 | return { label: item, value: i++ } 6 | }) 7 | export default { 8 | mixins: [mixins.select], 9 | data() { 10 | return { 11 | action() { 12 | return new Promise(resolve => { 13 | resolve(options) 14 | }) 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/UI/module-codegenerator/src/views/property/index/cols.js: -------------------------------------------------------------------------------- 1 | export default [ 2 | { 3 | name: 'id', 4 | label: '编号', 5 | width: 240, 6 | show: false 7 | }, 8 | { 9 | name: 'name', 10 | label: '名称' 11 | }, 12 | { 13 | name: 'typeName', 14 | label: '类型' 15 | }, 16 | { 17 | name: 'nullable', 18 | label: '可空' 19 | }, 20 | { 21 | name: 'showInList', 22 | label: '列表显示' 23 | }, 24 | { 25 | name: 'remarks', 26 | label: '备注' 27 | }, 28 | { 29 | name: 'sort', 30 | label: '排序', 31 | width: 70 32 | }, 33 | { 34 | name: 'creator', 35 | label: '创建人', 36 | width: 100, 37 | show: false 38 | }, 39 | { 40 | name: 'createdTime', 41 | label: '创建时间', 42 | width: 150, 43 | show: false 44 | } 45 | ] 46 | -------------------------------------------------------------------------------- /src/Web/ModuleController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | using NetModular.Lib.Auth.Web; 3 | 4 | namespace NetModular.Module.CodeGenerator.Web 5 | { 6 | [Area("CodeGenerator")] 7 | public abstract class ModuleController : ControllerAbstract 8 | { 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Web/ModuleInitializer.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Builder; 2 | using Microsoft.AspNetCore.Mvc; 3 | using Microsoft.Extensions.Configuration; 4 | using Microsoft.Extensions.DependencyInjection; 5 | using Microsoft.Extensions.Hosting; 6 | using NetModular.Lib.Module.Abstractions; 7 | using NetModular.Lib.Module.AspNetCore; 8 | 9 | namespace NetModular.Module.CodeGenerator.Web 10 | { 11 | public class ModuleInitializer : IModuleInitializer 12 | { 13 | /// 14 | /// 注入服务 15 | /// 16 | public void ConfigureServices(IServiceCollection services, IModuleCollection modules, IHostEnvironment env, IConfiguration cfg) 17 | { 18 | } 19 | 20 | /// 21 | /// 配置中间件 22 | /// 23 | /// 24 | /// 25 | public void Configure(IApplicationBuilder app, IHostEnvironment env) 26 | { 27 | } 28 | 29 | /// 30 | /// 配置MVC功能 31 | /// 32 | /// 33 | public void ConfigureMvc(MvcOptions mvcOptions) 34 | { 35 | 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Web/Validators/PropertyAddValidator.cs: -------------------------------------------------------------------------------- 1 | using FluentValidation; 2 | using NetModular.Module.CodeGenerator.Application.PropertyService.ViewModels; 3 | using NetModular.Module.CodeGenerator.Domain.Property; 4 | 5 | namespace NetModular.Module.CodeGenerator.Web.Validators 6 | { 7 | public class PropertyAddValidator : AbstractValidator 8 | { 9 | public PropertyAddValidator() 10 | { 11 | RuleFor(x => x.Length) 12 | .NotNull() 13 | .GreaterThanOrEqualTo(0) 14 | .When(x => x.Type == PropertyType.String) 15 | .WithMessage("请输入正确的长度"); 16 | 17 | RuleFor(x => x.Precision) 18 | .NotNull() 19 | .LessThanOrEqualTo(38) 20 | .GreaterThan(0) 21 | .When(x => x.Type == PropertyType.Decimal || x.Type == PropertyType.Double) 22 | .WithMessage("请输入正确的精度"); 23 | 24 | RuleFor(x => x.Scale) 25 | .NotNull() 26 | .LessThanOrEqualTo(x => x.Precision) 27 | .GreaterThanOrEqualTo(0) 28 | .When(x => x.Type == PropertyType.Decimal || x.Type == PropertyType.Double) 29 | .WithMessage("请输入正确的小数位"); 30 | 31 | RuleFor(x => x.EnumId) 32 | .NotEmpty() 33 | .When(x => x.Type == PropertyType.Enum) 34 | .WithMessage("请选择枚举"); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Web/Validators/PropertyUpdateValidator.cs: -------------------------------------------------------------------------------- 1 | using FluentValidation; 2 | using NetModular.Module.CodeGenerator.Application.PropertyService.ViewModels; 3 | using NetModular.Module.CodeGenerator.Domain.Property; 4 | 5 | namespace NetModular.Module.CodeGenerator.Web.Validators 6 | { 7 | public class PropertyUpdateValidator : AbstractValidator 8 | { 9 | public PropertyUpdateValidator() 10 | { 11 | RuleFor(x => x.Length) 12 | .NotNull() 13 | .GreaterThanOrEqualTo(0) 14 | .When(x => x.Type == PropertyType.String) 15 | .WithMessage("请输入正确的长度"); 16 | 17 | RuleFor(x => x.Precision) 18 | .NotNull() 19 | .LessThanOrEqualTo(38) 20 | .GreaterThan(0) 21 | .When(x => x.Type == PropertyType.Decimal || x.Type == PropertyType.Double) 22 | .WithMessage("请输入正确的精度"); 23 | 24 | RuleFor(x => x.Scale) 25 | .NotNull() 26 | .LessThanOrEqualTo(x => x.Precision) 27 | .GreaterThanOrEqualTo(0) 28 | .When(x => x.Type == PropertyType.Decimal || x.Type == PropertyType.Double) 29 | .WithMessage("请输入正确的小数位"); 30 | 31 | RuleFor(x => x.EnumId) 32 | .NotEmpty() 33 | .When(x => x.Type == PropertyType.Enum) 34 | .WithMessage("请选择枚举"); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Web/Web.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | true 18 | true 19 | Always 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/WebHost/Program.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using NetModular.Lib.Host.Web; 3 | 4 | namespace NetModular.Module.CodeGenerator.WebHost 5 | { 6 | public class Program 7 | { 8 | public static void Main(string[] args) 9 | { 10 | new HostBuilder().Run(args); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/WebHost/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "profiles": { 4 | "WebHost": { 5 | "commandName": "Project", 6 | "launchBrowser": true, 7 | "launchUrl": "swagger", 8 | "environmentVariables": { 9 | "ASPNETCORE_ENVIRONMENT": "Development" 10 | }, 11 | "applicationUrl": "http://localhost:6222" 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/WebHost/Startup.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Configuration; 2 | using Microsoft.Extensions.Hosting; 3 | using NetModular.Lib.Host.Web; 4 | 5 | namespace NetModular.Module.CodeGenerator.WebHost 6 | { 7 | public class Startup : StartupAbstract 8 | { 9 | public Startup(IHostEnvironment env, IConfiguration cfg) : base(env, cfg) 10 | { 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/WebHost/WebHost.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | PreserveNewest 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/WebHost/_modules/02_CodeGenerator/_module.json: -------------------------------------------------------------------------------- 1 | {"Id": "02","Name":"代码生成","Code":"CodeGenerator","Icon":"develop","Version":"1.8.3","Description":"NetModular Module CodeGenerator(代码生成) - WebHost"} 2 | -------------------------------------------------------------------------------- /src/WebHost/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Serilog": { 3 | "MinimumLevel": { 4 | "Default": "Debug", 5 | "Override": { 6 | "Microsoft": "Debug", 7 | "System": "Debug" 8 | } 9 | }, 10 | "WriteTo": [ 11 | //输入到控制台 12 | { 13 | "Name": "Console", 14 | "Args": { 15 | "theme": "Serilog.Sinks.SystemConsole.Themes.AnsiConsoleTheme::Code, Serilog.Sinks.Console", 16 | "outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj} {NewLine}{Exception}" 17 | } 18 | }, 19 | //输出到文件 20 | { 21 | "Name": "File", 22 | "Args": { 23 | //文件路径 24 | "path": "log/log.log", 25 | //文件滚动方式 26 | "rollingInterval": "Day", 27 | //消息输出格式 28 | "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}{Exception}", 29 | //文件数量 30 | "retainedFileCountLimit": 60, 31 | //使用缓冲,提高写入效率 32 | "buffered": false 33 | } 34 | } 35 | ] 36 | }, 37 | "Db": { 38 | "Logging": true 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /test/Infrastructure.Test/Infrastructure.Test.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | all 14 | runtime; build; native; contentfiles; analyzers; buildtransitive 15 | 16 | 17 | all 18 | runtime; build; native; contentfiles; analyzers; buildtransitive 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /test/Infrastructure.Test/NugetHelperTest.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | using NetModular; 3 | using NetModular.Module.CodeGenerator.Infrastructure; 4 | using NetModular.Module.CodeGenerator.Infrastructure.NuGet; 5 | using Xunit; 6 | 7 | namespace Infrastructure.Test 8 | { 9 | public class NugetHelperTest 10 | { 11 | private readonly NuGetHelper _nuGetHelper; 12 | 13 | public NugetHelperTest() 14 | { 15 | var service = new ServiceCollection(); 16 | service.AddHttpClient(); 17 | service.AddSingleton(); 18 | service.AddSingleton(); 19 | _nuGetHelper = service.BuildServiceProvider().GetService(); 20 | } 21 | 22 | [Fact] 23 | public void GetVersionsTest() 24 | { 25 | var versions = _nuGetHelper.GetVersions(); 26 | 27 | Assert.NotNull(versions.Lib_Auth_Web); 28 | Assert.NotNull(versions.Lib_Host_Web); 29 | } 30 | } 31 | } 32 | --------------------------------------------------------------------------------