From f706a2ab009858c7f94c17e4e9bcb4da7abd67eb Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Mon, 21 Dec 2020 16:02:41 +0800 Subject: [PATCH 1/3] support dynamic menus --- aspnet-core/LINGYUN.MicroService.Common.sln | 51 +- .../LINGYUN.Abp.Core/AbpCommonModule.cs | 8 + .../DynamicOptionsProvider.cs | 30 + .../LINGYUN.Abp.Core/IOptionsProvider.cs | 8 + .../LINGYUN.Abp.Core/LINGYUN.Abp.Core.csproj | 15 + ...GYUN.Platform.Application.Contracts.csproj | 4 - .../Platform/Datas/Dto/DataCreateDto.cs | 9 + .../Datas/Dto/DataCreateOrUpdateDto.cs | 19 + .../LINGYUN/Platform/Datas/Dto/DataDto.cs | 21 + .../Platform/Datas/Dto/DataItemCreateDto.cs | 13 + .../Datas/Dto/DataItemCreateOrUpdateDto.cs | 38 + .../LINGYUN/Platform/Datas/Dto/DataItemDto.cs | 20 + .../Platform/Datas/Dto/DataItemUpdateDto.cs | 8 + .../Platform/Datas/Dto/DataUpdateDto.cs | 7 + .../Platform/Datas/Dto/GetDataByNameInput.cs | 12 + .../Platform/Datas/Dto/GetDataListInput.cs | 9 + .../LINGYUN/Platform/Datas/IDataAppService.cs | 24 + .../Layouts/Dto/GetLayoutListInput.cs | 13 + .../Platform/Layouts/Dto/LayoutCreateDto.cs | 9 + .../Layouts/Dto/LayoutCreateOrUpdateDto.cs | 29 + .../LINGYUN/Platform/Layouts/Dto/LayoutDto.cs | 21 + .../Platform/Layouts/Dto/LayoutUpdateDto.cs | 6 + .../Platform/Layouts/ILayoutAppService.cs | 16 + .../Localization/ApplicationContracts/en.json | 11 +- .../ApplicationContracts/zh-Hans.json | 11 +- .../Platform/Menus/Dto/GetMenuInput.cs | 7 + .../Platform/Menus/Dto/MenuCreateDto.cs | 13 + .../Menus/Dto/MenuCreateOrUpdateDto.cs | 36 + .../LINGYUN/Platform/Menus/Dto/MenuDto.cs | 32 + .../Platform/Menus/Dto/MenuGetAllInput.cs | 18 + .../Platform/Menus/Dto/MenuGetByRoleInput.cs | 13 + .../Platform/Menus/Dto/MenuGetByUserInput.cs | 15 + .../Platform/Menus/Dto/MenuGetListInput.cs | 16 + .../LINGYUN/Platform/Menus/Dto/MenuItemDto.cs | 21 + .../Platform/Menus/Dto/MenuUpdateDto.cs | 6 + .../Platform/Menus/Dto/RoleMenuInput.cs | 16 + .../Platform/Menus/Dto/UserMenuInput.cs | 15 + .../LINGYUN/Platform/Menus/IMenuAppService.cs | 28 + .../PlatformPermissionDefinitionProvider.cs | 19 + .../Permissions/PlatformPermissions.cs | 41 +- ...s => PlatformApplicationContractModule.cs} | 6 +- .../Platform/PlatformRemoteServiceConsts.cs | 7 + .../LINGYUN/Platform/Routes/Dto/RouteDto.cs | 34 + .../AppPlatformApplicationMappingProfile.cs | 14 - .../LINGYUN/Platform/Datas/DataAppService.cs | 191 +++++ .../Platform/Layouts/LayoutAppService.cs | 130 +++ .../LINGYUN/Platform/Menus/MenuAppService.cs | 238 ++++++ .../PlatformApplicationMappingProfile.cs | 24 + ...Module.cs => PlatformApplicationModule.cs} | 8 +- .../LINGYUN/Platform/Datas/DataConsts.cs | 29 + .../LINGYUN/Platform/Datas/DataItemConsts.cs | 29 + .../LINGYUN/Platform/Datas/ValueType.cs | 13 + .../Platform/Localization/Resources/en.json | 44 +- .../Localization/Resources/zh-Hans.json | 44 +- .../LINGYUN/Platform/Menus/MenuConsts.cs | 21 + .../LINGYUN/Platform/PlatformConsts.cs | 14 + ...odule.cs => PlatformDomainSharedModule.cs} | 6 +- .../LINGYUN/Platform/PlatformErrorCodes.cs | 24 +- .../LINGYUN/Platform/PlatformType.cs | 6 +- .../LINGYUN/Platform/Routes/RouteConsts.cs | 8 +- .../LINGYUN/Platform/Routes/RouteEto.cs | 7 +- .../LINGYUN/Platform/Datas/Data.cs | 121 +++ .../Datas/DataDictionaryDataSeeder.cs | 50 ++ .../LINGYUN/Platform/Datas/DataItem.cs | 90 +++ .../Platform/Datas/DataItemMappingOptions.cs | 105 +++ .../Datas/IDataDictionaryDataSeeder.cs | 18 + .../LINGYUN/Platform/Datas/IDataRepository.cs | 34 + .../Platform/Layouts/ILayoutRepository.cs | 41 + .../LINGYUN/Platform/Layouts/Layout.cs | 48 ++ .../LINGYUN/Platform/Menus/IMenuRepository.cs | 110 +++ .../Platform/Menus/IRoleMenuRepository.cs | 28 + .../Platform/Menus/IUserMenuRepository.cs | 28 + .../LINGYUN/Platform/Menus/Menu.cs | 67 ++ .../LINGYUN/Platform/Menus/MenuManager.cs | 191 +++++ .../LINGYUN/Platform/Menus/RoleMenu.cs | 35 + .../LINGYUN/Platform/Menus/UserMenu.cs | 35 + .../Platform/PlatformDataSeedContributor.cs | 760 ++++++++++++++++++ ...bProperties.cs => PlatformDbProperties.cs} | 2 +- ...ile.cs => PlatformDomainMappingProfile.cs} | 6 +- ...omainModule.cs => PlatformDomainModule.cs} | 22 +- .../Platform/Routes/IRouteDataSeeder.cs | 51 ++ .../Platform/Routes/IRouteRepository.cs | 78 -- .../LINGYUN/Platform/Routes/RoleRoute.cs | 31 - .../LINGYUN/Platform/Routes/Route.cs | 188 +---- .../Platform/Routes/RouteDataSeeder.cs | 152 ++++ .../LINGYUN/Platform/Routes/RouteManager.cs | 139 ---- .../LINGYUN/Platform/Routes/UserRoute.cs | 29 - .../Platform/Utils/CodeNumberGenerator.cs | 94 +++ .../Platform/Datas/EfCoreDataRepository.cs | 79 ++ ...PlatformDbContextModelBuilderExtensions.cs | 143 ---- .../EntityFrameworkCore/IPlatformDbContext.cs | 10 +- .../EntityFrameworkCore/PlatformDbContext.cs | 10 +- ...PlatformDbContextModelBuilderExtensions.cs | 249 ++++++ .../PlatformEfCoreQueryableExtensions.cs | 34 + ...s => PlatformEntityFrameworkCoreModule.cs} | 14 +- ...atformModelBuilderConfigurationOptions.cs} | 4 +- .../Layouts/EfCoreLayoutRepository.cs | 82 ++ .../Platform/Menus/EfCoreMenuRepository.cs | 232 ++++++ .../Menus/EfCoreRoleMenuRepository.cs | 60 ++ .../Menus/EfCoreUserMenuRepository.cs | 60 ++ .../Platform/Routes/EfCoreRouteRepository.cs | 141 ---- .../LINGYUN.Platform.HttpApi.csproj | 3 +- .../LINGYUN/Platform/Datas/DataController.cs | 84 ++ .../Platform/Layouts/LayoutController.cs | 56 ++ .../LINGYUN/Platform/Menus/MenuController.cs | 128 +++ ...pApiModule.cs => PlatformHttpApiModule.cs} | 6 +- .../Platform/Versions/VersionController.cs | 1 + .../IdentityServerDataSeedContributor.cs | 17 + .../BackendAdminHostModule.cs | 2 +- .../LINGYUN.ApiGateway.Host/event-bus-cap.db | Bin 40960 -> 40960 bytes .../AppPlatformHttpApiHostModule.cs | 20 +- .../LINGYUN.Platform.HttpApi.Host.csproj | 2 + ...nu-Layout-Data-And-More-Entity.Designer.cs | 637 +++++++++++++++ ...05_Add-Menu-Layout-Data-And-More-Entity.cs | 338 ++++++++ ...dd-Data-Item-AllowBeNull-Field.Designer.cs | 643 +++++++++++++++ ...4082313_Add-Data-Item-AllowBeNull-Field.cs | 40 + ...escription-Field-Allow-Be-Long.Designer.cs | 645 +++++++++++++++ ...50_Data-Description-Field-Allow-Be-Long.cs | 69 ++ ...4093329_Menu-Code-Limit-Length.Designer.cs | 649 +++++++++++++++ .../20201204093329_Menu-Code-Limit-Length.cs | 30 + ...208082630_Remove-Menu-Children.Designer.cs | 639 +++++++++++++++ .../20201208082630_Remove-Menu-Children.cs | 34 + ...ata-Item-Value-To-DefaultValue.Designer.cs | 638 +++++++++++++++ ..._Rename-Data-Item-Value-To-DefaultValue.cs | 35 + ...6_Add-Layout-Id-Column-To-Menu.Designer.cs | 641 +++++++++++++++ ...1219092956_Add-Layout-Id-Column-To-Menu.cs | 24 + ...5_Add-Is-Public-Column-To-Menu.Designer.cs | 644 +++++++++++++++ ...1221061225_Add-Is-Public-Column-To-Menu.cs | 23 + ...ApiHostMigrationsDbContextModelSnapshot.cs | 412 ++++++++-- vueJs/debug.log | 5 + vueJs/src/api/data-dictionary.ts | 115 +++ vueJs/src/api/layout.ts | 105 +++ vueJs/src/api/menu.ts | 110 +++ vueJs/src/components/Breadcrumb/index.vue | 13 +- .../layout/components/Sidebar/SidebarItem.vue | 12 +- vueJs/src/permission.ts | 8 +- vueJs/src/router/modules/admin.ts | 20 + vueJs/src/store/modules/permission.ts | 56 +- vueJs/src/utils/index.ts | 12 + .../components/CreateOrUpdateDataDialog.vue | 172 ++++ .../CreateOrUpdateDataItemDialog.vue | 238 ++++++ .../components/DataDictionaryTree.vue | 208 +++++ .../components/DataItemTable.vue | 233 ++++++ .../src/views/admin/data-dictionary/index.vue | 49 ++ .../components/CreateOrUpdateMenuDialog.vue | 360 +++++++++ .../admin/menus/components/MenuMetaInput.vue | 98 +++ vueJs/src/views/admin/menus/index.vue | 267 ++++++ .../roles/components/ManageRoleMenuDialog.vue | 169 ++++ vueJs/src/views/admin/roles/index.vue | 19 + 149 files changed, 13105 insertions(+), 900 deletions(-) create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.Core/AbpCommonModule.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.Core/DynamicOptionsProvider.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.Core/IOptionsProvider.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.Core/LINGYUN.Abp.Core.csproj create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataCreateDto.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataCreateOrUpdateDto.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataDto.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataItemCreateDto.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataItemCreateOrUpdateDto.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataItemDto.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataItemUpdateDto.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataUpdateDto.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/GetDataByNameInput.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/GetDataListInput.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/IDataAppService.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/GetLayoutListInput.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/LayoutCreateDto.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/LayoutCreateOrUpdateDto.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/LayoutDto.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/LayoutUpdateDto.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/ILayoutAppService.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/GetMenuInput.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuCreateDto.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuCreateOrUpdateDto.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuDto.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetAllInput.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetByRoleInput.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetByUserInput.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetListInput.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuItemDto.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuUpdateDto.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/RoleMenuInput.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/UserMenuInput.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/IMenuAppService.cs rename aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/{AppPlatformApplicationContractModule.cs => PlatformApplicationContractModule.cs} (75%) create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/PlatformRemoteServiceConsts.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Routes/Dto/RouteDto.cs delete mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/AppPlatformApplicationMappingProfile.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Datas/DataAppService.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Layouts/LayoutAppService.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Menus/MenuAppService.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationMappingProfile.cs rename aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/{AppPlatformApplicationModule.cs => PlatformApplicationModule.cs} (53%) create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Datas/DataConsts.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Datas/DataItemConsts.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Datas/ValueType.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Menus/MenuConsts.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformConsts.cs rename aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/{AppPlatformDomainSharedModule.cs => PlatformDomainSharedModule.cs} (79%) create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/Data.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/DataDictionaryDataSeeder.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/DataItem.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/DataItemMappingOptions.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/IDataDictionaryDataSeeder.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/IDataRepository.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Layouts/ILayoutRepository.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Layouts/Layout.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IMenuRepository.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IRoleMenuRepository.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IUserMenuRepository.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/Menu.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/MenuManager.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/RoleMenu.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/UserMenu.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDataSeedContributor.cs rename aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/{AppPlatformDbProperties.cs => PlatformDbProperties.cs} (83%) rename aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/{AppPlatformDomainMappingProfile.cs => PlatformDomainMappingProfile.cs} (61%) rename aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/{AppPlatformDomainModule.cs => PlatformDomainModule.cs} (76%) create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/IRouteDataSeeder.cs delete mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/IRouteRepository.cs delete mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/RoleRoute.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/RouteDataSeeder.cs delete mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/RouteManager.cs delete mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/UserRoute.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Utils/CodeNumberGenerator.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Datas/EfCoreDataRepository.cs delete mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/AppPlatformDbContextModelBuilderExtensions.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformDbContextModelBuilderExtensions.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformEfCoreQueryableExtensions.cs rename aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/{AppPlatformEntityFrameworkCoreModule.cs => PlatformEntityFrameworkCoreModule.cs} (61%) rename aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/{AppPlatformModelBuilderConfigurationOptions.cs => PlatformModelBuilderConfigurationOptions.cs} (67%) create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Layouts/EfCoreLayoutRepository.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreRoleMenuRepository.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreUserMenuRepository.cs delete mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Routes/EfCoreRouteRepository.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Datas/DataController.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Layouts/LayoutController.cs create mode 100644 aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Menus/MenuController.cs rename aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/{AppPlatformHttpApiModule.cs => PlatformHttpApiModule.cs} (84%) create mode 100644 aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201203105205_Add-Menu-Layout-Data-And-More-Entity.Designer.cs create mode 100644 aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201203105205_Add-Menu-Layout-Data-And-More-Entity.cs create mode 100644 aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201204082313_Add-Data-Item-AllowBeNull-Field.Designer.cs create mode 100644 aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201204082313_Add-Data-Item-AllowBeNull-Field.cs create mode 100644 aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201204083250_Data-Description-Field-Allow-Be-Long.Designer.cs create mode 100644 aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201204083250_Data-Description-Field-Allow-Be-Long.cs create mode 100644 aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201204093329_Menu-Code-Limit-Length.Designer.cs create mode 100644 aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201204093329_Menu-Code-Limit-Length.cs create mode 100644 aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201208082630_Remove-Menu-Children.Designer.cs create mode 100644 aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201208082630_Remove-Menu-Children.cs create mode 100644 aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201219031303_Rename-Data-Item-Value-To-DefaultValue.Designer.cs create mode 100644 aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201219031303_Rename-Data-Item-Value-To-DefaultValue.cs create mode 100644 aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201219092956_Add-Layout-Id-Column-To-Menu.Designer.cs create mode 100644 aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201219092956_Add-Layout-Id-Column-To-Menu.cs create mode 100644 aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201221061225_Add-Is-Public-Column-To-Menu.Designer.cs create mode 100644 aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201221061225_Add-Is-Public-Column-To-Menu.cs create mode 100644 vueJs/debug.log create mode 100644 vueJs/src/api/data-dictionary.ts create mode 100644 vueJs/src/api/layout.ts create mode 100644 vueJs/src/api/menu.ts create mode 100644 vueJs/src/views/admin/data-dictionary/components/CreateOrUpdateDataDialog.vue create mode 100644 vueJs/src/views/admin/data-dictionary/components/CreateOrUpdateDataItemDialog.vue create mode 100644 vueJs/src/views/admin/data-dictionary/components/DataDictionaryTree.vue create mode 100644 vueJs/src/views/admin/data-dictionary/components/DataItemTable.vue create mode 100644 vueJs/src/views/admin/data-dictionary/index.vue create mode 100644 vueJs/src/views/admin/menus/components/CreateOrUpdateMenuDialog.vue create mode 100644 vueJs/src/views/admin/menus/components/MenuMetaInput.vue create mode 100644 vueJs/src/views/admin/menus/index.vue create mode 100644 vueJs/src/views/admin/roles/components/ManageRoleMenuDialog.vue diff --git a/aspnet-core/LINGYUN.MicroService.Common.sln b/aspnet-core/LINGYUN.MicroService.Common.sln index 0f56b0095..8d06dfc9e 100644 --- a/aspnet-core/LINGYUN.MicroService.Common.sln +++ b/aspnet-core/LINGYUN.MicroService.Common.sln @@ -59,10 +59,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "wechat", "wechat", "{22C614 EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.WeChat", "modules\wechat\LINGYUN.Abp.WeChat\LINGYUN.Abp.WeChat.csproj", "{865D5508-63CD-4D44-9F5B-AE5CD4A43D08}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Notifications.WeChat.WeApp", "modules\wechat\LINGYUN.Abp.Notifications.WeChat\LINGYUN.Abp.Notifications.WeChat.WeApp.csproj", "{076B511E-39C5-4C91-BE8D-CA666CCCEA46}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.WeChat.Authorization", "modules\wechat\LINGYUN.Abp.WeChat.Authorization\LINGYUN.Abp.WeChat.Authorization.csproj", "{BCB7E04B-4A60-4596-8051-8ABC08444CAF}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Settings", "modules\common\LINGYUN.Abp.Settings\LINGYUN.Abp.Settings.csproj", "{ECAA4B82-A240-4747-888C-FACD8634D389}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Sms.Aliyun", "modules\common\LINGYUN.Abp.Sms.Aliyun\LINGYUN.Abp.Sms.Aliyun.csproj", "{8AF8FD6B-634F-41FA-B421-A4ACFD159FE0}" @@ -89,7 +85,17 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.MultiTenancy.Db EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.MultiTenancy.RemoteService", "modules\tenants\LINGYUN.Abp.MultiTenancy.RemoteService\LINGYUN.Abp.MultiTenancy.RemoteService.csproj", "{21C0A260-BC14-4A8F-9299-A9EE58682B96}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Notifications.Sms", "modules\common\LINGYUN.Abp.Notifications.Sms\LINGYUN.Abp.Notifications.Sms.csproj", "{15FC0C39-A604-491F-91F6-BD44167FC5F6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Notifications.Sms", "modules\common\LINGYUN.Abp.Notifications.Sms\LINGYUN.Abp.Notifications.Sms.csproj", "{15FC0C39-A604-491F-91F6-BD44167FC5F6}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.WeChat.MiniProgram", "modules\wechat\LINGYUN.Abp.WeChat.MiniProgram\LINGYUN.Abp.WeChat.MiniProgram.csproj", "{9E59B1DB-E0D5-485D-BDA0-B6C31E1358A8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.WeChat.Official", "modules\wechat\LINGYUN.Abp.WeChat.Official\LINGYUN.Abp.WeChat.Official.csproj", "{16942653-B746-4917-B3BF-464C99F8832F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.WeChat.SettingManagement", "modules\wechat\LINGYUN.Abp.WeChat.SettingManagement\LINGYUN.Abp.WeChat.SettingManagement.csproj", "{D0717513-2CEE-4AD5-A1DA-A08EA5DE6DD6}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Notifications.WeChat.MiniProgram", "modules\wechat\LINGYUN.Abp.Notifications.WeChat.MiniProgram\LINGYUN.Abp.Notifications.WeChat.MiniProgram.csproj", "{D119C919-230B-4614-9A06-98586635DBFC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Core", "modules\common\LINGYUN.Abp.Core\LINGYUN.Abp.Core.csproj", "{A7A28D6C-6EDB-4615-8899-7DE1D435B750}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -197,14 +203,6 @@ Global {865D5508-63CD-4D44-9F5B-AE5CD4A43D08}.Debug|Any CPU.Build.0 = Debug|Any CPU {865D5508-63CD-4D44-9F5B-AE5CD4A43D08}.Release|Any CPU.ActiveCfg = Release|Any CPU {865D5508-63CD-4D44-9F5B-AE5CD4A43D08}.Release|Any CPU.Build.0 = Release|Any CPU - {076B511E-39C5-4C91-BE8D-CA666CCCEA46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {076B511E-39C5-4C91-BE8D-CA666CCCEA46}.Debug|Any CPU.Build.0 = Debug|Any CPU - {076B511E-39C5-4C91-BE8D-CA666CCCEA46}.Release|Any CPU.ActiveCfg = Release|Any CPU - {076B511E-39C5-4C91-BE8D-CA666CCCEA46}.Release|Any CPU.Build.0 = Release|Any CPU - {BCB7E04B-4A60-4596-8051-8ABC08444CAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BCB7E04B-4A60-4596-8051-8ABC08444CAF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BCB7E04B-4A60-4596-8051-8ABC08444CAF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BCB7E04B-4A60-4596-8051-8ABC08444CAF}.Release|Any CPU.Build.0 = Release|Any CPU {ECAA4B82-A240-4747-888C-FACD8634D389}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {ECAA4B82-A240-4747-888C-FACD8634D389}.Debug|Any CPU.Build.0 = Debug|Any CPU {ECAA4B82-A240-4747-888C-FACD8634D389}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -237,6 +235,26 @@ Global {15FC0C39-A604-491F-91F6-BD44167FC5F6}.Debug|Any CPU.Build.0 = Debug|Any CPU {15FC0C39-A604-491F-91F6-BD44167FC5F6}.Release|Any CPU.ActiveCfg = Release|Any CPU {15FC0C39-A604-491F-91F6-BD44167FC5F6}.Release|Any CPU.Build.0 = Release|Any CPU + {9E59B1DB-E0D5-485D-BDA0-B6C31E1358A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9E59B1DB-E0D5-485D-BDA0-B6C31E1358A8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9E59B1DB-E0D5-485D-BDA0-B6C31E1358A8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9E59B1DB-E0D5-485D-BDA0-B6C31E1358A8}.Release|Any CPU.Build.0 = Release|Any CPU + {16942653-B746-4917-B3BF-464C99F8832F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {16942653-B746-4917-B3BF-464C99F8832F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {16942653-B746-4917-B3BF-464C99F8832F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {16942653-B746-4917-B3BF-464C99F8832F}.Release|Any CPU.Build.0 = Release|Any CPU + {D0717513-2CEE-4AD5-A1DA-A08EA5DE6DD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D0717513-2CEE-4AD5-A1DA-A08EA5DE6DD6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D0717513-2CEE-4AD5-A1DA-A08EA5DE6DD6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D0717513-2CEE-4AD5-A1DA-A08EA5DE6DD6}.Release|Any CPU.Build.0 = Release|Any CPU + {D119C919-230B-4614-9A06-98586635DBFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D119C919-230B-4614-9A06-98586635DBFC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D119C919-230B-4614-9A06-98586635DBFC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D119C919-230B-4614-9A06-98586635DBFC}.Release|Any CPU.Build.0 = Release|Any CPU + {A7A28D6C-6EDB-4615-8899-7DE1D435B750}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A7A28D6C-6EDB-4615-8899-7DE1D435B750}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A7A28D6C-6EDB-4615-8899-7DE1D435B750}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A7A28D6C-6EDB-4615-8899-7DE1D435B750}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -269,8 +287,6 @@ Global {B31CEE79-45F6-4BB9-9EEB-08843C324B37} = {B91F26C5-B148-4094-B5F1-71E5F945DBED} {22C61434-D29A-4376-AD56-F5089F3E617A} = {02EA4E78-5891-43BC-944F-3E52FEE032E4} {865D5508-63CD-4D44-9F5B-AE5CD4A43D08} = {22C61434-D29A-4376-AD56-F5089F3E617A} - {076B511E-39C5-4C91-BE8D-CA666CCCEA46} = {22C61434-D29A-4376-AD56-F5089F3E617A} - {BCB7E04B-4A60-4596-8051-8ABC08444CAF} = {22C61434-D29A-4376-AD56-F5089F3E617A} {ECAA4B82-A240-4747-888C-FACD8634D389} = {086BE5BE-8594-4DA7-8819-935FEF76DABD} {8AF8FD6B-634F-41FA-B421-A4ACFD159FE0} = {7F18BCA5-35BD-41FB-8EFF-801B56E5E414} {7F18BCA5-35BD-41FB-8EFF-801B56E5E414} = {02EA4E78-5891-43BC-944F-3E52FEE032E4} @@ -285,6 +301,11 @@ Global {BD0A1F2D-7667-45F8-872D-D41F36384163} = {38E21687-5F19-42C9-9D11-4B1D2EF64EDB} {21C0A260-BC14-4A8F-9299-A9EE58682B96} = {38E21687-5F19-42C9-9D11-4B1D2EF64EDB} {15FC0C39-A604-491F-91F6-BD44167FC5F6} = {B91F26C5-B148-4094-B5F1-71E5F945DBED} + {9E59B1DB-E0D5-485D-BDA0-B6C31E1358A8} = {22C61434-D29A-4376-AD56-F5089F3E617A} + {16942653-B746-4917-B3BF-464C99F8832F} = {22C61434-D29A-4376-AD56-F5089F3E617A} + {D0717513-2CEE-4AD5-A1DA-A08EA5DE6DD6} = {22C61434-D29A-4376-AD56-F5089F3E617A} + {D119C919-230B-4614-9A06-98586635DBFC} = {22C61434-D29A-4376-AD56-F5089F3E617A} + {A7A28D6C-6EDB-4615-8899-7DE1D435B750} = {086BE5BE-8594-4DA7-8819-935FEF76DABD} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {06C707C6-02C0-411A-AD3B-2D0E13787CB8} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Core/AbpCommonModule.cs b/aspnet-core/modules/common/LINGYUN.Abp.Core/AbpCommonModule.cs new file mode 100644 index 000000000..ffe9a4fbb --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.Core/AbpCommonModule.cs @@ -0,0 +1,8 @@ +using Volo.Abp.Modularity; + +namespace LINGYUN.Abp +{ + public class AbpCommonModule : AbpModule + { + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Core/DynamicOptionsProvider.cs b/aspnet-core/modules/common/LINGYUN.Abp.Core/DynamicOptionsProvider.cs new file mode 100644 index 000000000..bcb74c6de --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.Core/DynamicOptionsProvider.cs @@ -0,0 +1,30 @@ +using Microsoft.Extensions.Options; +using System; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Threading; + +namespace LINGYUN.Abp +{ + public class DynamicOptionsProvider : IOptionsProvider, ITransientDependency + where TValue : class, new() + { + public TValue Value => _lazyValueFactory.Value; + + private readonly Lazy _lazyValueFactory; + private readonly OneTimeRunner _oneTimeRunner; + + public DynamicOptionsProvider(IOptions options) + { + _oneTimeRunner = new OneTimeRunner(); + _lazyValueFactory = new Lazy(() => CreateOptions(options)); + } + + protected virtual TValue CreateOptions(IOptions options) + { + // 用于简化需要在使用配置前自行调用此接口的繁复步骤 + // await options.SetAsync(); + // _onTimeRunner.Run(async () => await options.SetAsync()); + return options.Value; + } + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Core/IOptionsProvider.cs b/aspnet-core/modules/common/LINGYUN.Abp.Core/IOptionsProvider.cs new file mode 100644 index 000000000..cb6827060 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.Core/IOptionsProvider.cs @@ -0,0 +1,8 @@ +namespace LINGYUN.Abp +{ + public interface IOptionsProvider + where TValue: class, new() + { + TValue Value { get; } + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Core/LINGYUN.Abp.Core.csproj b/aspnet-core/modules/common/LINGYUN.Abp.Core/LINGYUN.Abp.Core.csproj new file mode 100644 index 000000000..977bd7b6c --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.Core/LINGYUN.Abp.Core.csproj @@ -0,0 +1,15 @@ + + + + + + netstandard2.0 + LINGYUN.Abp + Abp扩展基础库 + + + + + + + diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN.Platform.Application.Contracts.csproj b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN.Platform.Application.Contracts.csproj index 598cad9a2..831393257 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN.Platform.Application.Contracts.csproj +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN.Platform.Application.Contracts.csproj @@ -21,10 +21,6 @@ - - - - diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataCreateDto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataCreateDto.cs new file mode 100644 index 000000000..a5ea68f16 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataCreateDto.cs @@ -0,0 +1,9 @@ +using System; + +namespace LINGYUN.Platform.Datas +{ + public class DataCreateDto : DataCreateOrUpdateDto + { + public Guid? ParentId { get; set; } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataCreateOrUpdateDto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataCreateOrUpdateDto.cs new file mode 100644 index 000000000..c48488e5a --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataCreateOrUpdateDto.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Validation; + +namespace LINGYUN.Platform.Datas +{ + public class DataCreateOrUpdateDto + { + [Required] + [DynamicStringLength(typeof(DataConsts), nameof(DataConsts.MaxNameLength))] + public string Name { get; set; } + + [Required] + [DynamicStringLength(typeof(DataConsts), nameof(DataConsts.MaxDisplayNameLength))] + public string DisplayName { get; set; } + + [DynamicStringLength(typeof(DataConsts), nameof(DataConsts.MaxDescriptionLength))] + public string Description { get; set; } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataDto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataDto.cs new file mode 100644 index 000000000..d52aefc8c --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataDto.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using Volo.Abp.Application.Dtos; + +namespace LINGYUN.Platform.Datas +{ + public class DataDto : EntityDto + { + public string Name { get; set; } + + public string Code { get; set; } + + public string DisplayName { get; set; } + + public string Description { get; set; } + + public Guid? ParentId { get; set; } + + public List Items { get; set; } = new List(); + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataItemCreateDto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataItemCreateDto.cs new file mode 100644 index 000000000..e7321212e --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataItemCreateDto.cs @@ -0,0 +1,13 @@ +using System; +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Validation; + +namespace LINGYUN.Platform.Datas +{ + public class DataItemCreateDto : DataItemCreateOrUpdateDto + { + [Required] + [DynamicStringLength(typeof(DataItemConsts), nameof(DataItemConsts.MaxNameLength))] + public string Name { get; set; } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataItemCreateOrUpdateDto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataItemCreateOrUpdateDto.cs new file mode 100644 index 000000000..913f169d4 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataItemCreateOrUpdateDto.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Validation; +using System; +using Microsoft.Extensions.DependencyInjection; +using LINGYUN.Platform.Localization; +using Microsoft.Extensions.Localization; + +namespace LINGYUN.Platform.Datas +{ + public class DataItemCreateOrUpdateDto : IValidatableObject + { + [Required] + [DynamicStringLength(typeof(DataItemConsts), nameof(DataItemConsts.MaxDisplayNameLength))] + public string DisplayName { get; set; } + + [DynamicStringLength(typeof(DataItemConsts), nameof(DataItemConsts.MaxValueLength))] + public string DefaultValue { get; set; } + + [DynamicStringLength(typeof(DataItemConsts), nameof(DataItemConsts.MaxDescriptionLength))] + public string Description { get; set; } + + public bool AllowBeNull { get; set; } + + public ValueType ValueType { get; set; } + + public IEnumerable Validate(ValidationContext validationContext) + { + if (!AllowBeNull && DefaultValue.IsNullOrWhiteSpace()) + { + var localizer = validationContext.GetRequiredService>(); + yield return new ValidationResult( + localizer["The {0} field is required.", localizer["DisplayName:Value"]], + new string[] { nameof(DefaultValue) }); + } + } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataItemDto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataItemDto.cs new file mode 100644 index 000000000..f37517a94 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataItemDto.cs @@ -0,0 +1,20 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace LINGYUN.Platform.Datas +{ + public class DataItemDto : EntityDto + { + public string Name { get; set; } + + public string DisplayName { get; set; } + + public string DefaultValue { get; set; } + + public string Description { get; set; } + + public bool AllowBeNull { get; set; } + + public ValueType ValueType { get; set; } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataItemUpdateDto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataItemUpdateDto.cs new file mode 100644 index 000000000..26c1aaaaf --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataItemUpdateDto.cs @@ -0,0 +1,8 @@ +using System; + +namespace LINGYUN.Platform.Datas +{ + public class DataItemUpdateDto : DataItemCreateOrUpdateDto + { + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataUpdateDto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataUpdateDto.cs new file mode 100644 index 000000000..fe4fdaab8 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataUpdateDto.cs @@ -0,0 +1,7 @@ +namespace LINGYUN.Platform.Datas +{ + public class DataUpdateDto : DataCreateOrUpdateDto + { + + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/GetDataByNameInput.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/GetDataByNameInput.cs new file mode 100644 index 000000000..10e40aaa6 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/GetDataByNameInput.cs @@ -0,0 +1,12 @@ +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Validation; + +namespace LINGYUN.Platform.Datas +{ + public class GetDataByNameInput + { + [Required] + [DynamicStringLength(typeof(DataConsts), nameof(DataConsts.MaxNameLength))] + public string Name { get; set; } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/GetDataListInput.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/GetDataListInput.cs new file mode 100644 index 000000000..a7b9217f6 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/GetDataListInput.cs @@ -0,0 +1,9 @@ +using Volo.Abp.Application.Dtos; + +namespace LINGYUN.Platform.Datas +{ + public class GetDataListInput : PagedAndSortedResultRequestDto + { + public string Filter { get; set; } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/IDataAppService.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/IDataAppService.cs new file mode 100644 index 000000000..872e372f2 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/IDataAppService.cs @@ -0,0 +1,24 @@ +using System; +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Services; + +namespace LINGYUN.Platform.Datas +{ + public interface IDataAppService : + ICrudAppService< + DataDto, + Guid, + GetDataListInput, + DataCreateDto, + DataUpdateDto> + { + Task> GetAllAsync(); + + Task CreateItemAsync(Guid id, DataItemCreateDto input); + + Task UpdateItemAsync(Guid id, string name, DataItemUpdateDto input); + + Task DeleteItemAsync(Guid id, string name); + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/GetLayoutListInput.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/GetLayoutListInput.cs new file mode 100644 index 000000000..2e52dc5db --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/GetLayoutListInput.cs @@ -0,0 +1,13 @@ +using Volo.Abp.Application.Dtos; + +namespace LINGYUN.Platform.Layouts +{ + public class GetLayoutListInput : PagedAndSortedResultRequestDto + { + public string Filter { get; set; } + + public bool Reverse { get; set; } + + public PlatformType? PlatformType { get; set; } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/LayoutCreateDto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/LayoutCreateDto.cs new file mode 100644 index 000000000..38eca5d54 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/LayoutCreateDto.cs @@ -0,0 +1,9 @@ +using System; + +namespace LINGYUN.Platform.Layouts +{ + public class LayoutCreateDto : LayoutCreateOrUpdateDto + { + public Guid DataId { get; set; } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/LayoutCreateOrUpdateDto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/LayoutCreateOrUpdateDto.cs new file mode 100644 index 000000000..e4ce49eb7 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/LayoutCreateOrUpdateDto.cs @@ -0,0 +1,29 @@ +using LINGYUN.Platform.Routes; +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Validation; + +namespace LINGYUN.Platform.Layouts +{ + public class LayoutCreateOrUpdateDto + { + [Required] + [DynamicStringLength(typeof(RouteConsts), nameof(RouteConsts.MaxNameLength))] + public string Name { get; set; } + + [Required] + [DynamicStringLength(typeof(RouteConsts), nameof(RouteConsts.MaxDisplayNameLength))] + public string DisplayName { get; set; } + + [DynamicStringLength(typeof(RouteConsts), nameof(RouteConsts.MaxDescriptionLength))] + public string Description { get; set; } + + [Required] + [DynamicStringLength(typeof(RouteConsts), nameof(RouteConsts.MaxPathLength))] + public string Path { get; set; } + + [DynamicStringLength(typeof(RouteConsts), nameof(RouteConsts.MaxRedirectLength))] + public string Redirect { get; set; } + + public PlatformType PlatformType { get; set; } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/LayoutDto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/LayoutDto.cs new file mode 100644 index 000000000..5e59b7547 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/LayoutDto.cs @@ -0,0 +1,21 @@ +using LINGYUN.Platform.Routes; +using System; + +namespace LINGYUN.Platform.Layouts +{ + public class LayoutDto : RouteDto + { + /// + /// 布局编号 + /// + public string Code { get; set; } + /// + /// 所属平台 + /// + public PlatformType PlatformType { get; set; } + /// + /// 约定的Meta采用哪种数据字典,主要是约束路由必须字段的一致性 + /// + public Guid DataId { get; set; } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/LayoutUpdateDto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/LayoutUpdateDto.cs new file mode 100644 index 000000000..5ab55c5b3 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/LayoutUpdateDto.cs @@ -0,0 +1,6 @@ +namespace LINGYUN.Platform.Layouts +{ + public class LayoutUpdateDto : LayoutCreateOrUpdateDto + { + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/ILayoutAppService.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/ILayoutAppService.cs new file mode 100644 index 000000000..408877ac7 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/ILayoutAppService.cs @@ -0,0 +1,16 @@ +using System; +using Volo.Abp.Application.Services; + +namespace LINGYUN.Platform.Layouts +{ + public interface ILayoutAppService : + ICrudAppService< + LayoutDto, + Guid, + GetLayoutListInput, + LayoutCreateDto, + LayoutUpdateDto> + { + + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Localization/ApplicationContracts/en.json b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Localization/ApplicationContracts/en.json index cc5a6e73b..f52f54364 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Localization/ApplicationContracts/en.json +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Localization/ApplicationContracts/en.json @@ -17,6 +17,15 @@ "Permission:DeleteFile": "Delete file", "Permission:CopyFile": "Copy file", "Permission:MoveFile": "Move file", - "Permission:DownloadFile": "Download file" + "Permission:DownloadFile": "Download file", + "Permission:DataDictionary": "Data Dictionary", + "Permission:Layout": "Layout", + "Permission:Menu": "Menu", + "Permission:Create": "Create", + "Permission:Update": "Update", + "Permission:Delete": "Delete", + "Permission:ManageItems": "Manage Items", + "Permission:ManageRoleMenus": "Manage Role Menus", + "Permission:ManageUserMenus": "Manage User Menus" } } \ No newline at end of file diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Localization/ApplicationContracts/zh-Hans.json b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Localization/ApplicationContracts/zh-Hans.json index 865c16411..3df58b42c 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Localization/ApplicationContracts/zh-Hans.json +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Localization/ApplicationContracts/zh-Hans.json @@ -17,6 +17,15 @@ "Permission:DeleteFile": "删除文件", "Permission:CopyFile": "复制文件", "Permission:MoveFile": "移动文件", - "Permission:DownloadFile": "下载文件" + "Permission:DownloadFile": "下载文件", + "Permission:DataDictionary": "数据字典", + "Permission:Layout": "布局管理", + "Permission:Menu": "菜单管理", + "Permission:Create": "新增", + "Permission:Update": "新增", + "Permission:Delete": "新增", + "Permission:ManageItems": "管理项目", + "Permission:ManageRoleMenus": "管理角色菜单", + "Permission:ManageUserMenus": "管理用户菜单" } } \ No newline at end of file diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/GetMenuInput.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/GetMenuInput.cs new file mode 100644 index 000000000..5f2f556e4 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/GetMenuInput.cs @@ -0,0 +1,7 @@ +namespace LINGYUN.Platform.Menus +{ + public class GetMenuInput + { + public PlatformType PlatformType { get; set; } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuCreateDto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuCreateDto.cs new file mode 100644 index 000000000..4b79f11ef --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuCreateDto.cs @@ -0,0 +1,13 @@ +using System; +using System.ComponentModel.DataAnnotations; + +namespace LINGYUN.Platform.Menus +{ + public class MenuCreateDto : MenuCreateOrUpdateDto + { + public Guid? ParentId { get; set; } + + [Required] + public Guid LayoutId { get; set; } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuCreateOrUpdateDto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuCreateOrUpdateDto.cs new file mode 100644 index 000000000..433ea5085 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuCreateOrUpdateDto.cs @@ -0,0 +1,36 @@ +using LINGYUN.Platform.Routes; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Validation; + +namespace LINGYUN.Platform.Menus +{ + public class MenuCreateOrUpdateDto + { + [Required] + [DynamicStringLength(typeof(RouteConsts), nameof(RouteConsts.MaxNameLength))] + public string Name { get; set; } + + [Required] + [DynamicStringLength(typeof(RouteConsts), nameof(RouteConsts.MaxDisplayNameLength))] + public string DisplayName { get; set; } + + [DynamicStringLength(typeof(RouteConsts), nameof(RouteConsts.MaxDescriptionLength))] + public string Description { get; set; } + + [Required] + [DynamicStringLength(typeof(RouteConsts), nameof(RouteConsts.MaxPathLength))] + public string Path { get; set; } + + [DynamicStringLength(typeof(RouteConsts), nameof(RouteConsts.MaxRedirectLength))] + public string Redirect { get; set; } + + [Required] + [DynamicStringLength(typeof(MenuConsts), nameof(MenuConsts.MaxComponentLength))] + public string Component { get; set; } + + public bool IsPublic { get; set; } + + public Dictionary Meta { get; set; } = new Dictionary(); + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuDto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuDto.cs new file mode 100644 index 000000000..46e333003 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuDto.cs @@ -0,0 +1,32 @@ +using LINGYUN.Platform.Routes; +using System; +using System.Collections.Generic; + +namespace LINGYUN.Platform.Menus +{ + public class MenuDto : RouteDto + { + /// + /// 菜单编号 + /// + public string Code { get; set; } + /// + /// 菜单布局页 + /// + public string Component { get; set; } + /// + /// 所属平台 + /// + public PlatformType PlatformType { get; set; } + /// + /// 父节点 + /// + public Guid? ParentId { get; set; } + /// + /// 所属布局标识 + /// + public Guid LayoutId { get; set; } + + public bool IsPublic { get; set; } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetAllInput.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetAllInput.cs new file mode 100644 index 000000000..e9a54631a --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetAllInput.cs @@ -0,0 +1,18 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace LINGYUN.Platform.Menus +{ + public class MenuGetAllInput : ISortedResultRequest + { + public PlatformType? PlatformType { get; set; } + + public string Filter { get; set; } + + public bool Reverse { get; set; } + + public Guid? ParentId { get; set; } + + public string Sorting { get; set; } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetByRoleInput.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetByRoleInput.cs new file mode 100644 index 000000000..c099408f6 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetByRoleInput.cs @@ -0,0 +1,13 @@ +using System.ComponentModel.DataAnnotations; + +namespace LINGYUN.Platform.Menus +{ + public class MenuGetByRoleInput + { + [Required] + [StringLength(80)] + public string Role { get; set; } + + public PlatformType PlatformType { get; set; } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetByUserInput.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetByUserInput.cs new file mode 100644 index 000000000..1fec5084a --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetByUserInput.cs @@ -0,0 +1,15 @@ +using System; +using System.ComponentModel.DataAnnotations; + +namespace LINGYUN.Platform.Menus +{ + public class MenuGetByUserInput + { + [Required] + public Guid UserId { get; set; } + + public string[] Roles { get; set; } = new string[0]; + + public PlatformType PlatformType { get; set; } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetListInput.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetListInput.cs new file mode 100644 index 000000000..5a86ff7b6 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetListInput.cs @@ -0,0 +1,16 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace LINGYUN.Platform.Menus +{ + public class MenuGetListInput : PagedAndSortedResultRequestDto + { + public PlatformType? PlatformType { get; set; } + + public string Filter { get; set; } + + public bool Reverse { get; set; } + + public Guid? ParentId { get; set; } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuItemDto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuItemDto.cs new file mode 100644 index 000000000..0bc5350e9 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuItemDto.cs @@ -0,0 +1,21 @@ +using LINGYUN.Platform.Routes; +using System.Collections.Generic; + +namespace LINGYUN.Platform.Menus +{ + public class MenuItemDto : RouteDto + { + /// + /// 菜单编号 + /// + public string Code { get; set; } + /// + /// 菜单组件 + /// + public string Component { get; set; } + /// + /// 子菜单列表 + /// + public List Children { get; set; } = new List(); + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuUpdateDto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuUpdateDto.cs new file mode 100644 index 000000000..c6a75f952 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuUpdateDto.cs @@ -0,0 +1,6 @@ +namespace LINGYUN.Platform.Menus +{ + public class MenuUpdateDto : MenuCreateOrUpdateDto + { + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/RoleMenuInput.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/RoleMenuInput.cs new file mode 100644 index 000000000..e44537515 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/RoleMenuInput.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace LINGYUN.Platform.Menus +{ + public class RoleMenuInput + { + [Required] + [StringLength(80)] + public string RoleName { get; set; } + + [Required] + public List MenuIds { get; set; } = new List(); + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/UserMenuInput.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/UserMenuInput.cs new file mode 100644 index 000000000..b0f971fe6 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/UserMenuInput.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace LINGYUN.Platform.Menus +{ + public class UserMenuInput + { + [Required] + public Guid UserId { get; set; } + + [Required] + public List MenuIds { get; set; } = new List(); + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/IMenuAppService.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/IMenuAppService.cs new file mode 100644 index 000000000..d9c8030f8 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/IMenuAppService.cs @@ -0,0 +1,28 @@ +using System; +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Services; + +namespace LINGYUN.Platform.Menus +{ + public interface IMenuAppService : + ICrudAppService< + MenuDto, + Guid, + MenuGetListInput, + MenuCreateDto, + MenuUpdateDto> + { + Task> GetAllAsync(MenuGetAllInput input); + + Task> GetUserMenuListAsync(MenuGetByUserInput input); + + Task> GetRoleMenuListAsync(MenuGetByRoleInput input); + + Task SetUserMenusAsync(UserMenuInput input); + + Task SetRoleMenusAsync(RoleMenuInput input); + + Task> GetCurrentUserMenuListAsync(GetMenuInput input); + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Permissions/PlatformPermissionDefinitionProvider.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Permissions/PlatformPermissionDefinitionProvider.cs index 5a8448fa3..b7ffa6944 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Permissions/PlatformPermissionDefinitionProvider.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Permissions/PlatformPermissionDefinitionProvider.cs @@ -19,6 +19,25 @@ namespace LINGYUN.Platform.Permissions versionFile.AddChild(PlatformPermissions.AppVersion.FileManager.Delete, L("Permission:DeleteFile")); versionFile.AddChild(PlatformPermissions.AppVersion.FileManager.Download, L("Permission:DownloadFile")); + var dataDictionary = platform.AddPermission(PlatformPermissions.DataDictionary.Default, L("Permission:DataDictionary")); + dataDictionary.AddChild(PlatformPermissions.DataDictionary.Create, L("Permission:Create")); + dataDictionary.AddChild(PlatformPermissions.DataDictionary.Update, L("Permission:Update")); + dataDictionary.AddChild(PlatformPermissions.DataDictionary.Delete, L("Permission:Delete")); + dataDictionary.AddChild(PlatformPermissions.DataDictionary.ManageItems, L("Permission:ManageItems")); + + var layout = platform.AddPermission(PlatformPermissions.Layout.Default, L("Permission:Layout")); + layout.AddChild(PlatformPermissions.Layout.Create, L("Permission:Create")); + layout.AddChild(PlatformPermissions.Layout.Update, L("Permission:Update")); + layout.AddChild(PlatformPermissions.Layout.Delete, L("Permission:Delete")); + + var menu = platform.AddPermission(PlatformPermissions.Menu.Default, L("Permission:Menu")); + menu.AddChild(PlatformPermissions.Menu.Create, L("Permission:Create")); + menu.AddChild(PlatformPermissions.Menu.Update, L("Permission:Update")); + menu.AddChild(PlatformPermissions.Menu.Delete, L("Permission:Delete")); + menu.AddChild(PlatformPermissions.Menu.ManageRoles, L("Permission:ManageRoleMenus")); + menu.AddChild(PlatformPermissions.Menu.ManageUsers, L("Permission:ManageUserMenus")); + + // TODO: 2020-07-27 目前abp不支持对象存储管理(或者属于企业版?)需要创建一个 LINGYUN.Abp.BlobStoring 项目自行实现 //var fileSystem = platform.AddPermission(PlatformPermissions.FileSystem.Default, L("Permission:FileSystem")); diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Permissions/PlatformPermissions.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Permissions/PlatformPermissions.cs index b4b0d3c5c..899a3301f 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Permissions/PlatformPermissions.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Permissions/PlatformPermissions.cs @@ -2,10 +2,49 @@ namespace LINGYUN.Platform.Permissions { - public class PlatformPermissions + public static class PlatformPermissions { public const string GroupName = "Platform"; + public class DataDictionary + { + public const string Default = GroupName + ".DataDictionary"; + + public const string Create = Default + ".Create"; + + public const string Update = Default + ".Update"; + + public const string Delete = Default + ".Delete"; + + public const string ManageItems = Default + ".ManageItems"; + } + + public class Layout + { + public const string Default = GroupName + ".Layout"; + + public const string Create = Default + ".Create"; + + public const string Update = Default + ".Update"; + + public const string Delete = Default + ".Delete"; + } + + public class Menu + { + public const string Default = GroupName + ".Menu"; + + public const string Create = Default + ".Create"; + + public const string Update = Default + ".Update"; + + public const string Delete = Default + ".Delete"; + + public const string ManageRoles = Default + ".ManageRoles"; + + public const string ManageUsers = Default + ".ManageUsers"; + } + // 如果abp后期提供对象存储的目录管理接口,则启用此权限 /// /// 文件系统 diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/AppPlatformApplicationContractModule.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/PlatformApplicationContractModule.cs similarity index 75% rename from aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/AppPlatformApplicationContractModule.cs rename to aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/PlatformApplicationContractModule.cs index f52cdc6ac..fc629e070 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/AppPlatformApplicationContractModule.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/PlatformApplicationContractModule.cs @@ -5,14 +5,14 @@ using Volo.Abp.VirtualFileSystem; namespace LINGYUN.Platform { - [DependsOn(typeof(AppPlatformDomainSharedModule))] - public class AppPlatformApplicationContractModule : AbpModule + [DependsOn(typeof(PlatformDomainSharedModule))] + public class PlatformApplicationContractModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { Configure(options => { - options.FileSets.AddEmbedded(); + options.FileSets.AddEmbedded(); }); Configure(options => diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/PlatformRemoteServiceConsts.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/PlatformRemoteServiceConsts.cs new file mode 100644 index 000000000..b63616538 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/PlatformRemoteServiceConsts.cs @@ -0,0 +1,7 @@ +namespace LINGYUN.Platform +{ + public static class PlatformRemoteServiceConsts + { + public const string RemoteServiceName = "Platform"; + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Routes/Dto/RouteDto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Routes/Dto/RouteDto.cs new file mode 100644 index 000000000..4eb45ef5e --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Routes/Dto/RouteDto.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using Volo.Abp.Application.Dtos; + +namespace LINGYUN.Platform.Routes +{ + public class RouteDto : EntityDto + { + /// + /// 路径 + /// + public string Path { get; set; } + /// + /// 名称 + /// + public string Name { get; set; } + /// + /// 显示名称 + /// + public string DisplayName { get; set; } + /// + /// 说明 + /// + public string Description { get; set; } + /// + /// 重定向路径 + /// + public string Redirect { get; set; } + /// + /// 路由的一些辅助元素,取决于数据字典的设计 + /// + public Dictionary Meta { get; set; } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/AppPlatformApplicationMappingProfile.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/AppPlatformApplicationMappingProfile.cs deleted file mode 100644 index df2d61cb2..000000000 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/AppPlatformApplicationMappingProfile.cs +++ /dev/null @@ -1,14 +0,0 @@ -using AutoMapper; -using LINGYUN.Platform.Versions; - -namespace LINGYUN.Platform -{ - public class AppPlatformApplicationMappingProfile : Profile - { - public AppPlatformApplicationMappingProfile() - { - CreateMap(); - CreateMap(); - } - } -} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Datas/DataAppService.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Datas/DataAppService.cs new file mode 100644 index 000000000..e71adc928 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Datas/DataAppService.cs @@ -0,0 +1,191 @@ +using LINGYUN.Platform.Permissions; +using LINGYUN.Platform.Utils; +using Microsoft.AspNetCore.Authorization; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Application.Dtos; + +namespace LINGYUN.Platform.Datas +{ + [Authorize(PlatformPermissions.DataDictionary.Default)] + public class DataAppService : PlatformApplicationServiceBase, IDataAppService + { + protected IDataRepository DataRepository { get; } + + public DataAppService( + IDataRepository dataRepository) + { + DataRepository = dataRepository; + } + + [Authorize(PlatformPermissions.DataDictionary.Create)] + public virtual async Task CreateAsync(DataCreateDto input) + { + var data = await DataRepository.FindByNameAsync(input.Name); + if (data != null) + { + throw new UserFriendlyException("指定名称的数据字典已经存在!"); + } + + string code = string.Empty; + var children = await DataRepository.GetChildrenAsync(input.ParentId); + if (children.Any()) + { + var lastChildren = children.OrderBy(x => x.Code).FirstOrDefault(); + code = CodeNumberGenerator.CalculateNextCode(lastChildren.Code); + } + else + { + var parentData = input.ParentId != null + ? await DataRepository.GetAsync(input.ParentId.Value) + : null; + + code = CodeNumberGenerator.AppendCode(parentData?.Code, CodeNumberGenerator.CreateCode(1)); + } + + data = new Data( + GuidGenerator.Create(), + input.Name, + code, + input.DisplayName, + input.Description, + input.ParentId, + CurrentTenant.Id + ); + + data = await DataRepository.InsertAsync(data); + await CurrentUnitOfWork.SaveChangesAsync(); + + return ObjectMapper.Map(data); + } + + [Authorize(PlatformPermissions.DataDictionary.Delete)] + public virtual async Task DeleteAsync(Guid id) + { + var data = await DataRepository.GetAsync(id); + + var children = await DataRepository.GetChildrenAsync(data.Id); + if (children.Any()) + { + throw new UserFriendlyException("当前数据字典存在子节点,无法删除!"); + } + + await DataRepository.DeleteAsync(data); + } + + public virtual async Task GetAsync(Guid id) + { + var data = await DataRepository.GetAsync(id); + + return ObjectMapper.Map(data); + } + + public virtual async Task> GetAllAsync() + { + var datas = await DataRepository.GetListAsync(includeDetails: false); + + return new ListResultDto( + ObjectMapper.Map, List>(datas)); + } + + public virtual async Task> GetListAsync(GetDataListInput input) + { + var count = await DataRepository.GetCountAsync(input.Filter); + + var datas = await DataRepository.GetPagedListAsync( + input.Filter, input.Sorting, + false, input.SkipCount, input.MaxResultCount); + + return new PagedResultDto(count, + ObjectMapper.Map, List>(datas)); + } + + [Authorize(PlatformPermissions.DataDictionary.Update)] + public virtual async Task UpdateAsync(Guid id, DataUpdateDto input) + { + var data = await DataRepository.GetAsync(id); + + if (!string.Equals(data.Name, input.Name, StringComparison.InvariantCultureIgnoreCase)) + { + data.Name = input.Name; + } + if (!string.Equals(data.DisplayName, input.DisplayName, StringComparison.InvariantCultureIgnoreCase)) + { + data.DisplayName = input.DisplayName; + } + if (!string.Equals(data.Description, input.Description, StringComparison.InvariantCultureIgnoreCase)) + { + data.Description = input.Description; + } + + data = await DataRepository.UpdateAsync(data); + await CurrentUnitOfWork.SaveChangesAsync(); + + return ObjectMapper.Map(data); + } + + [Authorize(PlatformPermissions.DataDictionary.ManageItems)] + public virtual async Task UpdateItemAsync(Guid id, string name, DataItemUpdateDto input) + { + var data = await DataRepository.GetAsync(id); + var dataItem = data.FindItem(name); + if (dataItem == null) + { + throw new UserFriendlyException($"不存在名为 {name} 的数据字典项!"); + } + + if (!string.Equals(dataItem.DefaultValue, input.DefaultValue, StringComparison.InvariantCultureIgnoreCase)) + { + dataItem.DefaultValue = input.DefaultValue; + } + if (!string.Equals(dataItem.DisplayName, input.DisplayName, StringComparison.InvariantCultureIgnoreCase)) + { + dataItem.DisplayName = input.DisplayName; + } + if (!string.Equals(dataItem.Description, input.Description, StringComparison.InvariantCultureIgnoreCase)) + { + dataItem.Description = input.Description; + } + dataItem.AllowBeNull = input.AllowBeNull; + + data = await DataRepository.UpdateAsync(data); + await CurrentUnitOfWork.SaveChangesAsync(); + } + + [Authorize(PlatformPermissions.DataDictionary.ManageItems)] + public virtual async Task CreateItemAsync(Guid id, DataItemCreateDto input) + { + var data = await DataRepository.GetAsync(id); + var dataItem = data.FindItem(input.Name); + if (dataItem != null) + { + throw new UserFriendlyException($"已经存在名为 {input.Name} 的数据字典项!"); + } + + data.AddItem( + GuidGenerator, + input.Name, + input.DisplayName, + input.DefaultValue, + input.ValueType, + input.Description, + input.AllowBeNull); + + await DataRepository.UpdateAsync(data); + await CurrentUnitOfWork.SaveChangesAsync(); + } + + [Authorize(PlatformPermissions.DataDictionary.ManageItems)] + public virtual async Task DeleteItemAsync(Guid id, string name) + { + var data = await DataRepository.GetAsync(id); + data.RemoveItem(name); + + await DataRepository.UpdateAsync(data); + await CurrentUnitOfWork.SaveChangesAsync(); + } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Layouts/LayoutAppService.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Layouts/LayoutAppService.cs new file mode 100644 index 000000000..30a289f75 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Layouts/LayoutAppService.cs @@ -0,0 +1,130 @@ +using LINGYUN.Platform.Datas; +using LINGYUN.Platform.Permissions; +using LINGYUN.Platform.Utils; +using Microsoft.AspNetCore.Authorization; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Application.Dtos; + +namespace LINGYUN.Platform.Layouts +{ + [Authorize(PlatformPermissions.Layout.Default)] + public class LayoutAppService : PlatformApplicationServiceBase, ILayoutAppService + { + protected IDataRepository DataRepository { get; } + protected ILayoutRepository LayoutRepository { get; } + + public LayoutAppService( + IDataRepository dataRepository, + ILayoutRepository layoutRepository) + { + DataRepository = dataRepository; + LayoutRepository = layoutRepository; + } + + [Authorize(PlatformPermissions.Layout.Create)] + public virtual async Task CreateAsync(LayoutCreateDto input) + { + var data = DataRepository.FindAsync(input.DataId); + if (data == null) + { + throw new UserFriendlyException($"数据字典 {input.DataId} 的不存在或已删除!"); + } + + var layout = await LayoutRepository.FindByNameAsync(input.Name); + if (layout != null) + { + throw new UserFriendlyException($"已经存在名为 {input.Name} 的布局!"); + } + + var lastLayout = await LayoutRepository.GetLastOrNullAsync(); + var code = lastLayout != null + ? CodeNumberGenerator.CalculateNextCode(lastLayout.Code) + : CodeNumberGenerator.CreateCode(1); + + layout = new Layout( + GuidGenerator.Create(), + input.Path, + input.Name, + code, + input.DisplayName, + input.DataId, + input.PlatformType, + input.Redirect, + input.Description, + CurrentTenant.Id); + + layout = await LayoutRepository.InsertAsync(layout); + await CurrentUnitOfWork.SaveChangesAsync(); + + return ObjectMapper.Map(layout); + } + + [Authorize(PlatformPermissions.Layout.Delete)] + public virtual async Task DeleteAsync(Guid id) + { + var layout = await LayoutRepository.GetAsync(id); + + //if (await LayoutRepository.AnyMenuAsync(layout.Id)) + //{ + // throw new UserFriendlyException($"不能删除存在菜单的布局!"); + //} + + await LayoutRepository.DeleteAsync(layout); + await CurrentUnitOfWork.SaveChangesAsync(); + } + + public virtual async Task GetAsync(Guid id) + { + var layout = await LayoutRepository.GetAsync(id); + + return ObjectMapper.Map(layout); + } + + public virtual async Task> GetListAsync(GetLayoutListInput input) + { + var count = await LayoutRepository.GetCountAsync(input.PlatformType, input.Filter); + + var layouts = await LayoutRepository.GetListAsync( + input.PlatformType, input.Filter, + input.Sorting, input.Reverse, false, + input.SkipCount, input.MaxResultCount); + + return new PagedResultDto(count, + ObjectMapper.Map, List>(layouts)); + } + + [Authorize(PlatformPermissions.Layout.Update)] + public virtual async Task UpdateAsync(Guid id, LayoutUpdateDto input) + { + var layout = await LayoutRepository.GetAsync(id); + + if (!string.Equals(layout.Name, input.Name, StringComparison.InvariantCultureIgnoreCase)) + { + layout.Name = input.Name; + } + if (!string.Equals(layout.DisplayName, input.DisplayName, StringComparison.InvariantCultureIgnoreCase)) + { + layout.DisplayName = input.DisplayName; + } + if (!string.Equals(layout.Description, input.Description, StringComparison.InvariantCultureIgnoreCase)) + { + layout.Description = input.Description; + } + if (!string.Equals(layout.Path, input.Path, StringComparison.InvariantCultureIgnoreCase)) + { + layout.Path = input.Path; + } + if (!string.Equals(layout.Redirect, input.Redirect, StringComparison.InvariantCultureIgnoreCase)) + { + layout.Redirect = input.Redirect; + } + layout = await LayoutRepository.UpdateAsync(layout); + await CurrentUnitOfWork.SaveChangesAsync(); + + return ObjectMapper.Map(layout); + } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Menus/MenuAppService.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Menus/MenuAppService.cs new file mode 100644 index 000000000..e3e378848 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Menus/MenuAppService.cs @@ -0,0 +1,238 @@ +using LINGYUN.Platform.Datas; +using LINGYUN.Platform.Layouts; +using LINGYUN.Platform.Permissions; +using Microsoft.AspNetCore.Authorization; +using Microsoft.Extensions.Options; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Data; +using Volo.Abp.Users; + +namespace LINGYUN.Platform.Menus +{ + [Authorize(PlatformPermissions.Menu.Default)] + public class MenuAppService : PlatformApplicationServiceBase, IMenuAppService + { + protected DataItemMappingOptions DataItemMapping { get; } + protected MenuManager MenuManager { get; } + protected IMenuRepository MenuRepository { get; } + protected IDataRepository DataRepository { get; } + protected ILayoutRepository LayoutRepository { get; } + + public MenuAppService( + MenuManager menuManager, + IMenuRepository menuRepository, + IDataRepository dataRepository, + ILayoutRepository layoutRepository, + IOptions options) + { + MenuManager = menuManager; + MenuRepository = menuRepository; + DataRepository = dataRepository; + LayoutRepository = layoutRepository; + DataItemMapping = options.Value; + } + + [Authorize] + public virtual async Task> GetCurrentUserMenuListAsync(GetMenuInput input) + { + var myMenus = await MenuRepository.GetUserMenusAsync( + CurrentUser.GetId(), + CurrentUser.Roles, + input.PlatformType); + + return new ListResultDto( + ObjectMapper.Map, List>(myMenus)); + } + + public virtual async Task GetAsync(Guid id) + { + var menu = await MenuRepository.GetAsync(id); + + return ObjectMapper.Map(menu); + } + + public virtual async Task> GetAllAsync(MenuGetAllInput input) + { + var menus = await MenuRepository.GetAllAsync( + input.Filter, input.Sorting, input.Reverse, + input.PlatformType, input.ParentId); + + return new ListResultDto( + ObjectMapper.Map, List>(menus)); + } + + public virtual async Task> GetListAsync(MenuGetListInput input) + { + var count = await MenuRepository.GetCountAsync(input.Filter, input.PlatformType, input.ParentId); + + var menus = await MenuRepository.GetListAsync( + input.Filter, input.Sorting, input.Reverse, + input.PlatformType, input.ParentId, + input.SkipCount, input.MaxResultCount); + + return new PagedResultDto(count, + ObjectMapper.Map, List>(menus)); + } + + [Authorize(PlatformPermissions.Menu.Create)] + public virtual async Task CreateAsync(MenuCreateDto input) + { + var layout = await LayoutRepository.GetAsync(input.LayoutId); + var data = await DataRepository.GetAsync(layout.DataId); + + var menu = await MenuManager.CreateAsync( + GuidGenerator.Create(), + layout.Id, + input.Path, + input.Name, + input.Component, + input.DisplayName, + input.Redirect, + input.Description, + layout.PlatformType, + input.ParentId, + CurrentTenant.Id, + input.IsPublic); + + // 利用布局约定的数据字典来校验必须的路由元数据,元数据的加入是为了适配多端路由 + foreach (var dataItem in data.Items) + { + if (!input.Meta.TryGetValue(dataItem.Name, out object meta)) + { + if (!dataItem.AllowBeNull) + { + throw new BusinessException(PlatformErrorCodes.MenuMissingMetadata) + .WithData("Name", dataItem.DisplayName) + .WithData("DataName", data.DisplayName); + } + // 是否需要设定默认值 + menu.SetProperty(dataItem.Name, dataItem.DefaultValue); + } + else + { + // 需要检查参数是否有效 + menu.SetProperty(dataItem.Name, DataItemMapping.MapToString(dataItem.ValueType, meta)); + } + } + + await CurrentUnitOfWork.SaveChangesAsync(); + + return ObjectMapper.Map(menu); + } + + [Authorize(PlatformPermissions.Menu.Update)] + public virtual async Task UpdateAsync(Guid id, MenuUpdateDto input) + { + var menu = await MenuRepository.GetAsync(id); + + // 利用布局约定的数据字典来校验必须的路由元数据,元数据的加入是为了适配多端路由 + var layout = await LayoutRepository.GetAsync(menu.LayoutId); + var data = await DataRepository.GetAsync(layout.DataId); + foreach (var dataItem in data.Items) + { + if (!input.Meta.TryGetValue(dataItem.Name, out object meta)) + { + if (!dataItem.AllowBeNull) + { + throw new BusinessException(PlatformErrorCodes.MenuMissingMetadata) + .WithData("Name", dataItem.DisplayName) + .WithData("DataName", data.DisplayName); + } + // 是否需要设定默认值? + menu.SetProperty(dataItem.Name, dataItem.DefaultValue); + } + else + { + // 与现有的数据做对比 + var menuMeta = menu.GetProperty(dataItem.Name); + if (menuMeta != null && menuMeta.Equals(meta)) + { + continue; + } + // 需要检查参数是否有效 + menu.SetProperty(dataItem.Name, DataItemMapping.MapToString(dataItem.ValueType, meta)); + } + } + + if (!string.Equals(menu.Name, input.Name, StringComparison.InvariantCultureIgnoreCase)) + { + menu.Name = input.Name; + } + if (!string.Equals(menu.DisplayName, input.DisplayName, StringComparison.InvariantCultureIgnoreCase)) + { + menu.DisplayName = input.DisplayName; + } + if (!string.Equals(menu.Description, input.Description, StringComparison.InvariantCultureIgnoreCase)) + { + menu.Description = input.Description; + } + if (!string.Equals(menu.Path, input.Path, StringComparison.InvariantCultureIgnoreCase)) + { + menu.Path = input.Path; + } + if (!string.Equals(menu.Redirect, input.Redirect, StringComparison.InvariantCultureIgnoreCase)) + { + menu.Redirect = input.Redirect; + } + if (!string.Equals(menu.Component, input.Component, StringComparison.InvariantCultureIgnoreCase)) + { + menu.Component = input.Component; + } + + menu.IsPublic = input.IsPublic; + + await MenuManager.UpdateAsync(menu); + await CurrentUnitOfWork.SaveChangesAsync(); + + return ObjectMapper.Map(menu); + } + + [Authorize(PlatformPermissions.Menu.Delete)] + public virtual async Task DeleteAsync(Guid id) + { + var childrens = await MenuRepository.GetChildrenAsync(id); + if (childrens.Any()) + { + throw new BusinessException(PlatformErrorCodes.DeleteMenuHaveChildren); + } + + var menu = await MenuRepository.GetAsync(id); + await MenuRepository.DeleteAsync(menu); + } + + [Authorize(PlatformPermissions.Menu.ManageUsers)] + public virtual async Task> GetUserMenuListAsync(MenuGetByUserInput input) + { + var menus = await MenuRepository.GetUserMenusAsync(input.UserId, input.Roles, input.PlatformType); + + return new ListResultDto( + ObjectMapper.Map, List>(menus)); + } + + [Authorize(PlatformPermissions.Menu.ManageUsers)] + public virtual async Task SetUserMenusAsync(UserMenuInput input) + { + await MenuManager.SetUserMenusAsync(input.UserId, input.MenuIds); + } + + [Authorize(PlatformPermissions.Menu.ManageRoles)] + public virtual async Task SetRoleMenusAsync(RoleMenuInput input) + { + await MenuManager.SetRoleMenusAsync(input.RoleName, input.MenuIds); + } + + [Authorize(PlatformPermissions.Menu.ManageRoles)] + public virtual async Task> GetRoleMenuListAsync(MenuGetByRoleInput input) + { + var menus = await MenuRepository.GetRoleMenusAsync(new string[] { input.Role }, input.PlatformType); + + return new ListResultDto( + ObjectMapper.Map, List>(menus)); + } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationMappingProfile.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationMappingProfile.cs new file mode 100644 index 000000000..cab23e21b --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationMappingProfile.cs @@ -0,0 +1,24 @@ +using AutoMapper; +using LINGYUN.Platform.Datas; +using LINGYUN.Platform.Layouts; +using LINGYUN.Platform.Menus; +using LINGYUN.Platform.Versions; + +namespace LINGYUN.Platform +{ + public class PlatformApplicationMappingProfile : Profile + { + public PlatformApplicationMappingProfile() + { + CreateMap(); + CreateMap(); + + CreateMap(); + CreateMap(); + CreateMap() + .ForMember(dto => dto.Meta, map => map.MapFrom(src => src.ExtraProperties)); + CreateMap() + .ForMember(dto => dto.Meta, map => map.MapFrom(src => src.ExtraProperties)); + } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/AppPlatformApplicationModule.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationModule.cs similarity index 53% rename from aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/AppPlatformApplicationModule.cs rename to aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationModule.cs index 7d5222d8c..91fa001f7 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/AppPlatformApplicationModule.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationModule.cs @@ -4,16 +4,16 @@ using Volo.Abp.Modularity; namespace LINGYUN.Platform { - [DependsOn(typeof(AppPlatformApplicationContractModule))] - public class AppPlatformApplicationModule : AbpModule + [DependsOn(typeof(PlatformApplicationContractModule))] + public class PlatformApplicationModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - context.Services.AddAutoMapperObjectMapper(); + context.Services.AddAutoMapperObjectMapper(); Configure(options => { - options.AddProfile(validate: true); + options.AddProfile(validate: true); }); } } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Datas/DataConsts.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Datas/DataConsts.cs new file mode 100644 index 000000000..73d7f1e89 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Datas/DataConsts.cs @@ -0,0 +1,29 @@ +namespace LINGYUN.Platform.Datas +{ + public static class DataConsts + { + public static int MaxNameLength + { + get; + set; + } = 30; + + public static int MaxCodeLength + { + get; + set; + } = 1024; + + public static int MaxDisplayNameLength + { + get; + set; + } = 128; + + public static int MaxDescriptionLength + { + get; + set; + } = 1024; + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Datas/DataItemConsts.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Datas/DataItemConsts.cs new file mode 100644 index 000000000..2c7c0f439 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Datas/DataItemConsts.cs @@ -0,0 +1,29 @@ +namespace LINGYUN.Platform.Datas +{ + public static class DataItemConsts + { + public static int MaxNameLength + { + get; + set; + } = 30; + + public static int MaxValueLength + { + get; + set; + } = 128; + + public static int MaxDisplayNameLength + { + get; + set; + } = 128; + + public static int MaxDescriptionLength + { + get; + set; + } = 1024; + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Datas/ValueType.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Datas/ValueType.cs new file mode 100644 index 000000000..f2d878d35 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Datas/ValueType.cs @@ -0,0 +1,13 @@ +namespace LINGYUN.Platform.Datas +{ + public enum ValueType + { + String = 0, + Numeic = 1, + Boolean = 2, + Date = 3, + DateTime = 4, + Array = 5 + + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/en.json b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/en.json index 0041349ef..9cd1bf49a 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/en.json +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/en.json @@ -1,12 +1,52 @@ { "culture": "en", "texts": { - "Platform.VersionFile:404": "File not found, name: {FileName}, version:{FileVersion}!", + "Platform:01404": "File not found, name: {FileName}, version:{FileVersion}!", + "Platform:02001": "The same menu exists in the sibling directory: {Name}!", + "Platform:02002": "You are not allowed to delete menu nodes when there are other submenus!", + "Platform:02003": "The menu level has reached the specified maximum: {Depth}!", + "Platform:02101": "The menu metadata is missing the necessary element :{Name}, which is defined in the data dictionary :{DataName}!", + "Platform:03001": "The metadata format does not match!", "UploadFileSizeBeyondLimit": "Upload file size cannot exceed {0} MB!", "NotAllowedFileExtensionName": "Not allowed file extension: {0}!", "DisplayName:VersionFileLimitLength": "File limit size", "Description:VersionFileLimitLength": "Limit size of uploaded file in MB", "DisplayName:AllowVersionFileExtensions": "File extension", - "Description:AllowVersionFileExtensions": "List of allowed extensions to upload files, with multiple extensions separated by, don't need a notation" + "Description:AllowVersionFileExtensions": "List of allowed extensions to upload files, with multiple extensions separated by, don't need a notation", + "DisplayName:Menus": "Menus", + "DisplayName:Name": "Name", + "DisplayName:Code": "Code", + "DisplayName:IsPublic": "Is Public", + "DisplayName:DisplayName": "Display Name", + "DisplayName:Description": "Description", + "DisplayName:AllowBeNull": "Allow Be Null", + "DisplayName:DefaultValue": "Default Value", + "DisplayName:ValueType": "Value Type", + "DisplayName:Path": "Path", + "DisplayName:Redirect": "Redirect", + "DisplayName:Meta": "Meta", + "DisplayName:Component": "Component", + "DisplayName:Filter": "Filter", + "DisplayName:PlatformType": "Platform Type", + "DisplayName:SecrchMenu": "Secrch", + "DisplayName:Layout": "Layout", + "DisplayName:Basic": "Basic", + "DisplayName:DataDictionary": "Data Dictionary", + "Menu:AddNew": "Add New", + "Menu:AddChildren": "Add Children", + "Menu:Edit": "Edit", + "Menu:EditByName": "Edit Menu - {0}", + "Menu:Delete": "Delete", + "Menu:WillDelete": "The menu {0} will be deleted", + "Data:WillDelete": "The dictionary {0} will be deleted", + "Menu:Manage": "Manage Menus", + "Data:AddNew": "Add New", + "Data:AddChildren": "Add Children", + "Data:Edit": "Edit", + "Data:Delete": "Delete", + "Data:AppendItem": "Append Item", + "Data:EditItem": "Edit Item", + "Data:RemoveItem": "Remove Item", + "Data:Items": "Data Items" } } \ No newline at end of file diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/zh-Hans.json b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/zh-Hans.json index 049b1aa35..f5c536e60 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/zh-Hans.json +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/zh-Hans.json @@ -1,12 +1,52 @@ { "culture": "zh-Hans", "texts": { - "Platform.VersionFile:404": "文件: {FileName}, 版本号:{FileVersion} 不存在!", + "Platform:01404": "文件: {FileName}, 版本号: {FileVersion} 不存在!", + "Platform:02001": "同级目录下存在相同的菜单: {Name}!", + "Platform:02002": "在有其他子菜单的情况下,不允许删除菜单节点!", + "Platform:02003": "菜单层级已达到规定最大值: {Depth}!", + "Platform:02101": "菜单元数据缺少必要的元素: {Name},此选项在数据字典:{DataName} 中定义!", + "Platform:03001": "元数据格式不匹配!", "UploadFileSizeBeyondLimit": "上传文件大小不能超过 {0} MB!", "NotAllowedFileExtensionName": "不被允许的文件扩展名: {0}!", "DisplayName:VersionFileLimitLength": "文件限制大小", "Description:VersionFileLimitLength": "上传文件的限制大小,单位(MB)", "DisplayName:AllowVersionFileExtensions": "文件扩展名", - "Description:AllowVersionFileExtensions": "允许的上传文件扩展名列表,多个扩展名以,分隔,无需输入.符号" + "Description:AllowVersionFileExtensions": "允许的上传文件扩展名列表,多个扩展名以,分隔,无需输入.符号", + "DisplayName:Menus": "菜单列表", + "DisplayName:Name": "名称", + "DisplayName:Code": "编号", + "DisplayName:IsPublic": "是否公用的", + "DisplayName:DisplayName": "显示名称", + "DisplayName:Description": "说明", + "DisplayName:AllowBeNull": "允许空值", + "DisplayName:DefaultValue": "默认值", + "DisplayName:ValueType": "值类型", + "DisplayName:Path": "路径", + "DisplayName:Redirect": "重定向路径", + "DisplayName:Meta": "元数据", + "DisplayName:Component": "组件", + "DisplayName:Filter": "筛选", + "DisplayName:PlatformType": "平台类型", + "DisplayName:SecrchMenu": "查询菜单", + "DisplayName:Layout": "布局", + "DisplayName:Basic": "基础信息", + "DisplayName:DataDictionary": "数据字典", + "Menu:AddNew": "添加新菜单", + "Menu:AddChildren": "添加子菜单", + "Menu:Edit": "编辑菜单", + "Menu:EditByName": "编辑菜单 - {0}", + "Menu:Delete": "删除菜单", + "Menu:WillDelete": "将要删除菜单 {0}", + "Menu:Manage": "管理菜单", + "Data:WillDelete": "将要删除字典 {0}", + "Data:AddNew": "添加新字典", + "Data:AddChildren": "添加下级字典", + "Data:Edit": "编辑字典", + "Data:Delete": "删除字典", + "Data:AppendItem": "添加项目", + "Data:EditItem": "编辑项目", + "Data:RemoveItem": "删除项目", + "Data:Items": "字典项目" } } \ No newline at end of file diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Menus/MenuConsts.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Menus/MenuConsts.cs new file mode 100644 index 000000000..8a6be5ec2 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Menus/MenuConsts.cs @@ -0,0 +1,21 @@ +namespace LINGYUN.Platform.Menus +{ + public static class MenuConsts + { + public static int MaxComponentLength + { + get; + set; + } = 255; + + /// + /// 最大深度 + /// + /// + /// 默认为4,仅支持四级子菜单 + /// + public const int MaxDepth = 4; + + public const int MaxCodeLength = MaxDepth * (PlatformConsts.CodeUnitLength + 1) - 1; + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformConsts.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformConsts.cs new file mode 100644 index 000000000..bd8d662e1 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformConsts.cs @@ -0,0 +1,14 @@ +namespace LINGYUN.Platform +{ + public static class PlatformConsts + { + /// + /// 编号不足位补足字符,如编号为 3,长度5位,补足字符为 0,则编号为00003 + /// + public static char CodePrefix { get; set; } = '0'; + /// + /// 编号长度 + /// + public const int CodeUnitLength = 5; + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/AppPlatformDomainSharedModule.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformDomainSharedModule.cs similarity index 79% rename from aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/AppPlatformDomainSharedModule.cs rename to aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformDomainSharedModule.cs index acc7df9f6..9117c3db2 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/AppPlatformDomainSharedModule.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformDomainSharedModule.cs @@ -8,13 +8,13 @@ using Volo.Abp.VirtualFileSystem; namespace LINGYUN.Platform { [DependsOn(typeof(AbpLocalizationModule))] - public class AppPlatformDomainSharedModule : AbpModule + public class PlatformDomainSharedModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { Configure(options => { - options.FileSets.AddEmbedded(); + options.FileSets.AddEmbedded(); }); Configure(options => @@ -27,7 +27,7 @@ namespace LINGYUN.Platform Configure(options => { - options.MapCodeNamespace("Platform.VersionFile", typeof(PlatformResource)); + options.MapCodeNamespace("Platform", typeof(PlatformResource)); }); } } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformErrorCodes.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformErrorCodes.cs index ff48ac5d9..42468aaf7 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformErrorCodes.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformErrorCodes.cs @@ -2,6 +2,28 @@ { public static class PlatformErrorCodes { - public const string VersionFileNotFound = "Platform.VersionFile:404"; + private const string Namespace = "Platform"; + + public const string VersionFileNotFound = Namespace + ":01404"; + /// + /// 同级菜单已经存在 + /// + public const string DuplicateMenu = Namespace + ":02001"; + /// + /// 不能删除拥有子菜单的节点 + /// + public const string DeleteMenuHaveChildren = Namespace + ":02002"; + /// + /// 菜单层级已达到最大值 + /// + public const string MenuAchieveMaxDepth = Namespace + ":02003"; + /// + /// 菜单元数据缺少必要的元素 + /// + public const string MenuMissingMetadata = Namespace + ":02101"; + /// + /// 元数据格式不匹配 + /// + public const string MetaFormatMissMatch = Namespace + ":03001"; } } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformType.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformType.cs index 1fe59078c..509c8e6cd 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformType.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformType.cs @@ -53,8 +53,12 @@ namespace LINGYUN.Platform /// Mobile = Android | iOS, /// + /// 小程序 + /// + MiniProgram = 256, + /// /// 所有平台通用 /// - All = Desktop | Web | Mobile + All = Desktop | Web | Mobile | MiniProgram } } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/RouteConsts.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/RouteConsts.cs index 605d76431..55dbace88 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/RouteConsts.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/RouteConsts.cs @@ -32,7 +32,13 @@ set; } = 128; - public static int MaxLinkUrlLength + public static int MaxPathLength + { + get; + set; + } = 255; + + public static int MaxRedirectLength { get; set; diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/RouteEto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/RouteEto.cs index 94855b2e8..52bfc1954 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/RouteEto.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/RouteEto.cs @@ -7,11 +7,10 @@ namespace LINGYUN.Platform.Routes { public Guid? TenantId { get; set; } public Guid Id { get; set; } - public string Code { get; set; } + public string Path { get; set; } public string Name { get; set; } public string DisplayName { get; set; } - public string LinkUrl { get; set; } - public string Icon { get; set; } - public PlatformType PlatformType { get; set; } + public string Description { get; set; } + public string Redirect { get; set; } } } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/Data.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/Data.cs new file mode 100644 index 000000000..da25faa6b --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/Data.cs @@ -0,0 +1,121 @@ +using JetBrains.Annotations; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using Volo.Abp; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.Guids; +using Volo.Abp.MultiTenancy; + +namespace LINGYUN.Platform.Datas +{ + /// + /// 数据字典 + /// + public class Data : FullAuditedAggregateRoot, IMultiTenant + { + public virtual Guid? TenantId { get; protected set; } + + public virtual string Name { get; set; } + + public virtual string Code { get; set; } + + public virtual string DisplayName { get; set; } + + public virtual string Description { get; set; } + + public virtual Guid? ParentId { get; set; } + + public virtual ICollection Items { get; protected set; } + + protected Data() + { + Items = new Collection(); + } + + public Data( + [NotNull] Guid id, + [NotNull] string name, + [NotNull] string code, + [NotNull] string displayName, + string description = "", + Guid? parentId = null, + Guid? tenantId = null) + { + Check.NotNull(id, nameof(id)); + Check.NotNullOrWhiteSpace(name, nameof(name)); + Check.NotNullOrWhiteSpace(code, nameof(code)); + Check.NotNullOrWhiteSpace(displayName, nameof(displayName)); + + Id = id; + Name = name; + Code = code; + DisplayName = displayName; + Description = description; + ParentId = parentId; + TenantId = tenantId; + + CreationTime = DateTime.Now; + + Items = new Collection(); + } + + public Data AddItem( + [NotNull] IGuidGenerator guidGenerator, + [NotNull] string name, + [NotNull] string displayName, + [CanBeNull] string defaultValue, + ValueType valueType = ValueType.String, + string description = "", + bool allowBeNull = true) + { + Check.NotNull(guidGenerator, nameof(guidGenerator)); + Check.NotNull(name, nameof(name)); + Check.NotNull(displayName, nameof(displayName)); + + if (!IsInItem(name)) + { + var dataItem = new DataItem( + guidGenerator.Create(), + Id, + name, + displayName, + defaultValue, + valueType, + description, + allowBeNull, + TenantId + ); + Items.Add(dataItem); + } + + return this; + } + + public DataItem FindItem(string name) + { + return Items.FirstOrDefault(item => item.Name == name); + } + + public DataItem FindItem(Guid id) + { + return Items.FirstOrDefault(item => item.Id == id); + } + + public bool RemoveItem(string name) + { + if (IsInItem(name)) + { + Items.RemoveAll(item => item.Name == name); + return true; + } + return false; + } + + public bool IsInItem(string name) + { + return Items.Any(item => item.Name == name); + } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/DataDictionaryDataSeeder.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/DataDictionaryDataSeeder.cs new file mode 100644 index 000000000..cbcaabbef --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/DataDictionaryDataSeeder.cs @@ -0,0 +1,50 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Guids; + +namespace LINGYUN.Platform.Datas +{ + public class DataDictionaryDataSeeder : IDataDictionaryDataSeeder, ITransientDependency + { + protected IGuidGenerator GuidGenerator { get; } + protected IDataRepository DataRepository { get; } + + public DataDictionaryDataSeeder( + IGuidGenerator guidGenerator, + IDataRepository dataRepository) + { + GuidGenerator = guidGenerator; + DataRepository = dataRepository; + } + + public virtual async Task SeedAsync( + string name, + string code, + string displayName, + string description = "", + Guid? parentId = null, + Guid? tenantId = null, + CancellationToken cancellationToken = default) + { + var data = await DataRepository.FindByNameAsync(name, cancellationToken: cancellationToken); + + if (data == null) + { + data = new Data( + GuidGenerator.Create(), + name, + code, + displayName, + description, + parentId, + tenantId); + + data = await DataRepository.InsertAsync(data); + } + + return data; + } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/DataItem.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/DataItem.cs new file mode 100644 index 000000000..7730c8656 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/DataItem.cs @@ -0,0 +1,90 @@ +using JetBrains.Annotations; +using System; +using System.Collections.Generic; +using Volo.Abp; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace LINGYUN.Platform.Datas +{ + public class DataItem : FullAuditedAggregateRoot, IMultiTenant + { + public virtual Guid? TenantId { get; protected set; } + + public virtual string Name { get; protected set; } + + public virtual string DisplayName { get; set; } + + public virtual string DefaultValue { get; set; } + + public virtual string Description { get; set; } + + public virtual bool AllowBeNull { get; set; } + + public virtual ValueType ValueType { get; protected set; } + + public virtual Guid DataId { get; protected set; } + + protected DataItem() { } + + public DataItem( + [NotNull] Guid id, + [NotNull] Guid dataId, + [NotNull] string name, + [NotNull] string displayName, + [CanBeNull] string defaultValue = null, + ValueType valueType = ValueType.String, + string description = "", + bool allowBeNull = true, + Guid? tenantId = null) + { + Check.NotNull(id, nameof(id)); + Check.NotNull(dataId, nameof(dataId)); + Check.NotNullOrWhiteSpace(name, nameof(name)); + Check.NotNullOrWhiteSpace(displayName, nameof(displayName)); + + Id = id; + Name = name; + DefaultValue = defaultValue ?? SetDefaultValue(); + ValueType = valueType; + DisplayName = displayName; + AllowBeNull = allowBeNull; + + DataId = dataId; + TenantId = tenantId; + Description = description; + } + + public string SetDefaultValue() + { + switch (ValueType) + { + case ValueType.Array: + DefaultValue = "";// 当数据类型为数组对象时,需要前端来做转换了,约定的分隔符为英文逗号 + break; + case ValueType.Boolean: + DefaultValue = "false"; + break; + case ValueType.Date: + DefaultValue = !AllowBeNull ? DateTime.Now.ToString("yyyy-MM-dd") : ""; + break; + case ValueType.DateTime: + if (!AllowBeNull) + { + DefaultValue = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); // TODO: 以当前时间作为默认值? + } + DefaultValue = !AllowBeNull ? DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") : ""; + break; + case ValueType.Numeic: + DefaultValue = "0"; + break; + default: + case ValueType.String: + DefaultValue = ""; + break; + } + + return DefaultValue; + } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/DataItemMappingOptions.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/DataItemMappingOptions.cs new file mode 100644 index 000000000..64749afe3 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/DataItemMappingOptions.cs @@ -0,0 +1,105 @@ +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using Volo.Abp; + +namespace LINGYUN.Platform.Datas +{ + public class DataItemMappingOptions + { + public Dictionary> DataItemMaps { get; } + + public DataItemMappingOptions() + { + DataItemMaps = new Dictionary>(); + } + + internal void SetDefaultMapping() + { + SetMapping(ValueType.Array, value => + { + if (value == null) + { + return ""; + } + + if (value is JArray array) + { + var joinString = string.Empty; + foreach (var obj in array.Children()) + { + joinString += obj.ToString() + ","; + } + return joinString.EndsWith(",") ? joinString.Substring(0, joinString.Length - 1) : joinString; + } + throw new BusinessException(PlatformErrorCodes.MetaFormatMissMatch); + }); + SetMapping(ValueType.Boolean, value => + { + if (value != null) + { + if (value is bool bo) + { + return bo.ToString().ToLower(); + } + else + { + var boInput = value.ToString().ToLower(); + if (boInput == "true" || + boInput == "false") + { + return boInput; + } + } + } + throw new BusinessException(PlatformErrorCodes.MetaFormatMissMatch); + }); + SetMapping(ValueType.Date, value => + { + if (value != null && value is DateTime date) + { + return date.ToString("yyyy-MM-dd"); + } + throw new BusinessException(PlatformErrorCodes.MetaFormatMissMatch); + }); + SetMapping(ValueType.DateTime, value => + { + if (value != null && value is DateTime date) + { + return date.ToString("yyyy-MM-dd HH:mm:ss"); + } + throw new BusinessException(PlatformErrorCodes.MetaFormatMissMatch); + }); + SetMapping(ValueType.Numeic, value => + { + if (value != null) + { + var valueType = value.GetType(); + if (!valueType.IsClass && !valueType.IsInterface && typeof(IFormattable).IsAssignableFrom(valueType)) + { + return value.ToString(); + } + } + throw new BusinessException(PlatformErrorCodes.MetaFormatMissMatch); + }); + SetMapping(ValueType.String, value => + { + if (value == null) + { + return ""; + } + return value.ToString(); + }); + } + + public void SetMapping(ValueType valueType, Func func) + { + DataItemMaps[valueType] = func; + } + + public string MapToString(ValueType valueType, object inputValue) + { + return DataItemMaps[valueType](inputValue); + } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/IDataDictionaryDataSeeder.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/IDataDictionaryDataSeeder.cs new file mode 100644 index 000000000..9c8eb400c --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/IDataDictionaryDataSeeder.cs @@ -0,0 +1,18 @@ +using System; +using System.Threading; +using System.Threading.Tasks; + +namespace LINGYUN.Platform.Datas +{ + public interface IDataDictionaryDataSeeder + { + Task SeedAsync( + string name, + string code, + string displayName, + string description = "", + Guid? parentId = null, + Guid? tenantId = null, + CancellationToken cancellationToken = default); + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/IDataRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/IDataRepository.cs new file mode 100644 index 000000000..22bcc8020 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/IDataRepository.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories; + +namespace LINGYUN.Platform.Datas +{ + public interface IDataRepository : IBasicRepository + { + Task FindByNameAsync( + string name, + bool includeDetails = true, + CancellationToken cancellationToken = default); + + Task> GetChildrenAsync( + Guid? parentId, + bool includeDetails = false, + CancellationToken cancellationToken = default + ); + + Task GetCountAsync( + string filter = "", + CancellationToken cancellationToken = default); + + Task> GetPagedListAsync( + string filter = "", + string sotring = nameof(Data.Code), + bool includeDetails = false, + int skipCount = 0, + int maxResultCount = 10, + CancellationToken cancellationToken = default); + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Layouts/ILayoutRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Layouts/ILayoutRepository.cs new file mode 100644 index 000000000..5c5604548 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Layouts/ILayoutRepository.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories; + +namespace LINGYUN.Platform.Layouts +{ + public interface ILayoutRepository : IBasicRepository + { + /// + /// 根据名称查询布局 + /// + /// + /// + /// + /// + Task FindByNameAsync( + string name, + bool includeDetails = true, + CancellationToken cancellationToken = default); + + Task GetLastOrNullAsync( + CancellationToken cancellationToken = default); + + Task GetCountAsync( + PlatformType? platformType = null, + string filter = "", + CancellationToken cancellationToken = default); + + Task> GetListAsync( + PlatformType? platformType = null, + string filter = "", + string sorting = nameof(Layout.Code), + bool reverse = false, + bool includeDetails = false, + int skipCount = 0, + int maxResultCount = 10, + CancellationToken cancellationToken = default); + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Layouts/Layout.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Layouts/Layout.cs new file mode 100644 index 000000000..6699c22cd --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Layouts/Layout.cs @@ -0,0 +1,48 @@ +using JetBrains.Annotations; +using LINGYUN.Platform.Routes; +using System; +using Volo.Abp; + +namespace LINGYUN.Platform.Layouts +{ + /// + /// 布局视图实体 + /// + public class Layout : Route + { + /// + /// 布局编号 + /// + public virtual string Code { get; set; } + /// + /// 所属平台 + /// + public virtual PlatformType PlatformType { get; protected set; } + /// + /// 约定的Meta采用哪种数据字典,主要是约束路由必须字段的一致性 + /// + public virtual Guid DataId { get; protected set; } + + protected Layout() { } + + public Layout( + [NotNull] Guid id, + [NotNull] string path, + [NotNull] string name, + [NotNull] string code, + [NotNull] string displayName, + [NotNull] Guid dataId, + [NotNull] PlatformType platformType = PlatformType.None, + [CanBeNull] string redirect = "", + [CanBeNull] string description = "", + [CanBeNull] Guid? tenantId = null) + : base(id, path, name, displayName, redirect, description, tenantId) + { + Check.NotNullOrWhiteSpace(code, nameof(code)); + + Code = code; + DataId = dataId; + PlatformType = platformType; + } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IMenuRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IMenuRepository.cs new file mode 100644 index 000000000..b57c0b44e --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IMenuRepository.cs @@ -0,0 +1,110 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories; + +namespace LINGYUN.Platform.Menus +{ + public interface IMenuRepository : IBasicRepository + { + /// + /// 根据名称查询菜单 + /// + /// + /// + /// + Task FindByNameAsync( + string menuName, + CancellationToken cancellationToken = default); + /// + /// 查询主菜单,每一个布局页创建的时候都要创建路径为 / 的主菜单 + /// + /// + /// + /// + Task FindMainAsync( + PlatformType platformType = PlatformType.None, + CancellationToken cancellationToken = default); + /// + /// 获取子节点 + /// + /// + /// + /// + Task> GetChildrenAsync( + Guid? parentId, + CancellationToken cancellationToken = default + ); + /// + /// 通过父菜单编码查询子菜单 + /// + /// + /// + /// + /// + Task> GetAllChildrenWithParentCodeAsync( + string code, + Guid? parentId, + CancellationToken cancellationToken = default + ); + /// + /// 查找用户可访问菜单 + /// + /// 用户标识 + /// 角色列表 + /// 平台类型 + /// + /// + Task> GetUserMenusAsync( + Guid userId, + string[] roles, + PlatformType platformType = PlatformType.None, + CancellationToken cancellationToken = default); + /// + /// 查找角色可访问菜单 + /// + /// 角色列表 + /// 平台类型 + /// + /// + Task> GetRoleMenusAsync( + string[] roles, + PlatformType platformType = PlatformType.None, + CancellationToken cancellationToken = default); + + Task GetCountAsync( + string filter = "", + PlatformType? platformType = null, + Guid? parentId = null, + CancellationToken cancellationToken = default); + + Task> GetListAsync( + string filter = "", + string sorting = nameof(Menu.Code), + bool reverse = false, + PlatformType? platformType = null, + Guid? parentId = null, + int skipCount = 0, + int maxResultCount = 10, + CancellationToken cancellationToken = default); + + Task> GetAllAsync( + string filter = "", + string sorting = nameof(Menu.Code), + bool reverse = false, + PlatformType? platformType = null, + Guid? parentId = null, + CancellationToken cancellationToken = default); + + Task RemoveAllRolesAsync( + Menu menu, + CancellationToken cancellationToken = default + ); + + Task RemoveAllMembersAsync( + Menu menu, + CancellationToken cancellationToken = default + ); + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IRoleMenuRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IRoleMenuRepository.cs new file mode 100644 index 000000000..816c24924 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IRoleMenuRepository.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories; + +namespace LINGYUN.Platform.Menus +{ + public interface IRoleMenuRepository : IBasicRepository + { + /// + /// 角色是否拥有菜单 + /// + /// + /// + /// + /// + Task RoleHasInMenuAsync( + string roleName, + string menuName, + CancellationToken cancellationToken = default); + + Task SetRoleMenusAsync( + string roleName, + IEnumerable menuIds, + CancellationToken cancellationToken = default); + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IUserMenuRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IUserMenuRepository.cs new file mode 100644 index 000000000..28b2c8ced --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IUserMenuRepository.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories; + +namespace LINGYUN.Platform.Menus +{ + public interface IUserMenuRepository : IBasicRepository + { + /// + /// 用户是否拥有菜单 + /// + /// + /// + /// + /// + Task UserHasInMenuAsync( + Guid userId, + string menuName, + CancellationToken cancellationToken = default); + + Task SetMemberMenusAsync( + Guid userId, + IEnumerable menuIds, + CancellationToken cancellationToken = default); + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/Menu.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/Menu.cs new file mode 100644 index 000000000..ef248adad --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/Menu.cs @@ -0,0 +1,67 @@ +using JetBrains.Annotations; +using LINGYUN.Platform.Routes; +using System; +using Volo.Abp; + +namespace LINGYUN.Platform.Menus +{ + /// + /// 菜单 + /// + public class Menu : Route + { + /// + /// 所属平台 + /// + public virtual PlatformType PlatformType { get; set; } + /// + /// 菜单编号 + /// + public virtual string Code { get; set; } + /// + /// 菜单布局页,Layout的路径 + /// + public virtual string Component { get; set; } + /// + /// 所属的父菜单 + /// + public virtual Guid? ParentId { get; set; } + /// + /// 所属布局标识 + /// + public virtual Guid LayoutId { get; set; } + /// + /// 公共菜单 + /// + public virtual bool IsPublic { get; set; } + protected Menu() + { + } + + public Menu( + [NotNull] Guid id, + [NotNull] Guid layoutId, + [NotNull] string path, + [NotNull] string name, + [NotNull] string code, + [NotNull] string component, + [NotNull] string displayName, + string redirect = "", + string description = "", + PlatformType platformType = PlatformType.None, + Guid? parentId = null, + Guid? tenantId = null) + : base(id, path, name, displayName, redirect, description, tenantId) + { + Check.NotNullOrWhiteSpace(code, nameof(code)); + + LayoutId = layoutId; + Code = code; + Component = component;// 下属的一级菜单的Component应该是布局页, 例如vue-admin中的 component: Layout, 其他前端框架雷同, 此处应传递布局页的路径让前端import + PlatformType = platformType; + ParentId = parentId; + + IsPublic = false; + } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/MenuManager.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/MenuManager.cs new file mode 100644 index 000000000..a6ef79151 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/MenuManager.cs @@ -0,0 +1,191 @@ +using LINGYUN.Platform.Utils; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Domain.Services; +using Volo.Abp.Uow; + +namespace LINGYUN.Platform.Menus +{ + public class MenuManager : DomainService + { + protected IMenuRepository MenuRepository { get; } + protected IUserMenuRepository UserMenuRepository { get; } + protected IRoleMenuRepository RoleMenuRepository { get; } + + public MenuManager( + IMenuRepository menuRepository, + IUserMenuRepository userMenuRepository, + IRoleMenuRepository roleMenuRepository) + { + MenuRepository = menuRepository; + UserMenuRepository = userMenuRepository; + RoleMenuRepository = roleMenuRepository; + } + + [UnitOfWork] + public virtual async Task CreateAsync( + Guid id, + Guid layoutId, + string path, + string name, + string component, + string displayName, + string redirect = "", + string description = "", + PlatformType platformType = PlatformType.None, + Guid? parentId = null, + Guid? tenantId = null, + bool isPublic = false) + { + var code = await GetNextChildCodeAsync(parentId); + if (code.Length > MenuConsts.MaxCodeLength) + { + throw new BusinessException(PlatformErrorCodes.MenuAchieveMaxDepth) + .WithData("Depth", MenuConsts.MaxDepth); + } + var menu = new Menu( + id, + layoutId, + path, + name, + code, + component, + displayName, + redirect, + description, + platformType, + parentId, + tenantId) + { + IsPublic = isPublic + }; + await ValidateMenuAsync(menu); + await MenuRepository.InsertAsync(menu); + + return menu; + } + + public virtual async Task UpdateAsync(Menu menu) + { + await ValidateMenuAsync(menu); + await MenuRepository.UpdateAsync(menu); + } + + [UnitOfWork] + public virtual async Task DeleteAsync(Guid id) + { + var children = await FindChildrenAsync(id, true); + + foreach (var child in children) + { + await MenuRepository.RemoveAllMembersAsync(child); + await MenuRepository.RemoveAllRolesAsync(child); + await MenuRepository.DeleteAsync(child); + } + + var menu = await MenuRepository.GetAsync(id); + await MenuRepository.RemoveAllMembersAsync(menu); + await MenuRepository.RemoveAllRolesAsync(menu); + + await MenuRepository.DeleteAsync(id); + } + + [UnitOfWork] + public virtual async Task MoveAsync(Guid id, Guid? parentId) + { + var menu = await MenuRepository.GetAsync(id); + if (menu.ParentId == parentId) + { + return; + } + + var children = await FindChildrenAsync(id, true); + + var oldCode = menu.Code; + + menu.Code = await GetNextChildCodeAsync(parentId); + menu.ParentId = parentId; + + await ValidateMenuAsync(menu); + + foreach (var child in children) + { + child.Code = CodeNumberGenerator.AppendCode(menu.Code, CodeNumberGenerator.GetRelativeCode(child.Code, oldCode)); + } + } + + public virtual async Task SetUserMenusAsync(Guid userId, IEnumerable menuIds) + { + await UserMenuRepository.SetMemberMenusAsync(userId, menuIds); + } + + [UnitOfWork] + public virtual async Task SetRoleMenusAsync(string roleName, IEnumerable menuIds) + { + await RoleMenuRepository.SetRoleMenusAsync(roleName, menuIds); + } + + protected virtual async Task ValidateMenuAsync(Menu menu) + { + var siblings = (await FindChildrenAsync(menu.ParentId)) + .Where(x => x.Id != menu.Id) + .ToList(); + + if (siblings.Any(ou => ou.Name == menu.Name)) + { + throw new BusinessException(PlatformErrorCodes.DuplicateMenu) + .WithData("Name", menu.Name); + } + } + + public virtual async Task GetNextChildCodeAsync(Guid? parentId) + { + var lastChild = await GetLastChildOrNullAsync(parentId); + if (lastChild != null) + { + return CodeNumberGenerator.CalculateNextCode(lastChild.Code); + } + + var parentCode = parentId != null + ? await GetCodeOrDefaultAsync(parentId.Value) + : null; + + return CodeNumberGenerator.AppendCode( + parentCode, + CodeNumberGenerator.CreateCode(1) + ); + } + + public virtual async Task GetLastChildOrNullAsync(Guid? parentId) + { + var children = await MenuRepository.GetChildrenAsync(parentId); + return children.OrderBy(c => c.Code).LastOrDefault(); + } + + public async Task> FindChildrenAsync(Guid? parentId, bool recursive = false) + { + if (!recursive) + { + return await MenuRepository.GetChildrenAsync(parentId); + } + + if (!parentId.HasValue) + { + return await MenuRepository.GetListAsync(includeDetails: true); + } + + var code = await GetCodeOrDefaultAsync(parentId.Value); + + return await MenuRepository.GetAllChildrenWithParentCodeAsync(code, parentId); + } + + public virtual async Task GetCodeOrDefaultAsync(Guid id) + { + var menu = await MenuRepository.GetAsync(id); + return menu?.Code; + } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/RoleMenu.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/RoleMenu.cs new file mode 100644 index 000000000..7c6c07df1 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/RoleMenu.cs @@ -0,0 +1,35 @@ +using System; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace LINGYUN.Platform.Menus +{ + /// + /// 角色菜单 + /// + public class RoleMenu : AuditedEntity, IMultiTenant + { + public virtual Guid? TenantId { get; protected set; } + + public virtual Guid MenuId { get; protected set; } + + public virtual string RoleName { get; protected set; } + + protected RoleMenu() { } + + public RoleMenu( + Guid menuId, + string roleName, + Guid? tenantId = null) + { + MenuId = menuId; + RoleName = roleName; + TenantId = tenantId; + } + + public override object[] GetKeys() + { + return new object[] { MenuId, RoleName }; + } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/UserMenu.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/UserMenu.cs new file mode 100644 index 000000000..ff039ccd5 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/UserMenu.cs @@ -0,0 +1,35 @@ +using System; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace LINGYUN.Platform.Menus +{ + /// + /// 用户菜单 + /// + public class UserMenu : AuditedEntity, IMultiTenant + { + public virtual Guid? TenantId { get; protected set; } + + public virtual Guid MenuId { get; protected set; } + + public virtual Guid UserId { get; protected set; } + + protected UserMenu() { } + + public UserMenu( + Guid menuId, + Guid userId, + Guid? tenantId = null) + { + MenuId = menuId; + UserId = userId; + TenantId = tenantId; + } + + public override object[] GetKeys() + { + return new object[] { MenuId, UserId }; + } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDataSeedContributor.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDataSeedContributor.cs new file mode 100644 index 000000000..466feba01 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDataSeedContributor.cs @@ -0,0 +1,760 @@ +using LINGYUN.Platform.Datas; +using LINGYUN.Platform.Layouts; +using LINGYUN.Platform.Menus; +using LINGYUN.Platform.Routes; +using LINGYUN.Platform.Utils; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Guids; + +namespace LINGYUN.Platform +{ + public class PlatformDataSeedContributor : IDataSeedContributor, ITransientDependency + { + protected IGuidGenerator GuidGenerator { get; } + protected IRouteDataSeeder RouteDataSeeder { get; } + protected IDataDictionaryDataSeeder DataDictionaryDataSeeder { get; } + protected IMenuRepository MenuRepository { get; } + protected ILayoutRepository LayoutRepository { get; } + + public PlatformDataSeedContributor( + IRouteDataSeeder routeDataSeeder, + IMenuRepository menuRepository, + ILayoutRepository layoutRepository, + IGuidGenerator guidGenerator, + IDataDictionaryDataSeeder dataDictionaryDataSeeder) + { + GuidGenerator = guidGenerator; + RouteDataSeeder = routeDataSeeder; + MenuRepository = menuRepository; + LayoutRepository = layoutRepository; + DataDictionaryDataSeeder = dataDictionaryDataSeeder; + } + + public virtual async Task SeedAsync(DataSeedContext context) + { + var data = await SeedDefaultDataDictionaryAsync(context.TenantId); + // 预置 + var layout = await SeedDefaultLayoutAsync(data); + // 首页 + await SeedHomeMenuAsync(layout, data); + // 管理菜单预置菜单数据 + await SeedAdminMenuAsync(layout, data); + // saas菜单数据 + await SeedSaasMenuAsync(layout, data); + // 身份资源菜单数据 + await SeedIdentityServerMenuAsync(layout, data); + // 审计日志菜单数据 + await SeedAuditingMenuAsync(layout, data); + // 布局容器预置菜单数据 + await SeedContainerMenuAsync(layout, data); + // 网关管理菜单数据 + await SeedApiGatewayMenuAsync(layout, data); + } + + private async Task SeedDefaultDataDictionaryAsync(Guid? tenantId) + { + var data = await DataDictionaryDataSeeder + .SeedAsync( + "Layout", + CodeNumberGenerator.CreateCode(1), + "Vue Admin Layout Meta Dictionary", + "Vue Admin Layout Meta Dictionary", + null, + tenantId); + + data.AddItem( + GuidGenerator, + "roles", // TODO: 是否需要把这一项写入到预置数据? + "roles", + "", + Datas.ValueType.Array, + "will control the page roles (allow setting multiple roles)"); + data.AddItem( + GuidGenerator, + "title", + "title", + "component", + Datas.ValueType.String, + "the name showed in subMenu and breadcrumb (recommend set)"); + data.AddItem( + GuidGenerator, + "icon", + "icon", + "icon", + Datas.ValueType.String, + "the icon showed in the sidebar"); + data.AddItem( + GuidGenerator, + "hidden", + "hidden", + "false", + Datas.ValueType.Boolean, + "if true, this route will not show in the sidebar (default is false)"); + data.AddItem( + GuidGenerator, + "alwaysShow", + "alwaysShow", + "false", + Datas.ValueType.Boolean, + "if true, will always show the root menu (default is false)"); + data.AddItem( + GuidGenerator, + "breadcrumb", + "breadcrumb", + "true", + Datas.ValueType.Boolean, + "if false, the item will be hidden in breadcrumb (default is true)"); + data.AddItem( + GuidGenerator, + "noCache", + "noCache", + "false", + Datas.ValueType.Boolean, + "if true, the page will not be cached (default is false)"); + data.AddItem( + GuidGenerator, + "affix", + "affix", + "false", + Datas.ValueType.Boolean, + "if true, the tag will affix in the tags-view"); + data.AddItem( + GuidGenerator, + "activeMenu", + "activeMenu", + "", + Datas.ValueType.String, + "if set path, the sidebar will highlight the path you set"); + + return data; + } + + private async Task SeedDefaultLayoutAsync(Data data) + { + var layout = await RouteDataSeeder.SeedLayoutAsync( + "Layout", + "layout/index.vue", + CodeNumberGenerator.CreateCode(1), + "Vue Admin Layout", + data.Id, + PlatformType.WebMvvm, // 针对当前的vue管理页 + "", + "Vue Admin Layout", + data.TenantId + ); + + return layout; + } + + private async Task SeedHomeMenuAsync(Layout layout, Data data) + { + var adminMenu = await SeedMenuAsync( + layout, + data, + "home", + "/", + CodeNumberGenerator.CreateCode(1), + layout.Path, + "Home", + "/dashboard", + "Home", + null, + layout.TenantId, + new Dictionary() + { + { "title", "home" }, + { "icon", "home" }, + { "alwaysShow", true } + }, + // isPublic: true, + isPublic: false); // 首页应该是共有的页面 + + await SeedMenuAsync( + layout, + data, + "dashboard", + "dashboard", + CodeNumberGenerator.AppendCode(adminMenu.Code, CodeNumberGenerator.CreateCode(1)), + "views/dashboard/index.vue", + "Dashboard", + "", + "Dashboard", + adminMenu.Id, + layout.TenantId, + new Dictionary() + { + { "title", "dashboard" }, + { "icon", "dashboard" } + }, + isPublic: false); + } + + private async Task SeedAdminMenuAsync(Layout layout, Data data) + { + var adminMenu = await SeedMenuAsync( + layout, + data, + "admin", + "/admin", + CodeNumberGenerator.CreateCode(2), + layout.Path, + "Admin", + "", + "Admin", + null, + layout.TenantId, + new Dictionary() + { + { "title", "admin" }, + { "icon", "admin" }, + { "alwaysShow", true } + }, + new string[] { "admin" }); + + await SeedMenuAsync( + layout, + data, + "roles", + "roles", + CodeNumberGenerator.AppendCode(adminMenu.Code, CodeNumberGenerator.CreateCode(1)), + "views/admin/roles/index.vue", + "Manage Roles", + "", + "Manage Roles", + adminMenu.Id, + layout.TenantId, + new Dictionary() + { + { "title", "roles" }, + { "icon", "role" }, + { "roles", new string[] { "AbpIdentity.Roles" } } + }, + new string[] { "admin" }); + + await SeedMenuAsync( + layout, + data, + "users", + "users", + CodeNumberGenerator.AppendCode(adminMenu.Code, CodeNumberGenerator.CreateCode(2)), + "views/admin/users/index.vue", + "Manage Users", + "", + "Manage Users", + adminMenu.Id, + layout.TenantId, + new Dictionary() + { + { "title", "users" }, + { "icon", "users" }, + { "roles", new string[] { "AbpIdentity.Users" } } + }, + new string[] { "admin" }); + + await SeedMenuAsync( + layout, + data, + "organization-unit", + "organization-unit", + CodeNumberGenerator.AppendCode(adminMenu.Code, CodeNumberGenerator.CreateCode(3)), + "views/admin/organization-unit/index.vue", + "Manage Organization Units", + "", + "Manage Organization Units", + adminMenu.Id, + layout.TenantId, + new Dictionary() + { + { "title", "organization-unit" }, + { "icon", "organization-unit" }, + { "roles", new string[] { "AbpIdentity.OrganizationUnits" } } + }, + new string[] { "admin" }); + + await SeedMenuAsync( + layout, + data, + "claim-type", + "claim-type", + CodeNumberGenerator.AppendCode(adminMenu.Code, CodeNumberGenerator.CreateCode(4)), + "views/admin/claim-type/index.vue", + "Manage Organization Units", + "", + "Manage Organization Units", + adminMenu.Id, + layout.TenantId, + new Dictionary() + { + { "title", "claim-type" }, + { "icon", "claim-type" }, + { "roles", new string[] { "AbpIdentity.IdentityClaimTypes" } } + }, + new string[] { "admin" }); + + await SeedMenuAsync( + layout, + data, + "data-dictionary", + "data-dictionary", + CodeNumberGenerator.AppendCode(adminMenu.Code, CodeNumberGenerator.CreateCode(5)), + "views/admin/data-dictionary/index.vue", + "Manage Data Dictionarys", + "", + "Manage Data Dictionarys", + adminMenu.Id, + layout.TenantId, + new Dictionary() + { + { "title", "data-dictionary" }, + { "icon", "data-dictionary" }, + { "roles", new string[] { "Platform.DataDictionary" } } + }, + new string[] { "admin" }); + + await SeedMenuAsync( + layout, + data, + "settings", + "settings", + CodeNumberGenerator.AppendCode(adminMenu.Code, CodeNumberGenerator.CreateCode(6)), + "views/admin/settings/index.vue", + "Manage Settings", + "", + "Manage Settings", + adminMenu.Id, + layout.TenantId, + new Dictionary() + { + { "title", "settings" }, + { "icon", "settings" }, + { "roles", new string[] { "AbpSettingManagement.Settings" } } + }, + new string[] { "admin" }); + } + + private async Task SeedSaasMenuAsync(Layout layout, Data data) + { + var saasMenu = await SeedMenuAsync( + layout, + data, + "saas", + "/saas", + CodeNumberGenerator.CreateCode(3), + layout.Path, + "Saas", + "", + "Saas", + null, + layout.TenantId, + new Dictionary() + { + { "title", "saas" }, + { "icon", "saas" }, + { "alwaysShow", true } + }, + new string[] { "admin" }); + + await SeedMenuAsync( + layout, + data, + "editions", + "editions", + CodeNumberGenerator.AppendCode(saasMenu.Code, CodeNumberGenerator.CreateCode(1)), + "views/admin/edition/index.vue", + "Manage Editions", + "", + "Manage Editions", + saasMenu.Id, + layout.TenantId, + new Dictionary() + { + { "title", "editions" }, + { "icon", "editions" } + }, + new string[] { "admin" }); + + await SeedMenuAsync( + layout, + data, + "tenants", + "tenants", + CodeNumberGenerator.AppendCode(saasMenu.Code, CodeNumberGenerator.CreateCode(2)), + "views/admin/tenants/index.vue", + "Manage Tenants", + "", + "Manage Tenants", + saasMenu.Id, + layout.TenantId, + new Dictionary() + { + { "title", "tenants" }, + { "icon", "tenants" } + }, + new string[] { "admin" }); + } + + private async Task SeedIdentityServerMenuAsync(Layout layout, Data data) + { + var identityServerMenu = await SeedMenuAsync( + layout, + data, + "identity-server", + "/identity-server", + CodeNumberGenerator.CreateCode(4), + layout.Path, + "Identity Server", + "", + "Identity Server", + null, + layout.TenantId, + new Dictionary() + { + { "title", "identity-server" }, + { "icon", "identity-server" }, + { "alwaysShow", true }, + { "roles", new string[]{ "AbpIdentityServer.Clients", "AbpIdentityServer.ApiResources", "AbpIdentityServer.IdentityResources" } } + }, + new string[] { "admin" }); + + await SeedMenuAsync( + layout, + data, + "clients", + "clients", + CodeNumberGenerator.AppendCode(identityServerMenu.Code, CodeNumberGenerator.CreateCode(1)), + "views/admin/identityServer/client/index.vue", + "Manage Clients", + "", + "Manage Clients", + identityServerMenu.Id, + layout.TenantId, + new Dictionary() + { + { "title", "clients" }, + { "icon", "clients" }, + { "roles", new string[]{ "AbpIdentityServer.Clients" } } + }, + new string[] { "admin" }); + await SeedMenuAsync( + layout, + data, + "api-resources", + "api-resources", + CodeNumberGenerator.AppendCode(identityServerMenu.Code, CodeNumberGenerator.CreateCode(2)), + "views/admin/identityServer/api-resources/index.vue", + "Manage Api Resources", + "", + "Manage Api Resources", + identityServerMenu.Id, + layout.TenantId, + new Dictionary() + { + { "title", "api-resources" }, + { "icon", "api" }, + { "roles", new string[]{ "AbpIdentityServer.ApiResources" } } + }, + new string[] { "admin" }); + await SeedMenuAsync( + layout, + data, + "identity-resources", + "identity-resources", + CodeNumberGenerator.AppendCode(identityServerMenu.Code, CodeNumberGenerator.CreateCode(2)), + "views/admin/identityServer/identity-resources/index.vue", + "Manage Identity Resources", + "", + "Manage Identity Resources", + identityServerMenu.Id, + layout.TenantId, + new Dictionary() + { + { "title", "identity-resources" }, + { "icon", "identity" }, + { "roles", new string[]{ "AbpIdentityServer.IdentityResources" } } + }, + new string[] { "admin" }); + } + + private async Task SeedAuditingMenuAsync(Layout layout, Data data) + { + var auditingMenu = await SeedMenuAsync( + layout, + data, + "auditing", + "/auditing", + CodeNumberGenerator.CreateCode(5), + layout.Path, + "Auditing", + "", + "Auditing", + null, + layout.TenantId, + new Dictionary() + { + { "title", "auditing" }, + { "icon", "auditing" }, + { "alwaysShow", true }, + { "roles", new string[]{ "AbpAuditing.AuditLog", "AbpAuditing.SecurityLog" } } + }, + new string[] { "admin" }); + + await SeedMenuAsync( + layout, + data, + "audit-log", + "audit-log", + CodeNumberGenerator.AppendCode(auditingMenu.Code, CodeNumberGenerator.CreateCode(1)), + "views/admin/auditing/audit-log/index.vue", + "Manage AuditLog", + "", + "Manage AuditLog", + auditingMenu.Id, + layout.TenantId, + new Dictionary() + { + { "title", "audit-log" }, + { "icon", "audit-log" }, + { "roles", new string[]{ "AbpAuditing.AuditLog" } } + }, + new string[] { "admin" }); + await SeedMenuAsync( + layout, + data, + "security-log", + "security-log", + CodeNumberGenerator.AppendCode(auditingMenu.Code, CodeNumberGenerator.CreateCode(2)), + "views/admin/auditing/security-log/index.vue", + "Manage SecurityLog", + "", + "Manage SecurityLog", + auditingMenu.Id, + layout.TenantId, + new Dictionary() + { + { "title", "security-log" }, + { "icon", "security-log" }, + { "roles", new string[]{ "AbpAuditing.SecurityLog" } } + }, + new string[] { "admin" }); + } + + private async Task SeedContainerMenuAsync(Layout layout, Data data) + { + var containerRoot = await SeedMenuAsync( + layout, + data, + "container", + "/container", + CodeNumberGenerator.CreateCode(6), + layout.Path, + "Container", + "", + "Manage Container", + null, + layout.TenantId, + new Dictionary() + { + { "title", "container" }, + { "icon", "container" }, + { "alwaysShow", true } + }, + new string[] { "admin" }); + + await SeedMenuAsync( + layout, + data, + "layout", + "layout", + CodeNumberGenerator.AppendCode(containerRoot.Code, CodeNumberGenerator.CreateCode(1)), + "views/admin/layouts/index.vue", + "Manage Layouts", + "", + "Manage Layouts", + containerRoot.Id, + containerRoot.TenantId, + new Dictionary() + { + { "title", "layout" }, + { "icon", "layout" } + }, + new string[] { "admin" }); + + await SeedMenuAsync( + layout, + data, + "menus", + "menus", + CodeNumberGenerator.AppendCode(containerRoot.Code, CodeNumberGenerator.CreateCode(2)), + "views/admin/menus/index.vue", + "Manage Menus", + "", + "Manage Menus", + containerRoot.Id, + containerRoot.TenantId, + new Dictionary() + { + { "title", "menus" }, + { "icon", "menu" } + }, + new string[] { "admin" }); + } + + private async Task SeedApiGatewayMenuAsync(Layout layout, Data data) + { + var apiGatewayMenu = await SeedMenuAsync( + layout, + data, + "apigateway", + "/apigateway", + CodeNumberGenerator.CreateCode(7), + layout.Path, + "Manage Api Gateway", + "/group", + "Manage Api Gateway", + null, + layout.TenantId, + new Dictionary() + { + { "title", "api-gateway" }, + { "icon", "api-gateway" }, + { "alwaysShow", true }, + { "roles", new string[] { "ApiGateway.RouteGroup", "ApiGateway.Global", "ApiGateway.Route", "ApiGateway.DynamicRoute", "ApiGateway.AggregateRoute" } }, + }, + new string[] { "admin" }); + + await SeedMenuAsync( + layout, + data, + "group", + "group", + CodeNumberGenerator.AppendCode(apiGatewayMenu.Code, CodeNumberGenerator.CreateCode(1)), + "views/admin/apigateway/group.vue", + "Manage Groups", + "", + "Manage Groups", + apiGatewayMenu.Id, + apiGatewayMenu.TenantId, + new Dictionary() + { + { "title", "group" }, + { "icon", "group" }, + { "roles", new string[] { "ApiGateway.RouteGroup" } } + }, + new string[] { "admin" }); + await SeedMenuAsync( + layout, + data, + "global", + "global", + CodeNumberGenerator.AppendCode(apiGatewayMenu.Code, CodeNumberGenerator.CreateCode(1)), + "views/admin/apigateway/global.vue", + "Manage Globals", + "", + "Manage Globals", + apiGatewayMenu.Id, + apiGatewayMenu.TenantId, + new Dictionary() + { + { "title", "global" }, + { "icon", "global-setting" }, + { "roles", new string[] { "ApiGateway.Global" } } + }, + new string[] { "admin" }); + await SeedMenuAsync( + layout, + data, + "route", + "route", + CodeNumberGenerator.AppendCode(apiGatewayMenu.Code, CodeNumberGenerator.CreateCode(1)), + "views/admin/apigateway/route.vue", + "Manage Routes", + "", + "Manage Routes", + apiGatewayMenu.Id, + apiGatewayMenu.TenantId, + new Dictionary() + { + { "title", "route" }, + { "icon", "route" }, + { "roles", new string[] { "ApiGateway.Route" } } + }, + new string[] { "admin" }); + await SeedMenuAsync( + layout, + data, + "aggregate-route", + "aggregate-route", + CodeNumberGenerator.AppendCode(apiGatewayMenu.Code, CodeNumberGenerator.CreateCode(1)), + "views/admin/apigateway/aggregateRoute.vue", + "Manage Aggregate Routes", + "", + "Manage Aggregate Routes", + apiGatewayMenu.Id, + apiGatewayMenu.TenantId, + new Dictionary() + { + { "title", "aggregate-route" }, + { "icon", "aggregate" }, + { "roles", new string[] { "ApiGateway.AggregateRoute " } } + }, + new string[] { "admin" }); + } + + private async Task SeedMenuAsync( + Layout layout, + Data data, + string name, + string path, + string code, + string component, + string displayName, + string redirect = "", + string description = "", + Guid? parentId = null, + Guid? tenantId = null, + Dictionary meta = null, + string[] roles = null, + bool isPublic = false + ) + { + var menu = await RouteDataSeeder.SeedMenuAsync( + layout, + name, + path, + code, + component, + displayName, + redirect, + description, + parentId, + tenantId, + isPublic + ); + foreach (var item in data.Items) + { + menu.SetProperty(item.Name, item.DefaultValue); + } + if (meta != null) + { + foreach (var item in meta) + { + menu.SetProperty(item.Key, item.Value); + } + } + + if (roles != null) + { + foreach (var role in roles) + { + await RouteDataSeeder.SeedRoleMenuAsync(role, menu, tenantId); + } + } + + return menu; + } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/AppPlatformDbProperties.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDbProperties.cs similarity index 83% rename from aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/AppPlatformDbProperties.cs rename to aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDbProperties.cs index 9a23bb6e0..b6cc902a0 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/AppPlatformDbProperties.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDbProperties.cs @@ -1,6 +1,6 @@ namespace LINGYUN.Platform { - public static class AppPlatformDbProperties + public static class PlatformDbProperties { public static string DbTablePrefix { get; set; } = "AppPlatform"; diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/AppPlatformDomainMappingProfile.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainMappingProfile.cs similarity index 61% rename from aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/AppPlatformDomainMappingProfile.cs rename to aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainMappingProfile.cs index bcfd08378..39d783243 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/AppPlatformDomainMappingProfile.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainMappingProfile.cs @@ -4,13 +4,11 @@ using LINGYUN.Platform.Versions; namespace LINGYUN.Platform { - public class AppPlatformDomainMappingProfile : Profile + public class PlatformDomainMappingProfile : Profile { - public AppPlatformDomainMappingProfile() + public PlatformDomainMappingProfile() { CreateMap(); - CreateMap(); - CreateMap(); CreateMap() .ForMember(eto => eto.FileCount, map => map.MapFrom(src => src.Files.Count)); diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/AppPlatformDomainModule.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainModule.cs similarity index 76% rename from aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/AppPlatformDomainModule.cs rename to aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainModule.cs index b4a3786b1..c65f34fb9 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/AppPlatformDomainModule.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainModule.cs @@ -1,4 +1,5 @@ -using LINGYUN.Platform.ObjectExtending; +using LINGYUN.Platform.Datas; +using LINGYUN.Platform.ObjectExtending; using LINGYUN.Platform.Routes; using LINGYUN.Platform.Versions; using Microsoft.Extensions.DependencyInjection; @@ -12,18 +13,23 @@ using Volo.Abp.ObjectExtending.Modularity; namespace LINGYUN.Platform { [DependsOn( - typeof(AppPlatformDomainSharedModule), + typeof(PlatformDomainSharedModule), typeof(AbpBlobStoringModule), typeof(AbpEventBusModule))] - public class AppPlatformDomainModule : AbpModule + public class PlatformDomainModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - context.Services.AddAutoMapperObjectMapper(); + context.Services.AddAutoMapperObjectMapper(); + + Configure(options => + { + options.SetDefaultMapping(); + }); Configure(options => { - options.AddProfile(validate: true); + options.AddProfile(validate: true); }); Configure(options => @@ -36,11 +42,9 @@ namespace LINGYUN.Platform Configure(options => { - options.EtoMappings.Add(typeof(AppPlatformDomainModule)); - options.EtoMappings.Add(typeof(AppPlatformDomainModule)); - options.EtoMappings.Add(typeof(AppPlatformDomainModule)); + options.EtoMappings.Add(typeof(PlatformDomainModule)); - options.EtoMappings.Add(typeof(AppPlatformDomainModule)); + options.EtoMappings.Add(typeof(PlatformDomainModule)); options.AutoEventSelectors.Add(); }); diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/IRouteDataSeeder.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/IRouteDataSeeder.cs new file mode 100644 index 000000000..59357c51c --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/IRouteDataSeeder.cs @@ -0,0 +1,51 @@ +using LINGYUN.Platform.Layouts; +using LINGYUN.Platform.Menus; +using System; +using System.Threading; +using System.Threading.Tasks; + +namespace LINGYUN.Platform.Routes +{ + public interface IRouteDataSeeder + { + Task SeedLayoutAsync( + string name, + string path, + string code, + string displayName, + Guid dataId, + PlatformType platformType = PlatformType.None, + string redirect = "", + string description = "", + Guid? tenantId = null, + CancellationToken cancellationToken = default); + + Task SeedMenuAsync( + Layout layout, + string name, + string path, + string code, + string component, + string displayName, + string redirect = "", + string description = "", + Guid? parentId = null, + Guid? tenantId = null, + bool isPublic = false, + CancellationToken cancellationToken = default); + + Task SeedUserMenuAsync( + Guid userId, + Menu menu, + Guid? tenantId = null, + CancellationToken cancellationToken = default + ); + + Task SeedRoleMenuAsync( + string roleName, + Menu menu, + Guid? tenantId = null, + CancellationToken cancellationToken = default + ); + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/IRouteRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/IRouteRepository.cs deleted file mode 100644 index 38191bad2..000000000 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/IRouteRepository.cs +++ /dev/null @@ -1,78 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using Volo.Abp.Domain.Repositories; - -namespace LINGYUN.Platform.Routes -{ - public interface IRouteRepository : IBasicRepository - { - Task> GetChildrenAsync( - Guid? parentId, - CancellationToken cancellationToken = default - ); - - Task> GetAllChildrenWithParentCodeAsync( - string code, - Guid? parentId, - CancellationToken cancellationToken = default - ); - - Task GetAsync( - string displayName, - CancellationToken cancellationToken = default - ); - - Task> GetPagedListAsync( - string sorting = null, - int maxResultCount = int.MaxValue, - int skipCount = 0, - CancellationToken cancellationToken = default - ); - - Task> GetRolesRouteAsync( - string roleName, - CancellationToken cancellationToken = default - ); - - Task> GetUsersRouteAsync( - Guid userId, - CancellationToken cancellationToken = default - ); - - Task RemoveAllUsersRouteAsync( - Route route, - CancellationToken cancellationToken = default - ); - - Task RemoveUserRouteAsync( - Guid userId, - Route route, - CancellationToken cancellationToken = default - ); - - Task RemoveAllRolesRouteAsync( - Route route, - CancellationToken cancellationToken = default - ); - - Task RemoveRoleRouteAsync( - string roleName, - Route route, - CancellationToken cancellationToken = default - ); - - Task IsInRouteAsync( - string roleName, - Route route, - CancellationToken cancellationToken = default - ); - - Task IsInRouteAsync( - Guid userId, - Route route, - CancellationToken cancellationToken = default - ); - } -} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/RoleRoute.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/RoleRoute.cs deleted file mode 100644 index 6ecf9644a..000000000 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/RoleRoute.cs +++ /dev/null @@ -1,31 +0,0 @@ -using JetBrains.Annotations; -using System; -using Volo.Abp; -using Volo.Abp.Domain.Entities.Auditing; -using Volo.Abp.MultiTenancy; - -namespace LINGYUN.Platform.Routes -{ - public class RoleRoute : FullAuditedEntity, IMultiTenant - { - public virtual Guid? TenantId { get; protected set; } - public virtual string RoleName { get; protected set; } - public virtual Guid RouteId { get; protected set; } - protected RoleRoute() - { - - } - - public RoleRoute(int id) - { - Id = id; - } - - public RoleRoute(Guid routeId, [NotNull] string roleName, Guid? tenantId = null) - { - RouteId = routeId; - TenantId = tenantId; - RoleName = Check.NotNullOrWhiteSpace(roleName, nameof(roleName)); - } - } -} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/Route.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/Route.cs index 2e39b6ab8..e4b6249e3 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/Route.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/Route.cs @@ -1,193 +1,79 @@ using JetBrains.Annotations; using System; -using System.Collections.Generic; -using System.Linq; using Volo.Abp; using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.MultiTenancy; namespace LINGYUN.Platform.Routes { - // TODO: 因为abp的菜单设计模式是按照权限分配的,是否可以去掉路由的后台配置? - // 按钮、菜单权限可以在子权限中定义 - // 数据权限需要DbContext拦截器或者创建一个数据过滤仓储的抽象类,需要过滤数据权限的继承自此仓储 - public class Route : FullAuditedAggregateRoot, IMultiTenant + /// + /// 不管是布局还是视图或者页面,都作为路由的实现,因此抽象一个路由实体
+ /// 注意:这是基于 Vue Router 的路由规则设计的实体,详情:https://router.vuejs.org/zh/api/#routes + ///
+ public abstract class Route : FullAuditedAggregateRoot, IMultiTenant { - /// - /// 租户标识 - /// public virtual Guid? TenantId { get; protected set; } /// - /// 编号 + /// 路径 /// - public virtual string Code { get; set; } + public virtual string Path { get; set; } /// /// 名称 /// - public virtual string Name { get; protected set; } - /// - /// 全名 - /// - public virtual string FullName { get; set; } + public virtual string Name { get; set; } /// /// 显示名称 /// - public virtual string DisplayName { get; protected set; } - /// - /// 平台标识 - /// - public virtual PlatformType PlatformType { get; set; } + public virtual string DisplayName { get; set; } /// /// 说明 /// public virtual string Description { get; set; } /// - /// 图标 - /// - public virtual string Icon { get; protected set; } - /// - /// 路由地址 - /// - public virtual string LinkUrl { get; protected set; } - /// - /// 是否菜单 - /// - public virtual bool IsMenu { get; set; } - /// - /// 是否工具栏 - /// - public virtual bool IsToolBar { get; set; } - /// - /// 是否侧边栏 - /// - public virtual bool IsSideBar { get; set; } - /// - /// 是否公共路由 - /// - public virtual bool IsPublic { get; set; } - /// - /// 是否内置 + /// 重定向路径 /// - public virtual bool IsStatic { get; set; } - /// - /// 总是显示根菜单 - /// - public virtual bool AlwaysShow { get; set; } - /// - /// 父级标识 - /// - public virtual Guid? ParentId { get; set; } - protected Route() - { - - } - - public Route(Guid id, string name, string displayName, string url) - { - Id = id; - LinkToUrl(url); - ChangeName(name, displayName); - } + public virtual string Redirect { get; set; } - public void LinkToUrl([NotNull] string linkUrl) - { - LinkUrl = Check.NotNullOrWhiteSpace(linkUrl, nameof(linkUrl)); - } + protected Route() { } - public void ChangeIcon(string icon) + protected Route( + [NotNull] Guid id, + [NotNull] string path, + [NotNull] string name, + [NotNull] string displayName, + [CanBeNull] string redirect = "", + [CanBeNull] string description = "", + [CanBeNull] Guid? tenantId = null) + : base(id) { - Icon = icon; - } + Check.NotNullOrWhiteSpace(path, nameof(path)); + Check.NotNullOrWhiteSpace(name, nameof(name)); + Check.NotNullOrWhiteSpace(displayName, nameof(displayName)); - public void ChangeName([NotNull] string name, [CanBeNull] string displayName) - { - Name = Check.NotNullOrWhiteSpace(name, nameof(name)); + Path = path; + Name = name; DisplayName = displayName; + Redirect = redirect; + Description = description; + TenantId = tenantId; } - public static string CreateCode(params int[] numbers) + public override int GetHashCode() { - if (numbers.IsNullOrEmpty()) - { - return null; - } - - return numbers.Select(number => number.ToString(new string('0', RouteConsts.CodeUnitLength))).JoinAsString("."); + return Name.GetHashCode(); } - public static string AppendCode(string parentCode, string childCode) + public override bool Equals(object obj) { - if (childCode.IsNullOrEmpty()) + if (obj == null) { - throw new ArgumentNullException(nameof(childCode), "childCode can not be null or empty."); + return false; } - - if (parentCode.IsNullOrEmpty()) + if (obj is Route route) { - return childCode; + return route.Name.Equals(Name, StringComparison.InvariantCultureIgnoreCase); } - - return parentCode + "." + childCode; - } - - public static string GetRelativeCode(string code, string parentCode) - { - if (code.IsNullOrEmpty()) - { - throw new ArgumentNullException(nameof(code), "code can not be null or empty."); - } - - if (parentCode.IsNullOrEmpty()) - { - return code; - } - - if (code.Length == parentCode.Length) - { - return null; - } - - return code.Substring(parentCode.Length + 1); - } - - public static string CalculateNextCode(string code) - { - if (code.IsNullOrEmpty()) - { - throw new ArgumentNullException(nameof(code), "code can not be null or empty."); - } - - var parentCode = GetParentCode(code); - var lastUnitCode = GetLastUnitCode(code); - - return AppendCode(parentCode, CreateCode(Convert.ToInt32(lastUnitCode) + 1)); - } - - public static string GetLastUnitCode(string code) - { - if (code.IsNullOrEmpty()) - { - throw new ArgumentNullException(nameof(code), "code can not be null or empty."); - } - - var splittedCode = code.Split('.'); - return splittedCode[splittedCode.Length - 1]; - } - - public static string GetParentCode(string code) - { - if (code.IsNullOrEmpty()) - { - throw new ArgumentNullException(nameof(code), "code can not be null or empty."); - } - - var splittedCode = code.Split('.'); - if (splittedCode.Length == 1) - { - return null; - } - - return splittedCode.Take(splittedCode.Length - 1).JoinAsString("."); + return base.Equals(obj); } } } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/RouteDataSeeder.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/RouteDataSeeder.cs new file mode 100644 index 000000000..a5daf80ec --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/RouteDataSeeder.cs @@ -0,0 +1,152 @@ +using LINGYUN.Platform.Layouts; +using LINGYUN.Platform.Menus; +using System; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Guids; + +namespace LINGYUN.Platform.Routes +{ + public class RouteDataSeeder : IRouteDataSeeder, ITransientDependency + { + protected IGuidGenerator GuidGenerator { get; } + protected ILayoutRepository LayoutRepository { get; } + protected IMenuRepository MenuRepository { get; } + protected IUserMenuRepository UserMenuRepository { get; } + protected IRoleMenuRepository RoleMenuRepository { get; } + + public RouteDataSeeder( + IGuidGenerator guidGenerator, + IMenuRepository menuRepository, + ILayoutRepository layoutRepository, + IUserMenuRepository userMenuRepository, + IRoleMenuRepository roleMenuRepository) + { + GuidGenerator = guidGenerator; + MenuRepository = menuRepository; + LayoutRepository = layoutRepository; + UserMenuRepository = userMenuRepository; + RoleMenuRepository = roleMenuRepository; + } + + public virtual async Task SeedLayoutAsync( + string name, + string path, + string code, + string displayName, + Guid dataId, + PlatformType platformType = PlatformType.None, + string redirect = "", + string description = "", + Guid? tenantId = null, + CancellationToken cancellationToken = default) + { + var layout = await LayoutRepository.FindByNameAsync(name, cancellationToken: cancellationToken); + if (layout == null) + { + layout = new Layout( + GuidGenerator.Create(), + path, + name, + code, + displayName, + dataId, + platformType, + redirect, + description, + tenantId); + layout = await LayoutRepository.InsertAsync(layout, cancellationToken: cancellationToken); + } + return layout; + } + + public virtual async Task SeedMenuAsync( + Layout layout, + string name, + string path, + string code, + string component, + string displayName, + string redirect = "", + string description = "", + Guid? parentId = null, + Guid? tenantId = null, + bool isPublic = false, + CancellationToken cancellationToken = default) + { + if (parentId.HasValue) + { + var children = await MenuRepository.GetChildrenAsync(parentId); + var childMenu = children.FirstOrDefault(x => x.Name == name); + if (childMenu != null) + { + return childMenu; + } + } + var menu = await MenuRepository.FindByNameAsync(name, cancellationToken: cancellationToken); + if (menu == null) + { + menu = new Menu( + GuidGenerator.Create(), + layout.Id, + path, + name, + code, + component, + displayName, + redirect, + description, + layout.PlatformType, + parentId, + tenantId) + { + IsPublic = isPublic + }; + + menu = await MenuRepository.InsertAsync(menu, cancellationToken: cancellationToken); + } + + return menu; + } + + public virtual async Task SeedRoleMenuAsync( + string roleName, + Menu menu, + Guid? tenantId = null, + CancellationToken cancellationToken = default) + { + if (! await RoleMenuRepository.RoleHasInMenuAsync(roleName, menu.Name, cancellationToken)) + { + var roleMenu = new RoleMenu(menu.Id, roleName, tenantId); + await RoleMenuRepository.InsertAsync(roleMenu); + + var childrens = await MenuRepository.GetChildrenAsync(menu.Id); + foreach (var children in childrens) + { + await SeedRoleMenuAsync(roleName, children, tenantId, cancellationToken); + } + } + } + + public virtual async Task SeedUserMenuAsync( + Guid userId, + Menu menu, + Guid? tenantId = null, + CancellationToken cancellationToken = default) + { + if (!await UserMenuRepository.UserHasInMenuAsync(userId, menu.Name, cancellationToken)) + { + var userMenu = new UserMenu(menu.Id, userId, tenantId); + await UserMenuRepository.InsertAsync(userMenu); + + var childrens = await MenuRepository.GetChildrenAsync(menu.Id); + foreach (var children in childrens) + { + await SeedUserMenuAsync(userId, children, tenantId, cancellationToken); + } + } + } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/RouteManager.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/RouteManager.cs deleted file mode 100644 index 949beb7bd..000000000 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/RouteManager.cs +++ /dev/null @@ -1,139 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Volo.Abp.Domain.Services; -using Volo.Abp.Uow; - -namespace LINGYUN.Platform.Routes -{ - public class RouteManager : DomainService - { - protected IRouteRepository RouteRepository { get; } - public RouteManager( - IRouteRepository routeRepository) - { - RouteRepository = routeRepository; - } - - [UnitOfWork] - public virtual async Task CreateAsync(Route route) - { - route.Code = await GetNextChildCodeAsync(route.ParentId); - await RouteRepository.InsertAsync(route); - } - - public virtual async Task UpdateAsync(Route route) - { - await RouteRepository.UpdateAsync(route); - } - - [UnitOfWork] - public virtual async Task DeleteAsync(Guid id) - { - var children = await FindChildrenAsync(id, true); - - foreach (var child in children) - { - await RouteRepository.RemoveAllUsersRouteAsync(child); - await RouteRepository.RemoveAllRolesRouteAsync(child); - await RouteRepository.DeleteAsync(child); - } - - var organizationUnit = await RouteRepository.GetAsync(id); - - await RouteRepository.RemoveAllUsersRouteAsync(organizationUnit); - await RouteRepository.RemoveAllRolesRouteAsync(organizationUnit); - await RouteRepository.DeleteAsync(id); - } - - [UnitOfWork] - public virtual async Task MoveAsync(Guid id, Guid? parentId) - { - var route = await RouteRepository.GetAsync(id); - if (route.ParentId == parentId) - { - return; - } - - var children = await FindChildrenAsync(id, true); - - var oldCode = route.Code; - - route.Code = await GetNextChildCodeAsync(parentId); - route.ParentId = parentId; - - foreach (var child in children) - { - child.Code = Route.AppendCode(route.Code, Route.GetRelativeCode(child.Code, oldCode)); - } - } - - public virtual async Task RemoveRoleFromRouteAsync(string roleName, Route route) - { - await RouteRepository.RemoveRoleRouteAsync(roleName, route); - } - - public virtual async Task RemoveUserFromRouteAsync(Guid userId, Route route) - { - await RouteRepository.RemoveUserRouteAsync(userId, route); - } - - public virtual async Task GetNextChildCodeAsync(Guid? parentId) - { - var lastChild = await GetLastChildOrNullAsync(parentId); - if (lastChild != null) - { - return Route.CalculateNextCode(lastChild.Code); - } - - var parentCode = parentId != null - ? await GetCodeOrDefaultAsync(parentId.Value) - : null; - - return Route.AppendCode( - parentCode, - Route.CreateCode(1) - ); - } - - public virtual async Task GetLastChildOrNullAsync(Guid? parentId) - { - var children = await RouteRepository.GetChildrenAsync(parentId); - return children.OrderBy(c => c.Code).LastOrDefault(); - } - - public virtual async Task GetCodeOrDefaultAsync(Guid id) - { - var ou = await RouteRepository.GetAsync(id); - return ou?.Code; - } - - public async Task> FindChildrenAsync(Guid? parentId, bool recursive = false) - { - if (!recursive) - { - return await RouteRepository.GetChildrenAsync(parentId); - } - - if (!parentId.HasValue) - { - return await RouteRepository.GetListAsync(); - } - - var code = await GetCodeOrDefaultAsync(parentId.Value); - - return await RouteRepository.GetAllChildrenWithParentCodeAsync(code, parentId); - } - - public virtual async Task IsInRouteAsync(Guid userId, Route route) - { - return await RouteRepository.IsInRouteAsync(userId, route); - } - - public virtual async Task IsInRouteAsync(string roleName, Route route) - { - return await RouteRepository.IsInRouteAsync(roleName, route); - } - } -} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/UserRoute.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/UserRoute.cs deleted file mode 100644 index 575846473..000000000 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/UserRoute.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using Volo.Abp.Domain.Entities.Auditing; -using Volo.Abp.MultiTenancy; - -namespace LINGYUN.Platform.Routes -{ - public class UserRoute : FullAuditedEntity, IMultiTenant - { - public virtual Guid? TenantId { get; protected set; } - public virtual Guid UserId { get; protected set; } - public virtual Guid RouteId { get; protected set; } - protected UserRoute() - { - - } - - public UserRoute(int id) - { - Id = id; - } - - public UserRoute(Guid routeId, Guid userId, Guid? tenantId = null) - { - UserId = userId; - RouteId = routeId; - TenantId = tenantId; - } - } -} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Utils/CodeNumberGenerator.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Utils/CodeNumberGenerator.cs new file mode 100644 index 000000000..2cb615914 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Utils/CodeNumberGenerator.cs @@ -0,0 +1,94 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace LINGYUN.Platform.Utils +{ + public static class CodeNumberGenerator + { + public static string CreateCode(params int[] numbers) + { + if (numbers.IsNullOrEmpty()) + { + return null; + } + + return numbers.Select(number => number.ToString(new string(PlatformConsts.CodePrefix, PlatformConsts.CodeUnitLength))).JoinAsString("."); + } + + public static string AppendCode(string parentCode, string childCode) + { + if (childCode.IsNullOrEmpty()) + { + throw new ArgumentNullException(nameof(childCode), "childCode can not be null or empty."); + } + + if (parentCode.IsNullOrEmpty()) + { + return childCode; + } + + return parentCode + "." + childCode; + } + + public static string GetRelativeCode(string code, string parentCode) + { + if (code.IsNullOrEmpty()) + { + throw new ArgumentNullException(nameof(code), "code can not be null or empty."); + } + + if (parentCode.IsNullOrEmpty()) + { + return code; + } + + if (code.Length == parentCode.Length) + { + return null; + } + + return code.Substring(parentCode.Length + 1); + } + + public static string CalculateNextCode(string code) + { + if (code.IsNullOrEmpty()) + { + throw new ArgumentNullException(nameof(code), "code can not be null or empty."); + } + + var parentCode = GetParentCode(code); + var lastUnitCode = GetLastCode(code); + + return AppendCode(parentCode, CreateCode(Convert.ToInt32(lastUnitCode) + 1)); + } + + public static string GetLastCode(string code) + { + if (code.IsNullOrEmpty()) + { + throw new ArgumentNullException(nameof(code), "code can not be null or empty."); + } + + var splittedCode = code.Split('.'); + return splittedCode[splittedCode.Length - 1]; + } + + public static string GetParentCode(string code) + { + if (code.IsNullOrEmpty()) + { + throw new ArgumentNullException(nameof(code), "code can not be null or empty."); + } + + var splittedCode = code.Split('.'); + if (splittedCode.Length == 1) + { + return null; + } + + return splittedCode.Take(splittedCode.Length - 1).JoinAsString("."); + } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Datas/EfCoreDataRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Datas/EfCoreDataRepository.cs new file mode 100644 index 000000000..92ac26253 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Datas/EfCoreDataRepository.cs @@ -0,0 +1,79 @@ +using LINGYUN.Platform.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Dynamic.Core; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.Platform.Datas +{ + public class EfCoreDataRepository : EfCoreRepository, IDataRepository + { + public EfCoreDataRepository( + IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } + + public virtual async Task FindByNameAsync( + string name, + bool includeDetails = true, + CancellationToken cancellationToken = default) + { + return await DbSet + .IncludeDetails(includeDetails) + .Where(x => x.Name == name) + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task> GetChildrenAsync( + Guid? parentId, + bool includeDetails = false, + CancellationToken cancellationToken = default) + { + return await DbSet + .IncludeDetails(includeDetails) + .Where(x => x.ParentId == parentId) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task GetCountAsync( + string filter = "", + CancellationToken cancellationToken = default) + { + return await DbSet + .WhereIf(!filter.IsNullOrWhiteSpace(), x => + x.Code.Contains(filter) || x.Description.Contains(filter) || + x.DisplayName.Contains(filter) || x.Name.Contains(filter)) + .CountAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task> GetPagedListAsync( + string filter = "", + string sotring = "Code", + bool includeDetails = false, + int skipCount = 0, + int maxResultCount = 10, + CancellationToken cancellationToken = default) + { + sotring ??= nameof(Data.Code); + + return await DbSet + .IncludeDetails(includeDetails) + .WhereIf(!filter.IsNullOrWhiteSpace(), x => + x.Code.Contains(filter) || x.Description.Contains(filter) || + x.DisplayName.Contains(filter) || x.Name.Contains(filter)) + .OrderBy(sotring) + .PageBy(skipCount, maxResultCount) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + + public override IQueryable WithDetails() + { + return GetQueryable().IncludeDetails(); + } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/AppPlatformDbContextModelBuilderExtensions.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/AppPlatformDbContextModelBuilderExtensions.cs deleted file mode 100644 index ee80123ca..000000000 --- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/AppPlatformDbContextModelBuilderExtensions.cs +++ /dev/null @@ -1,143 +0,0 @@ -using LINGYUN.Platform.Routes; -using LINGYUN.Platform.Versions; -using Microsoft.EntityFrameworkCore; -using System; -using Volo.Abp; -using Volo.Abp.EntityFrameworkCore.Modeling; - -namespace LINGYUN.Platform.EntityFrameworkCore -{ - public static class AppPlatformDbContextModelBuilderExtensions - { - public static void ConfigurePlatform( - this ModelBuilder builder, - Action optionsAction = null) - { - Check.NotNull(builder, nameof(builder)); - - var options = new AppPlatformModelBuilderConfigurationOptions( - AppPlatformDbProperties.DbTablePrefix, - AppPlatformDbProperties.DbSchema - ); - - optionsAction?.Invoke(options); - - builder.Entity(x => - { - x.ToTable(options.TablePrefix + "Route"); - - x.Property(p => p.Code) - .IsRequired() - .HasMaxLength(RouteConsts.MaxCodeLength) - .HasColumnName(nameof(Route.Code)); - x.Property(p => p.DisplayName) - .IsRequired() - .HasMaxLength(RouteConsts.MaxDisplayNameLength) - .HasColumnName(nameof(Route.DisplayName)); - x.Property(p => p.LinkUrl) - .IsRequired() - .HasMaxLength(RouteConsts.MaxLinkUrlLength) - .HasColumnName(nameof(Route.LinkUrl)); - x.Property(p => p.Name) - .IsRequired() - .HasMaxLength(RouteConsts.MaxNameLength) - .HasColumnName(nameof(Route.Name)); - - x.Property(p => p.Icon) - .HasMaxLength(RouteConsts.MaxIconLength) - .HasColumnName(nameof(Route.Icon)); - x.Property(p => p.FullName) - .HasMaxLength(RouteConsts.MaxFullNameLength) - .HasColumnName(nameof(Route.FullName)); - x.Property(p => p.Description) - .HasMaxLength(RouteConsts.MaxDescriptionLength) - .HasColumnName(nameof(Route.Description)); - - x.ConfigureByConvention(); - - x.HasMany().WithOne().HasForeignKey(p => p.ParentId); - - x.HasIndex(i => i.Code); - }); - - builder.Entity(x => - { - x.ToTable(options.TablePrefix + "RoleRoute"); - - x.Property(p => p.RoleName) - .IsRequired() - .HasMaxLength(RoleRouteConsts.MaxRoleNameLength) - .HasColumnName(nameof(RoleRoute.RoleName)); - - x.ConfigureMultiTenant(); - - x.HasIndex(i => new { i.RoleName, i.RouteId }); - }); - - builder.Entity(x => - { - x.ToTable(options.TablePrefix + "UserRoute"); - - x.ConfigureMultiTenant(); - - x.HasIndex(i => new { i.UserId, i.RouteId }); - }); - - builder.Entity(x => - { - x.ToTable(options.TablePrefix + "Version", options.Schema); - - x.Property(p => p.Title) - .IsRequired() - .HasColumnName(nameof(AppVersion.Title)) - .HasMaxLength(AppVersionConsts.MaxTitleLength); - x.Property(p => p.Version) - .IsRequired() - .HasColumnName(nameof(AppVersion.Version)) - .HasMaxLength(AppVersionConsts.MaxVersionLength); - - x.Property(p => p.Description) - .HasColumnName(nameof(AppVersion.Description)) - .HasMaxLength(AppVersionConsts.MaxDescriptionLength); - - x.ConfigureByConvention(); - - x.HasIndex(i => i.Version); - - x.HasMany(p => p.Files) - .WithOne(q => q.AppVersion) - .HasPrincipalKey(pk => pk.Id) - .HasForeignKey(fk => fk.AppVersionId) - .OnDelete(DeleteBehavior.Cascade); - }); - - builder.Entity(x => - { - x.ToTable(options.TablePrefix + "VersionFile", options.Schema); - - x.Property(p => p.Name) - .IsRequired() - .HasColumnName(nameof(VersionFile.Name)) - .HasMaxLength(VersionFileConsts.MaxNameLength); - x.Property(p => p.SHA256) - .IsRequired() - .HasColumnName(nameof(VersionFile.SHA256)) - .HasMaxLength(VersionFileConsts.MaxSHA256Length); - x.Property(p => p.Version) - .IsRequired() - .HasColumnName(nameof(VersionFile.Version)) - .HasMaxLength(VersionFileConsts.MaxVersionLength); - - x.Property(p => p.Path) - .HasColumnName(nameof(VersionFile.Path)) - .HasMaxLength(VersionFileConsts.MaxPathLength); - - x.ConfigureAudited(); - x.ConfigureMultiTenant(); - - x.HasIndex(i => new { i.Path, i.Name, i.Version }).IsUnique(); - - }); - } - } -} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/IPlatformDbContext.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/IPlatformDbContext.cs index b76b7397e..e2b00534b 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/IPlatformDbContext.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/IPlatformDbContext.cs @@ -1,4 +1,6 @@ -using LINGYUN.Platform.Routes; +using LINGYUN.Platform.Datas; +using LINGYUN.Platform.Layouts; +using LINGYUN.Platform.Menus; using LINGYUN.Platform.Versions; using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; @@ -6,10 +8,12 @@ using Volo.Abp.EntityFrameworkCore; namespace LINGYUN.Platform.EntityFrameworkCore { - [ConnectionStringName(AppPlatformDbProperties.ConnectionStringName)] + [ConnectionStringName(PlatformDbProperties.ConnectionStringName)] public interface IPlatformDbContext : IEfCoreDbContext { - DbSet Routes { get; set; } + DbSet Menus { get; set; } + DbSet Layouts { get; set; } + DbSet Datas { get; set; } DbSet AppVersions { get; set; } } } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformDbContext.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformDbContext.cs index e220bc6bd..95b86e43e 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformDbContext.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformDbContext.cs @@ -1,4 +1,6 @@ -using LINGYUN.Platform.Routes; +using LINGYUN.Platform.Datas; +using LINGYUN.Platform.Layouts; +using LINGYUN.Platform.Menus; using LINGYUN.Platform.Versions; using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; @@ -6,10 +8,12 @@ using Volo.Abp.EntityFrameworkCore; namespace LINGYUN.Platform.EntityFrameworkCore { - [ConnectionStringName(AppPlatformDbProperties.ConnectionStringName)] + [ConnectionStringName(PlatformDbProperties.ConnectionStringName)] public class PlatformDbContext : AbpDbContext, IPlatformDbContext { - public DbSet Routes { get; set; } + public DbSet Menus { get; set; } + public DbSet Layouts { get; set; } + public DbSet Datas { get; set; } public DbSet AppVersions { get; set; } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformDbContextModelBuilderExtensions.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformDbContextModelBuilderExtensions.cs new file mode 100644 index 000000000..c27bf6fa6 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformDbContextModelBuilderExtensions.cs @@ -0,0 +1,249 @@ +using JetBrains.Annotations; +using LINGYUN.Platform.Datas; +using LINGYUN.Platform.Layouts; +using LINGYUN.Platform.Menus; +using LINGYUN.Platform.Routes; +using LINGYUN.Platform.Versions; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using System; +using Volo.Abp; +using Volo.Abp.EntityFrameworkCore.Modeling; + +namespace LINGYUN.Platform.EntityFrameworkCore +{ + public static class PlatformDbContextModelBuilderExtensions + { + public static void ConfigurePlatform( + this ModelBuilder builder, + Action optionsAction = null) + { + Check.NotNull(builder, nameof(builder)); + + var options = new PlatformModelBuilderConfigurationOptions( + PlatformDbProperties.DbTablePrefix, + PlatformDbProperties.DbSchema + ); + + optionsAction?.Invoke(options); + + builder.Entity(b => + { + b.ToTable(options.TablePrefix + "Layouts", options.Schema); + + b.ConfigureRoute(); + }); + + builder.Entity(b => + { + b.ToTable(options.TablePrefix + "Menus", options.Schema); + + b.ConfigureRoute(); + + b.Property(p => p.Component) + .HasMaxLength(MenuConsts.MaxComponentLength) + .HasColumnName(nameof(Menu.Component)) + .IsRequired(); + b.Property(p => p.Code) + .HasMaxLength(MenuConsts.MaxCodeLength) + .HasColumnName(nameof(Menu.Code)) + .IsRequired(); + }); + + builder.Entity(x => + { + x.ToTable(options.TablePrefix + "RoleMenus"); + + x.Property(p => p.RoleName) + .IsRequired() + .HasMaxLength(RoleRouteConsts.MaxRoleNameLength) + .HasColumnName(nameof(RoleMenu.RoleName)); + + x.ConfigureByConvention(); + + x.HasIndex(i => new { i.RoleName, i.MenuId }); + }); + + builder.Entity(x => + { + x.ToTable(options.TablePrefix + "UserMenus"); + + x.ConfigureByConvention(); + + x.HasIndex(i => new { i.UserId, i.MenuId }); + }); + + builder.Entity(x => + { + x.ToTable(options.TablePrefix + "Datas"); + + x.Property(p => p.Code) + .HasMaxLength(DataConsts.MaxCodeLength) + .HasColumnName(nameof(Data.Code)) + .IsRequired(); + x.Property(p => p.Name) + .HasMaxLength(DataConsts.MaxNameLength) + .HasColumnName(nameof(Data.Name)) + .IsRequired(); + x.Property(p => p.DisplayName) + .HasMaxLength(DataConsts.MaxDisplayNameLength) + .HasColumnName(nameof(Data.DisplayName)) + .IsRequired(); + x.Property(p => p.Description) + .HasMaxLength(DataConsts.MaxDescriptionLength) + .HasColumnName(nameof(Data.Description)); + + x.ConfigureByConvention(); + + x.HasMany(p => p.Items) + .WithOne() + .HasForeignKey(fk => fk.DataId) + .IsRequired(); + + x.HasIndex(i => new { i.Name }); + }); + + builder.Entity(x => + { + x.ToTable(options.TablePrefix + "DataItems"); + + x.Property(p => p.DefaultValue) + .HasMaxLength(DataItemConsts.MaxValueLength) + .HasColumnName(nameof(DataItem.DefaultValue)); + x.Property(p => p.Name) + .HasMaxLength(DataItemConsts.MaxNameLength) + .HasColumnName(nameof(DataItem.Name)) + .IsRequired(); + x.Property(p => p.DisplayName) + .HasMaxLength(DataItemConsts.MaxDisplayNameLength) + .HasColumnName(nameof(DataItem.DisplayName)) + .IsRequired(); + x.Property(p => p.Description) + .HasMaxLength(DataItemConsts.MaxDescriptionLength) + .HasColumnName(nameof(DataItem.Description)); + + x.Property(p => p.AllowBeNull).HasDefaultValue(true); + + x.ConfigureByConvention(); + + x.HasIndex(i => new { i.Name }); + }); + + + builder.Entity(x => + { + x.ToTable(options.TablePrefix + "Version", options.Schema); + + x.Property(p => p.Title) + .IsRequired() + .HasColumnName(nameof(AppVersion.Title)) + .HasMaxLength(AppVersionConsts.MaxTitleLength); + x.Property(p => p.Version) + .IsRequired() + .HasColumnName(nameof(AppVersion.Version)) + .HasMaxLength(AppVersionConsts.MaxVersionLength); + + x.Property(p => p.Description) + .HasColumnName(nameof(AppVersion.Description)) + .HasMaxLength(AppVersionConsts.MaxDescriptionLength); + + x.ConfigureByConvention(); + + x.HasIndex(i => i.Version); + + x.HasMany(p => p.Files) + .WithOne(q => q.AppVersion) + .HasPrincipalKey(pk => pk.Id) + .HasForeignKey(fk => fk.AppVersionId) + .OnDelete(DeleteBehavior.Cascade); + }); + + builder.Entity(x => + { + x.ToTable(options.TablePrefix + "VersionFile", options.Schema); + + x.Property(p => p.Name) + .IsRequired() + .HasColumnName(nameof(VersionFile.Name)) + .HasMaxLength(VersionFileConsts.MaxNameLength); + x.Property(p => p.SHA256) + .IsRequired() + .HasColumnName(nameof(VersionFile.SHA256)) + .HasMaxLength(VersionFileConsts.MaxSHA256Length); + x.Property(p => p.Version) + .IsRequired() + .HasColumnName(nameof(VersionFile.Version)) + .HasMaxLength(VersionFileConsts.MaxVersionLength); + + x.Property(p => p.Path) + .HasColumnName(nameof(VersionFile.Path)) + .HasMaxLength(VersionFileConsts.MaxPathLength); + + x.ConfigureAudited(); + x.ConfigureMultiTenant(); + + x.HasIndex(i => new { i.Path, i.Name, i.Version }).IsUnique(); + + }); + } + + public static EntityTypeBuilder ConfigureRoute( + this EntityTypeBuilder builder) + where TRoute : Route + { + builder + .Property(p => p.DisplayName) + .HasMaxLength(RouteConsts.MaxDisplayNameLength) + .HasColumnName(nameof(Route.DisplayName)) + .IsRequired(); + builder + .Property(p => p.Name) + .HasMaxLength(RouteConsts.MaxNameLength) + .HasColumnName(nameof(Route.Name)) + .IsRequired(); + builder + .Property(p => p.Path) + .HasMaxLength(RouteConsts.MaxPathLength) + .HasColumnName(nameof(Route.Path)); + builder + .Property(p => p.Redirect) + .HasMaxLength(RouteConsts.MaxRedirectLength) + .HasColumnName(nameof(Route.Redirect)); + + builder.ConfigureByConvention(); + + return builder; + } + + public static OwnedNavigationBuilder ConfigureRoute( + [NotNull] this OwnedNavigationBuilder builder, + [CanBeNull] string tablePrefix = "", + [CanBeNull] string schema = null) + where TEntity : class + where TRoute : Route + { + builder.ToTable(tablePrefix + "Routes", schema); + + builder + .Property(p => p.DisplayName) + .HasMaxLength(RouteConsts.MaxDisplayNameLength) + .HasColumnName(nameof(Route.DisplayName)) + .IsRequired(); + builder + .Property(p => p.Name) + .HasMaxLength(RouteConsts.MaxNameLength) + .HasColumnName(nameof(Route.Name)) + .IsRequired(); + builder + .Property(p => p.Path) + .HasMaxLength(RouteConsts.MaxPathLength) + .HasColumnName(nameof(Route.Path)); + builder + .Property(p => p.Redirect) + .HasMaxLength(RouteConsts.MaxRedirectLength) + .HasColumnName(nameof(Route.Redirect)); + + return builder; + } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformEfCoreQueryableExtensions.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformEfCoreQueryableExtensions.cs new file mode 100644 index 000000000..46d257581 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformEfCoreQueryableExtensions.cs @@ -0,0 +1,34 @@ +using LINGYUN.Platform.Datas; +using LINGYUN.Platform.Layouts; +using LINGYUN.Platform.Menus; +using Microsoft.EntityFrameworkCore; +using System.Linq; + +namespace LINGYUN.Platform.EntityFrameworkCore +{ + public static class PlatformEfCoreQueryableExtensions + { + + public static IQueryable IncludeDetails(this IQueryable queryable, bool include = true) + { + if (!include) + { + return queryable; + } + + return queryable; + } + + public static IQueryable IncludeDetails(this IQueryable queryable, bool include = true) + { + if (!include) + { + return queryable; + } + + return queryable + //.AsSplitQuery() + .Include(x => x.Items); + } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/AppPlatformEntityFrameworkCoreModule.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformEntityFrameworkCoreModule.cs similarity index 61% rename from aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/AppPlatformEntityFrameworkCoreModule.cs rename to aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformEntityFrameworkCoreModule.cs index 56965a925..7f590458a 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/AppPlatformEntityFrameworkCoreModule.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformEntityFrameworkCoreModule.cs @@ -1,4 +1,6 @@ -using LINGYUN.Platform.Routes; +using LINGYUN.Platform.Datas; +using LINGYUN.Platform.Layouts; +using LINGYUN.Platform.Menus; using LINGYUN.Platform.Versions; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; @@ -8,15 +10,19 @@ using Volo.Abp.Modularity; namespace LINGYUN.Platform.EntityFrameworkCore { [DependsOn( - typeof(AppPlatformDomainModule), + typeof(PlatformDomainModule), typeof(AbpEntityFrameworkCoreModule))] - public class AppPlatformEntityFrameworkCoreModule : AbpModule + public class PlatformEntityFrameworkCoreModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { context.Services.AddAbpDbContext(options => { - options.AddRepository(); + options.AddRepository(); + options.AddRepository(); + options.AddRepository(); + options.AddRepository(); + options.AddRepository(); options.AddRepository(); options.AddDefaultRepositories(includeAllEntities: true); diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/AppPlatformModelBuilderConfigurationOptions.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformModelBuilderConfigurationOptions.cs similarity index 67% rename from aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/AppPlatformModelBuilderConfigurationOptions.cs rename to aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformModelBuilderConfigurationOptions.cs index b7822c910..260ea5b4f 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/AppPlatformModelBuilderConfigurationOptions.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformModelBuilderConfigurationOptions.cs @@ -3,9 +3,9 @@ using Volo.Abp.EntityFrameworkCore.Modeling; namespace LINGYUN.Platform.EntityFrameworkCore { - public class AppPlatformModelBuilderConfigurationOptions : AbpModelBuilderConfigurationOptions + public class PlatformModelBuilderConfigurationOptions : AbpModelBuilderConfigurationOptions { - public AppPlatformModelBuilderConfigurationOptions( + public PlatformModelBuilderConfigurationOptions( [NotNull] string tablePrefix = "", [CanBeNull] string schema = null) : base( diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Layouts/EfCoreLayoutRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Layouts/EfCoreLayoutRepository.cs new file mode 100644 index 000000000..3d0abf5db --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Layouts/EfCoreLayoutRepository.cs @@ -0,0 +1,82 @@ +using LINGYUN.Platform.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Dynamic.Core; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.Platform.Layouts +{ + public class EfCoreLayoutRepository : EfCoreRepository, ILayoutRepository + { + public EfCoreLayoutRepository(IDbContextProvider dbContextProvider) + : base(dbContextProvider) + { + } + + public virtual async Task FindByNameAsync( + string name, + bool includeDetails = false, + CancellationToken cancellationToken = default) + { + return await DbSet + .IncludeDetails(includeDetails) + .Where(x => x.Name == name) + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task GetCountAsync( + PlatformType? platformType = null, + string filter = "", + CancellationToken cancellationToken = default) + { + return await DbSet + .WhereIf(platformType.HasValue, x => x.PlatformType == platformType.Value) + .WhereIf(!filter.IsNullOrWhiteSpace(), x => + x.Name.Contains(filter) || x.DisplayName.Contains(filter) || + x.Description.Contains(filter) || x.Redirect.Contains(filter)) + .CountAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task GetLastOrNullAsync( + CancellationToken cancellationToken = default) + { + return await DbSet + .OrderByDescending(x => x.Code) + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task> GetListAsync( + PlatformType? platformType = null, + string filter = "", + string sorting = "Code", + bool reverse = false, + bool includeDetails = false, + int skipCount = 0, + int maxResultCount = 10, + CancellationToken cancellationToken = default) + { + sorting ??= nameof(Layout.Code); + sorting = reverse ? sorting + " DESC" : sorting; + + return await DbSet + .IncludeDetails(includeDetails) + .WhereIf(platformType.HasValue, x => x.PlatformType == platformType.Value) + .WhereIf(!filter.IsNullOrWhiteSpace(), x => + x.Name.Contains(filter) || x.DisplayName.Contains(filter) || + x.Description.Contains(filter) || x.Redirect.Contains(filter)) + .OrderBy(sorting) + .PageBy(skipCount, maxResultCount) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + + public override IQueryable WithDetails() + { + return GetQueryable().IncludeDetails(); + } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs new file mode 100644 index 000000000..2a66d9a33 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs @@ -0,0 +1,232 @@ +using LINGYUN.Platform.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Dynamic.Core; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.Platform.Menus +{ + public class EfCoreMenuRepository : EfCoreRepository, IMenuRepository + { + public EfCoreMenuRepository( + IDbContextProvider dbContextProvider) + : base(dbContextProvider) + { + } + + public virtual async Task UserHasInMenuAsync( + Guid userId, + string menuName, + CancellationToken cancellationToken = default) + { + var menuQuery = DbSet.Where(x => x.Name == menuName); + + return await (from menu in menuQuery + join userMenu in DbContext.Set() + on menu.Id equals userMenu.MenuId + select userMenu) + .AnyAsync(x => x.UserId == userId, GetCancellationToken(cancellationToken)); + } + + public virtual async Task RoleHasInMenuAsync( + string roleName, + string menuName, + CancellationToken cancellationToken = default) + { + var menuQuery = DbSet.Where(x => x.Name == menuName); + + return await (from menu in menuQuery + join roleMenu in DbContext.Set() + on menu.Id equals roleMenu.MenuId + select roleMenu) + .AnyAsync(x => x.RoleName == roleName, GetCancellationToken(cancellationToken)); + } + + public virtual async Task FindByNameAsync( + string menuName, + CancellationToken cancellationToken = default) + { + return await DbSet + .Where(x => x.Name == menuName) + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task FindMainAsync( + PlatformType platformType = PlatformType.None, + CancellationToken cancellationToken = default) + { + return await DbSet + .Where(menu => menu.PlatformType.HasFlag(platformType) && menu.Path == "/") + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task> GetRoleMenusAsync( + string[] roles, + PlatformType platformType = PlatformType.None, + CancellationToken cancellationToken = default) + { + var menuQuery = DbSet + .Where(menu => menu.PlatformType.HasFlag(platformType)); + + var roleMenuQuery = DbContext.Set() + .Where(menu => roles.Contains(menu.RoleName)); + + return await (from menu in menuQuery + join roleMenu in roleMenuQuery + on menu.Id equals roleMenu.MenuId + select menu) + .Union(menuQuery.Where(x => x.IsPublic)) + .Distinct() + .ToListAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task> GetUserMenusAsync( + Guid userId, + string[] roles, + PlatformType platformType = PlatformType.None, + CancellationToken cancellationToken = default) + { + var menuQuery = DbSet + .Where(menu => menu.PlatformType.HasFlag(platformType)); + + var userMenuQuery = from userMenu in DbContext.Set() + join menu in menuQuery + on userMenu.MenuId equals menu.Id + where userMenu.UserId == userId + select menu; + + if (roles != null && roles.Length > 0) + { + var roleMenuQuery = from roleMenu in DbContext.Set() + join menu in menuQuery + on roleMenu.MenuId equals menu.Id + where roles.Contains(roleMenu.RoleName) + select menu; ; + + return await userMenuQuery + .Union(roleMenuQuery) + .Union(menuQuery.Where(x => x.IsPublic)) + .Distinct() + .ToListAsync(GetCancellationToken(cancellationToken)); + } + + return await userMenuQuery + .Union(menuQuery.Where(x => x.IsPublic)) + .Distinct() + .ToListAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task> GetChildrenAsync( + Guid? parentId, + CancellationToken cancellationToken = default + ) + { + return await DbSet + .Where(x => x.ParentId == parentId) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task> GetAllChildrenWithParentCodeAsync( + string code, + Guid? parentId, + CancellationToken cancellationToken = default + ) + { + return await DbSet + .Where(x => x.Code.StartsWith(code) && x.Id != parentId.Value) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task> GetAllAsync( + string filter = "", + string sorting = nameof(Menu.Code), + bool reverse = false, + PlatformType? platformType = null, + Guid? parentId = null, + CancellationToken cancellationToken = default) + { + sorting ??= nameof(Menu.Code); + sorting = reverse ? sorting + " DESC" : sorting; + + return await DbSet + .WhereIf(parentId.HasValue, x => x.ParentId == parentId) + .WhereIf(platformType.HasValue, menu => menu.PlatformType.HasFlag(platformType.Value)) + .WhereIf(!filter.IsNullOrWhiteSpace(), menu => + menu.Path.Contains(filter) || menu.Name.Contains(filter) || + menu.DisplayName.Contains(filter) || menu.Description.Contains(filter) || + menu.Redirect.Contains(filter)) + .OrderBy(sorting) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task GetCountAsync( + string filter = "", + PlatformType? platformType = null, + Guid? parentId = null, + CancellationToken cancellationToken = default) + { + return await DbSet + .WhereIf(parentId.HasValue, x => x.ParentId == parentId) + .WhereIf(platformType.HasValue, menu => menu.PlatformType.HasFlag(platformType.Value)) + .WhereIf(!filter.IsNullOrWhiteSpace(), menu => + menu.Path.Contains(filter) || menu.Name.Contains(filter) || + menu.DisplayName.Contains(filter) || menu.Description.Contains(filter) || + menu.Redirect.Contains(filter)) + .CountAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task> GetListAsync( + string filter = "", + string sorting = nameof(Menu.Code), + bool reverse = false, + PlatformType? platformType = null, + Guid? parentId = null, + int skipCount = 0, + int maxResultCount = 10, + CancellationToken cancellationToken = default) + { + sorting ??= nameof(Menu.Code); + sorting = reverse ? sorting + " DESC" : sorting; + + return await DbSet + .WhereIf(parentId.HasValue, x => x.ParentId == parentId) + .WhereIf(platformType.HasValue, menu => menu.PlatformType.HasFlag(platformType.Value)) + .WhereIf(!filter.IsNullOrWhiteSpace(), menu => + menu.Path.Contains(filter) || menu.Name.Contains(filter) || + menu.DisplayName.Contains(filter) || menu.Description.Contains(filter) || + menu.Redirect.Contains(filter)) + .OrderBy(sorting) + .PageBy(skipCount, maxResultCount) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task RemoveAllRolesAsync( + Menu menu, + CancellationToken cancellationToken = default + ) + { + var rolesQuery = await DbContext.Set() + .Where(q => q.MenuId == menu.Id) + .ToListAsync(GetCancellationToken(cancellationToken)); + + DbContext.Set().RemoveRange(rolesQuery); + } + + public virtual async Task RemoveAllMembersAsync( + Menu menu, + CancellationToken cancellationToken = default + ) + { + var membersQuery = await DbContext.Set() + .Where(q => q.MenuId == menu.Id) + .ToListAsync(GetCancellationToken(cancellationToken)); + + DbContext.Set().RemoveRange(membersQuery); + } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreRoleMenuRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreRoleMenuRepository.cs new file mode 100644 index 000000000..7c9c8c8f3 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreRoleMenuRepository.cs @@ -0,0 +1,60 @@ +using LINGYUN.Platform.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.Platform.Menus +{ + public class EfCoreRoleMenuRepository : EfCoreRepository, IRoleMenuRepository + { + public EfCoreRoleMenuRepository( + IDbContextProvider dbContextProvider) + : base(dbContextProvider) + { + } + + public virtual async Task RoleHasInMenuAsync( + string roleName, + string menuName, + CancellationToken cancellationToken = default) + { + var menuQuery = DbContext.Set().Where(x => x.Name == menuName); + + return await + (from roleMenu in DbSet + join menu in menuQuery + on roleMenu.MenuId equals menu.Id + select roleMenu) + .AnyAsync(x => x.RoleName == roleName, + GetCancellationToken(cancellationToken)); + } + + public virtual async Task SetRoleMenusAsync( + string roleName, + IEnumerable menuIds, + CancellationToken cancellationToken = default) + { + var hasInMenus = await DbSet + .Where(x => x.RoleName == roleName) + .ToArrayAsync(GetCancellationToken(cancellationToken)); + + var removes = hasInMenus.Where(x => !menuIds.Contains(x.MenuId)); + if (removes.Any()) + { + DbContext.RemoveRange(removes); + } + + var adds = menuIds.Where(menuId => !hasInMenus.Any(x => x.MenuId == menuId)); + if (adds.Any()) + { + var addInMenus = adds.Select(menuId => new RoleMenu(menuId, roleName, CurrentTenant.Id)); + await DbContext.AddRangeAsync(addInMenus, GetCancellationToken(cancellationToken)); + } + } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreUserMenuRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreUserMenuRepository.cs new file mode 100644 index 000000000..5b5f31810 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreUserMenuRepository.cs @@ -0,0 +1,60 @@ +using LINGYUN.Platform.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.Platform.Menus +{ + public class EfCoreUserMenuRepository : EfCoreRepository, IUserMenuRepository + { + public EfCoreUserMenuRepository( + IDbContextProvider dbContextProvider) + : base(dbContextProvider) + { + } + + public virtual async Task UserHasInMenuAsync( + Guid userId, + string menuName, + CancellationToken cancellationToken = default) + { + var menuQuery = DbContext.Set().Where(x => x.Name == menuName); + + return await + (from roleMenu in DbSet + join menu in menuQuery + on roleMenu.MenuId equals menu.Id + select roleMenu) + .AnyAsync(x => x.UserId == userId, + GetCancellationToken(cancellationToken)); + } + + public virtual async Task SetMemberMenusAsync( + Guid userId, + IEnumerable menuIds, + CancellationToken cancellationToken = default) + { + var hasInMenus = await DbSet + .Where(x => x.UserId == userId) + .ToArrayAsync(GetCancellationToken(cancellationToken)); + + var removes = hasInMenus.Where(x => !menuIds.Contains(x.MenuId)); + if (removes.Any()) + { + DbContext.RemoveRange(removes); + } + + var adds = menuIds.Where(menuId => !hasInMenus.Any(x => x.MenuId == menuId)); + if (adds.Any()) + { + var addInMenus = adds.Select(menuId => new UserMenu(menuId, userId, CurrentTenant.Id)); + await DbContext.AddRangeAsync(addInMenus, GetCancellationToken(cancellationToken)); + } + } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Routes/EfCoreRouteRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Routes/EfCoreRouteRepository.cs deleted file mode 100644 index fb4aa061e..000000000 --- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Routes/EfCoreRouteRepository.cs +++ /dev/null @@ -1,141 +0,0 @@ -using LINGYUN.Platform.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Dynamic.Core; -using System.Security.Cryptography.X509Certificates; -using System.Threading; -using System.Threading.Tasks; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Domain.Repositories.EntityFrameworkCore; -using Volo.Abp.EntityFrameworkCore; - -namespace LINGYUN.Platform.Routes -{ - public class EfCoreRouteRepository : EfCoreRepository, IRouteRepository, ITransientDependency - { - public EfCoreRouteRepository( - IDbContextProvider dbContextProvider) - : base(dbContextProvider) - { - } - - public virtual async Task> GetAllChildrenWithParentCodeAsync(string code, Guid? parentId, CancellationToken cancellationToken = default) - { - return await DbSet - .Where(ou => ou.Code.StartsWith(code) && ou.Id != parentId.Value) - .ToListAsync(GetCancellationToken(cancellationToken)); - } - - public virtual async Task GetAsync(string displayName, CancellationToken cancellationToken = default) - { - return await DbSet - .FirstOrDefaultAsync( - ou => ou.DisplayName == displayName, - GetCancellationToken(cancellationToken) - ); - } - - public virtual async Task> GetChildrenAsync(Guid? parentId, CancellationToken cancellationToken = default) - { - return await DbSet - .Where(x => x.ParentId == parentId) - .ToListAsync(GetCancellationToken(cancellationToken)); - } - - public virtual async Task> GetPagedListAsync(string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, CancellationToken cancellationToken = default) - { - return await DbSet - .OrderBy(sorting ?? nameof(Route.Code)) - .Page(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)); - } - - public virtual async Task> GetRolesRouteAsync(string roleName, CancellationToken cancellationToken = default) - { - var roleRoutes = await (from route in DbSet - join roleRoute in DbContext.Set() - on route.Id equals roleRoute.RouteId - where roleRoute.RoleName.Equals(roleName) - select route) - .ToListAsync(GetCancellationToken(cancellationToken)); - - return roleRoutes; - } - - public virtual async Task> GetUsersRouteAsync(Guid userId, CancellationToken cancellationToken = default) - { - var userRoutes = await (from route in DbSet - join userRoute in DbContext.Set() - on route.Id equals userRoute.RouteId - where userRoute.UserId.Equals(userId) - select route) - .ToListAsync(GetCancellationToken(cancellationToken)); - - return userRoutes; - } - - public virtual async Task IsInRouteAsync(string roleName, Route route, CancellationToken cancellationToken = default) - { - return await DbContext.Set() - .AnyAsync(x => x.RouteId.Equals(route.Id) && x.RoleName.Equals(roleName), - GetCancellationToken(cancellationToken)); - } - - public virtual async Task IsInRouteAsync(Guid userId, Route route, CancellationToken cancellationToken = default) - { - return await DbContext.Set() - .AnyAsync(x => x.RouteId.Equals(route.Id) && x.UserId.Equals(userId), - GetCancellationToken(cancellationToken)); - } - - public virtual async Task RemoveAllRolesRouteAsync(Route route, CancellationToken cancellationToken = default) - { - var roleRoutes = await DbContext.Set() - .Where(x => x.RouteId.Equals(route.Id)) - .Select(x => new RoleRoute(x.Id)) - .AsNoTracking() - .ToArrayAsync(GetCancellationToken(cancellationToken)); - - DbContext.Set().AttachRange(roleRoutes); - DbContext.Set().RemoveRange(roleRoutes); - } - - public virtual async Task RemoveAllUsersRouteAsync(Route route, CancellationToken cancellationToken = default) - { - var userRoutes = await DbContext.Set() - .Where(x => x.RouteId.Equals(route.Id)) - .Select(x => new UserRoute(x.Id)) - .AsNoTracking() - .ToArrayAsync(GetCancellationToken(cancellationToken)); - - DbContext.Set().AttachRange(userRoutes); - DbContext.Set().RemoveRange(userRoutes); - } - - public virtual async Task RemoveRoleRouteAsync(string roleName, Route route, CancellationToken cancellationToken = default) - { - var roleRoutes = await DbContext.Set() - .Where(x => x.RouteId.Equals(route.Id) && x.RoleName.Equals(roleName)) - .Select(x => new RoleRoute(x.Id)) - .AsNoTracking() - .ToArrayAsync(GetCancellationToken(cancellationToken)); - - DbContext.Set().AttachRange(roleRoutes); - DbContext.Set().RemoveRange(roleRoutes); - } - - public virtual async Task RemoveUserRouteAsync(Guid userId, Route route, CancellationToken cancellationToken = default) - { - var userRoutes = await DbContext.Set() - .Where(x => x.RouteId.Equals(route.Id) && x.UserId.Equals(userId)) - .Select(x => new UserRoute(x.Id)) - .AsNoTracking() - .ToArrayAsync(GetCancellationToken(cancellationToken)); - - DbContext.Set().AttachRange(userRoutes); - DbContext.Set().RemoveRange(userRoutes); - } - } -} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN.Platform.HttpApi.csproj b/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN.Platform.HttpApi.csproj index fad83a1ce..8ab7f6fe5 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN.Platform.HttpApi.csproj +++ b/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN.Platform.HttpApi.csproj @@ -1,4 +1,4 @@ - + @@ -9,6 +9,7 @@ + diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Datas/DataController.cs b/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Datas/DataController.cs new file mode 100644 index 000000000..62bc131f0 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Datas/DataController.cs @@ -0,0 +1,84 @@ +using Microsoft.AspNetCore.Mvc; +using System; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.AspNetCore.Mvc; + +namespace LINGYUN.Platform.Datas +{ + [RemoteService(Name = PlatformRemoteServiceConsts.RemoteServiceName)] + [Area("platform")] + [Route("api/platform/datas")] + public class DataController : AbpController, IDataAppService + { + protected IDataAppService DataAppService { get; } + + public DataController( + IDataAppService dataAppService) + { + DataAppService = dataAppService; + } + + [HttpPost] + public virtual async Task CreateAsync(DataCreateDto input) + { + return await DataAppService.CreateAsync(input); + } + + [HttpPost] + [Route("{id}/items")] + public virtual async Task CreateItemAsync(Guid id, DataItemCreateDto input) + { + await DataAppService.CreateItemAsync(id, input); + } + + [HttpDelete] + [Route("{id}")] + public virtual async Task DeleteAsync(Guid id) + { + await DataAppService.DeleteAsync(id); + } + + [HttpDelete] + [Route("{id}/items/{name}")] + public virtual async Task DeleteItemAsync(Guid id, string name) + { + await DataAppService.DeleteItemAsync(id, name); + } + + [HttpGet] + [Route("{id}")] + public virtual async Task GetAsync(Guid id) + { + return await DataAppService.GetAsync(id); + } + + [HttpGet] + [Route("all")] + public virtual async Task> GetAllAsync() + { + return await DataAppService.GetAllAsync(); + } + + [HttpGet] + public virtual async Task> GetListAsync(GetDataListInput input) + { + return await DataAppService.GetListAsync(input); + } + + [HttpPut] + [Route("{id}")] + public virtual async Task UpdateAsync(Guid id, DataUpdateDto input) + { + return await DataAppService.UpdateAsync(id, input); + } + + [HttpPut] + [Route("{id}/items/{name}")] + public virtual async Task UpdateItemAsync(Guid id, string name, DataItemUpdateDto input) + { + await DataAppService.UpdateItemAsync(id, name, input); + } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Layouts/LayoutController.cs b/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Layouts/LayoutController.cs new file mode 100644 index 000000000..789316b2a --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Layouts/LayoutController.cs @@ -0,0 +1,56 @@ +using Microsoft.AspNetCore.Mvc; +using System; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.AspNetCore.Mvc; + +namespace LINGYUN.Platform.Layouts +{ + [RemoteService(Name = PlatformRemoteServiceConsts.RemoteServiceName)] + [Area("platform")] + [Route("api/platform/layouts")] + public class LayoutController : AbpController, ILayoutAppService + { + protected ILayoutAppService LayoutAppService { get; } + + public LayoutController( + ILayoutAppService layoutAppService) + { + LayoutAppService = layoutAppService; + } + + [HttpPost] + public virtual async Task CreateAsync(LayoutCreateDto input) + { + return await LayoutAppService.CreateAsync(input); + } + + [HttpDelete] + [Route("{id}")] + public virtual async Task DeleteAsync(Guid id) + { + await LayoutAppService.DeleteAsync(id); + } + + [HttpGet] + [Route("{id}")] + public virtual async Task GetAsync(Guid id) + { + return await LayoutAppService.GetAsync(id); + } + + [HttpGet] + public virtual async Task> GetListAsync(GetLayoutListInput input) + { + return await LayoutAppService.GetListAsync(input); + } + + [HttpPut] + [Route("{id}")] + public virtual async Task UpdateAsync(Guid id, LayoutUpdateDto input) + { + return await LayoutAppService.UpdateAsync(id, input); + } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Menus/MenuController.cs b/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Menus/MenuController.cs new file mode 100644 index 000000000..2c2e42754 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Menus/MenuController.cs @@ -0,0 +1,128 @@ +using Microsoft.AspNetCore.Mvc; +using System; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.Identity; + +namespace LINGYUN.Platform.Menus +{ + [RemoteService(Name = PlatformRemoteServiceConsts.RemoteServiceName)] + [Area("platform")] + [Route("api/platform/menus")] + public class MenuController : AbpController, IMenuAppService + { + protected IMenuAppService MenuAppService { get; } + protected IUserRoleFinder UserRoleFinder { get; } + + public MenuController( + IMenuAppService menuAppService, + IUserRoleFinder userRoleFinder) + { + MenuAppService = menuAppService; + UserRoleFinder = userRoleFinder; + } + + [HttpGet] + [Route("by-current-user")] + public virtual async Task> GetCurrentUserMenuListAsync(GetMenuInput input) + { + return await MenuAppService.GetCurrentUserMenuListAsync(input); + } + + [HttpGet] + [Route("{id}")] + public virtual async Task GetAsync(Guid id) + { + return await MenuAppService.GetAsync(id); + } + + [HttpGet] + [Route("all")] + public virtual async Task> GetAllAsync(MenuGetAllInput input) + { + return await MenuAppService.GetAllAsync(input); + } + + [HttpGet] + public virtual async Task> GetListAsync(MenuGetListInput input) + { + return await MenuAppService.GetListAsync(input); + } + + [HttpPost] + public virtual async Task CreateAsync(MenuCreateDto input) + { + return await MenuAppService.CreateAsync(input); + } + + [HttpPut] + [Route("{id}")] + public virtual async Task UpdateAsync(Guid id, MenuUpdateDto input) + { + return await MenuAppService.UpdateAsync(id, input); + } + + [HttpDelete] + [Route("{id}")] + public virtual async Task DeleteAsync(Guid id) + { + await MenuAppService.DeleteAsync(id); + } + + [HttpPut] + [Route("by-user")] + public virtual async Task SetUserMenusAsync(UserMenuInput input) + { + await MenuAppService.SetUserMenusAsync(input); + } + + [HttpGet] + [Route("by-user")] + public virtual async Task> GetUserMenuListAsync(MenuGetByUserInput input) + { + return await MenuAppService.GetUserMenuListAsync(input); + } + + [HttpGet] + [Route("by-user/{userId}/{platformType}")] + public virtual async Task> GetUserMenuListAsync(Guid userId, PlatformType platformType) + { + var userRoles = await UserRoleFinder.GetRolesAsync(userId); + + var getMenuByUser = new MenuGetByUserInput + { + UserId = userId, + Roles = userRoles, + PlatformType = platformType + }; + return await MenuAppService.GetUserMenuListAsync(getMenuByUser); + } + + [HttpPut] + [Route("by-role")] + public virtual async Task SetRoleMenusAsync(RoleMenuInput input) + { + await MenuAppService.SetRoleMenusAsync(input); + } + + [HttpGet] + [Route("by-role")] + public virtual async Task> GetRoleMenuListAsync(MenuGetByRoleInput input) + { + return await MenuAppService.GetRoleMenuListAsync(input); + } + + [HttpGet] + [Route("by-role/{role}/{platformType}")] + public virtual async Task> GetRoleMenuListAsync(string role, PlatformType platformType) + { + return await MenuAppService.GetRoleMenuListAsync(new MenuGetByRoleInput + { + Role = role, + PlatformType = platformType + }); + } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/AppPlatformHttpApiModule.cs b/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/PlatformHttpApiModule.cs similarity index 84% rename from aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/AppPlatformHttpApiModule.cs rename to aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/PlatformHttpApiModule.cs index d82c5a069..b7aa8ce52 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/AppPlatformHttpApiModule.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/PlatformHttpApiModule.cs @@ -6,15 +6,15 @@ using Volo.Abp.Modularity; namespace LINGYUN.Platform.HttpApi { [DependsOn( - typeof(AppPlatformApplicationContractModule), + typeof(PlatformApplicationContractModule), typeof(AbpAspNetCoreMvcModule))] - public class AppPlatformHttpApiModule : AbpModule + public class PlatformHttpApiModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) { PreConfigure(mvcBuilder => { - mvcBuilder.AddApplicationPartIfNotExists(typeof(AppPlatformApplicationContractModule).Assembly); + mvcBuilder.AddApplicationPartIfNotExists(typeof(PlatformApplicationContractModule).Assembly); }); } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Versions/VersionController.cs b/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Versions/VersionController.cs index b014e799e..36c163456 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Versions/VersionController.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Versions/VersionController.cs @@ -16,6 +16,7 @@ using Volo.Abp.Settings; namespace LINGYUN.Platform.Versions { + [RemoteService(Name = PlatformRemoteServiceConsts.RemoteServiceName)] [Area("platform")] [Route("api/platform/version")] public class VersionController : PlatformControllerBase, IVersionAppService diff --git a/aspnet-core/services/account/AuthServer.Host/DataSeeder/IdentityServerDataSeedContributor.cs b/aspnet-core/services/account/AuthServer.Host/DataSeeder/IdentityServerDataSeedContributor.cs index 18feae7bd..c2c75c5e7 100644 --- a/aspnet-core/services/account/AuthServer.Host/DataSeeder/IdentityServerDataSeedContributor.cs +++ b/aspnet-core/services/account/AuthServer.Host/DataSeeder/IdentityServerDataSeedContributor.cs @@ -189,6 +189,23 @@ namespace AuthServer.DataSeeder permissions: apigatewayPermissions ); } + + // InternalService 内部服务间通讯客户端,必要的话需要在前端指定它拥有所有权限,当前项目仅预置用户查询权限 + var internalServiceClientId = configurationSection["InternalService:ClientId"]; + if (!internalServiceClientId.IsNullOrWhiteSpace()) + { + var internalServicePermissions = new string[2] + { + "AbpIdentity.UserLookup","AbpIdentity.Users" + }; + await CreateClientAsync( + internalServiceClientId, + commonScopes.Union(new[] { "auth-service" }), + new[] { "client_credentials" }, + commonSecret, + permissions: internalServicePermissions + ); + } } private async Task CreateClientAsync( diff --git a/aspnet-core/services/admin/LINGYUN.Abp.BackendAdmin.HttpApi.Host/BackendAdminHostModule.cs b/aspnet-core/services/admin/LINGYUN.Abp.BackendAdmin.HttpApi.Host/BackendAdminHostModule.cs index c0e9abf26..b5e91a622 100644 --- a/aspnet-core/services/admin/LINGYUN.Abp.BackendAdmin.HttpApi.Host/BackendAdminHostModule.cs +++ b/aspnet-core/services/admin/LINGYUN.Abp.BackendAdmin.HttpApi.Host/BackendAdminHostModule.cs @@ -62,7 +62,7 @@ namespace LINGYUN.Abp.BackendAdmin { [DependsOn( typeof(AbpAspNetCoreMvcUiMultiTenancyModule), - typeof(AppPlatformApplicationContractModule), + typeof(PlatformApplicationContractModule), typeof(ApiGatewayApplicationContractsModule), typeof(AbpFileManagementApplicationContractsModule), typeof(AbpMessageServiceApplicationContractsModule), diff --git a/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/event-bus-cap.db b/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/event-bus-cap.db index acb7dba57a2f793fc60509ac4dd4693593bdf51a..82cd869b882d713c5ff0180bb83d1d8bebf2db37 100644 GIT binary patch literal 40960 zcmeHQTWlOx8D2ZCo5XRPZZAmzk!7XQRJAAPGUuF`l_1$V#%slKT*s+Mk%%|;)Y;at zU3={`s)8t8npRw@K2#tfQ3)WK2QJ!`G)vuF0qKi_=wpWA;q_xNO~>}8%>S-Vm!XL#yRs;4J)GLuQAdUz_8+K=}> zyzj!h7wHwX7i6t zj%DT=>gF=X_GdD46AN>hOQprqayc_~b~ZD0esXeHfBuBGwq9CUp37_&*XA!5*N!pr zNaobom-6Q)gQGH|XD26h<5Oox^XJC=FHIG%c=g}FSE`N19X`6UT=tgBbD5=;<;Al1 zT-k4A#w)Lty!E*ZWI9G^<5~S9@(T+d#9kjV_7oEee9D8oHwC1hn(QI@;z1;pm z=gP(M#(JZ;c6({3XC}_%XD(z;k6p+d)380V{}H#Z|L~cIds3z41@F1_XO}RoyI9;P zulVJQ4RBwi4aK`&R6Tbee(0f|muPekXS{i@v>DvO>i@l4?_jm6`!~=g?ID>PUt8H& zZMxz0SSSCci}qI-chgmG|KZaQwY%xnI~3gWYH1I2%3iHk2KBE)nB;#(|Mb1m_eyV0 zf7JBa`$7LbFYKW&eP!?H=+X4d8$bKnseh$5>Ey)J_=WRRR(`cKjtAgs@tQTZiKpnX zjdlImV(=Lrt*1(hqnC@zi=JP7s#q@8zA{o+Sub0g^!aSTD=y$s&*q-bf}kVw#igZ7 z#rbDOmhmWObITh`OT&J}mG#Au(n2?cIpv%PnXMfXd@cKb2wB%y`PwRE z$ez9Qv^QT4KVQeC>W3bmLk@DBlH*KdsLD~9vsLC%;^YVkkDXsxTiZ@(|Cn{}S+rOE zn!eOU&1`(O6|(I0;p`K|r42~%d={vBvo&c(C>dd5wknNf6UMpgMndIRS0^-vvt#FG zNAlCtkn@aJzPzG8JF~J-dg>ZJ2`@L7o$+Q?Hp*W1`gL&TcbW{9iT(riq$sEVJ^roL zWRSvD#F0!AY7^)UX@~bfgZbf;f*xli14amvqoNHdS_s`?QqU1bW~*;X)A_Rncmdw74s5!Q{D(`FYPn|5=&90^`8dfKC^D9dqOK zYd>7Nl?Xa8*S!#mL+}Dp6%Ahq|11fl9h<7o!DG#@AVORHBY0l@eUqfnrLf`u|ej!@c_8iJyM( z^JJ(b#i`&*2w~gGA-k@UsIS~PhCS_cQVXFwP9#co59do`aiVO8+dI-p?S?&7w$xpz z#i5dH>PA&e_i({!B_o_VEb8H~b@u%RE**JqUxK(~COIjL>*+eSVsnHU{fXOFJ*ft(xS2c0TuadUyID*!3sduuGOTXgRlB1VwhZ139 zB!J($JMw17Lxk-dr`vETM(A#FNlRl1SGbJtY&y36$UEYa-?nsZm#L_Oqk&#R6|)5A z3Uv{e^aj74{|~+A|J)qf`a_5CbMW=JpQcp;Q#1$|1PlTO0fT@+z#w1{FbEg~3<3rL zgTU<}(DO`sdf<%{w@4}rOZ2az@a@ZAC#lb&@OXMU_4=<GHR z^1UyAc3{=tseclMN0(8!+ixJ;ZN>ljbhuTfFULl~-|Wzrg9gGSYrWn7VEWZy%~9L& zA3(uhG^+0Z>%+~siUc^L#^ z5U3RPhaUf-i*{hQl7ui2ToBuJDW{Zj!sxF19l>##h5lEnkWtl%h^tAF0~T6 z!(58ukZ5TvoYZxcbBA2YFD|ZmI@nM(Moqw*C>)7@3d9F;;FKLz1>s2iD(Si|S2d?d zIR3xiNGad)GAWdD9H}UxM@WHyB)h7eB1+L5+crKPd_yRGh2J#9xR{}eW& z+o)BFbGZptI&T41WOXGD;%zDI~jeR$niF$Y9(`r zNu{IE_`@eHjb-b&Ep%tmByOY6^V=3g5~c?n4SgP}Yy`33Ldcqes*DfRsFXiiH78FD zl?cX8xIapAvAYV&k8p$G6XGbe3rwQvA0u=3s6?dYU`*^vd52wIEgoCMmtZ8WuM}au zBz0*+u%rM4Wl02Q;I&v1+Wx<<|J~H!+XGMUJBokI%OGG7FbEg~3<4if1S*9?wb2p6 z)rQ`Bi5VS9DjW>6G2WKR7-*{;!q!Fuk(k9L3{AJn+^x}(mImP-ZAG|>gzC`ZQqVR> zuqPIUN7A7rF*-t(v?#*4xlV0(R4EKKQOWo9ObnF-ql6HOfKMtJ18vnlYMUNt$H?40 zDj{l{tM9dYrwais2ip2dEf?!B+!4_jyhB>kOJ7GFUN>Z|tR0{VsQORT_(MyeOsARH|fWggKNp!lT!o5vYx^UlH2}*Dy zC9$OvN@6`@SM8IkT1mCFc=Hq7#K_z&t)!*FKD=^l#yh&e4UHGH4a)-T^4BjV1y!yk z9OS+cwWXx6tL(#H9avE31nkG#4-0_5=JiQIpfY_V)G2`(Z5T>332TbTup_ac1#4_7 zB`igE*Nhf99$ALb9CLD_jdg!3p*yTpkmHffR;7VbaqxieEJ4jFZ^>&+=hwpKQJ*5Z zU`ry^8m#;S-GVA!t8yjQ7M(gPwW-4qrA}ZUHVnv`7)rrY1av}*NF?>y)o!YeQe-om-g;1zaRCkfJ#p=rR0}-Kg9@;RdZ(;~VunkLy zi`;cd(NRc6yB(oogzgrhv^18)s8GqB?V;U1q5M-Q3>|e;7*Z zVNYP{f7SOM2}46Cgi->Azmhl%zHP|OmH-_^a*U(rYrQRtZZB5ou23qJ#sWIFv$IrM zNZ0N=i3B;RfoPQBxNYwjoXNEa#bm(_H)(_3uUaJ)EaydC?>AkY?}r1bAkKJFm<3aF zof%o!3=UO^U>0TDDJu~tbeEXrOJl(z-+@No(Jbx!>Oxa~JvgK+ja01Iuhdrcrhe{QY2@$u_1x7iWRzBl+w~z$XV~W zY-g0(>O!&|rGisPhFsMRV|3&m_p300(#stYrS$%PfA1F~`~SXIP%tlpKr00L-VBCI zeh7d{A>FhP`Gt#130jC0HacsahaN7&yQ+|C3z6;JxRGc+M&=Idqrj!jUlD|>H6~a> zxOeJ$8*d&NwXKI2F!-#qX$z{Th2>A;x^;8A!aa>t8vFG1;p9+>!av#3LtBR?!D!pg z*)Umdmme8QK2GMYP$`rK+0)@Vs&+QD+uF6oQz>fO<$4vco=QQLZ4o@-$c7&EX~zD4 zain~0)yw9pvzy^Io3?@JyRrW__W#R^-q@zMTs~DS7wdY<+oV$4tnJ4Be-C{rjGh!^ z3QNM|&3C1bv8BJVzBsa6yrLD!t<8 literal 40960 zcmeHQU2Ggz6`r*n=f`ok+5V&;(Jm`hNz{09@12=@@9ayvb=<_n*=!xBN>YhH@BnHb`0o69 zceCDIx88bG?xs`k**kOR%s1bh`*Y@=bN2D6n(yVGT3)$Y_4Af-r;*7RkL2@)kr_1% zV;{D?*aoo;U>m{~e=_lx&Hthf)6S1(|6>g8FBy02%HG^x8vW(w`|A>ofJQ(gpb^jr zXaqC@8Uc-fMj+J)yfi$x`{1ENnXjGltCttOxoX|4tX*ELtzPlwn}nh9>50f`iJ{t6t*~I3%vL-R|SdOTM?{&*m4Gmlk~Q zc|WLR+VfXx-s)@~Ivu98`K-YnrTKXeYR^}F&#ztel5+%w6VKOcE8c1e)h0VM>K*KK z*01_&tIg`#owcn@Po6GKU&x=DxR5`rU^}w!h&wcV@bsaKQCph#o?m@-5yQGm)ir-P zkS{gCeTg=SyIvBR-3K3hF!M4^?%}jI=hd!-w=n)baQhvMi~4^9ZPFQ%*%K?vYxR~J z-iUSjZ@Sa@3ftXuF))1a)PtRFdVGh%dmc+_JikZTm0j2}*$>p$ec2C&-y3>)ps0kF z&z}DdA9!()zWn5#@$m<8({KLh%g6s|T%%KymkwyhdLrob;;mc+?BU7YZQg*j#mS@p5(U znXx52%7x<6+T!BTpy2B2!dPv-P%Kc35$0Nqa^YIkvWUYA8@q&u6+VWN4VC%V>(HTa z=JM0toFDzZic3`wJ${EC$#+;d08`CDtvRpS&s#LE}Dhy{P&d!XL zDi!E?+Vih0tKUv9&)1&1j$fk7Ef%J|>E$)wE8MtY7^A;YWLTdZ-rqYU^loO-2(;YCr=7`jFCJT;gBMAI*?)$rMH=Iz4Ru?X{QM!LzqLyiM8?BYy6PG$QRtaGOyA)ih zX$uLn7s!X8&sOi zY*-}>$NU55e~=<7amlH$Y)49)?(A?Z?s)^@ZawdIO81XS)G?WZUQ3U|u`O{4b=%C9 zR%_2&fxu04mS7KE#U%{!hliDee^2&xBm3{{``JHaf1SOR{c-mD+1In@<9~O&w)wx7 zSpqF;1T+E~0gZr0KqH_L&ZfxB?ln92%+)| z2zNs8bLHPXc@K8WLRiR^-+k<-w}^2Egtu}Rzhu8NUpLf?^l#)YUjOsG5cWfO6~fP7 z{Y%{#f$(DP;?&)r`EEUU*WS-vJoTYEX7B#N;Y`lI>y`U4v$H1>9$JF1I}}21>u@9l z?y_Bx5coTWA|aTt9t?$W%5h+1aCmP#X{2-uu0#FRAB})UKqH_L&-zs7@>Vkbe;ecf&*|~M9^Lnf!20C=rYI!Q`j%7#g+y=-3!%uU zP%!}Ut)UJ2i_XN_n4AgX+G3mHY^l1FD>V_q zi`Y!W5p76PBuye5j_4;15p70VxD+gpN)49~Vbr3I6o?X&5-!Q2(~V1QlAr9&(#B+#bOh;vx`CVM{?pW6-ueEnNDOg%!Z5;gWPDvjt)q!i1-VON@6mONi=to6`N`65}SZ z5!6of)?L~XmsH){wj4AKQ2@Y%ODJ-P&AHVWmUMT-r7)J{#Zzy68*9c>!zIonVaz6Y zJW|3XQAE!)F#$nv`NnwcXyRBKrTfJtrHx4)*QUL-aNVPlCM{f8HRnLTl}bU8K)_fb zHhN2H{GS>9p@IMOM+z3_;TqO z_rv8Ti9ilE>9Dl8No-PdI;FNzF1I#H_hsCVWJO9F1pXIDf7P3t z>Da>gqS*5mokAeSc-|sv58&@^Y$_+9`l~km`F}!Sy>efZZHYo@ zropyQmvPsjmWw=(oVj9WlZqh6Bg->dWSxB-n<>5RwuP~oSR3R*!;E;3>HLm+i(Yd& zzfEmR!v!m^zO-S#f@x}Gn6wfsOqWxY#3r#V>*a$9r5=X+EDFe)8cJCNlfEueM8bcz z!!C~mVbZ~?A5f}|(*2_p5vH0*c5N$}JMWY>^rKKpoq{7J*lmPDfuItuyM{E8m3tFH zDSvDf)HgMRQm@hw;tITYloA_-RJ7d))kf)l5lU%e20akoTN16U6Dl}`Ku%!Sjoh+{ zjY5$$;ok?_He6|{s}p9ieJrpLMgm0Vj&+JQ;FH+PQQ7iY!oRn3oYN~t~A)F zwo3PfQjs<$(6ME2nT?UIJ?J@yIjLdwlMKflTfgv3u8Fq^k@1f;8mqX73rpBeL+e+$ zyV+QUamLfaEI4RYW@IOLLoWrbACe=pZpO-Kr*xl~6=-8}0#`QajaujG^DX(2yHF}R z1ye7C;ay3U+BP&+Ar{ia`;(5at&I*<<*sH*h0*F$LMa=m5s|5oqrbp*{2h|eSW$xY z6CI6JTc!I&DW#2xob}RWy-{il*!w@-P^TFC?N^kREjgB!gqXHEvZA_fhl|uG3``zMltRO0vkV@d@X;nG4WDY>9n;KQArUPF>liWX@n|399Cc1rh)Qc4@O iOp;h)oBjU@rGit~gfd}8vy=&?f+7J2g(EjyD*ppFYS3~3 diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/AppPlatformHttpApiHostModule.cs b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/AppPlatformHttpApiHostModule.cs index 6db007483..f4a0d45ff 100644 --- a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/AppPlatformHttpApiHostModule.cs +++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/AppPlatformHttpApiHostModule.cs @@ -32,8 +32,10 @@ using Volo.Abp.BlobStoring; using Volo.Abp.BlobStoring.FileSystem; using Volo.Abp.Caching; using Volo.Abp.Caching.StackExchangeRedis; +using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.FeatureManagement.EntityFrameworkCore; +using Volo.Abp.Identity; using Volo.Abp.Localization; using Volo.Abp.Modularity; using Volo.Abp.MultiTenancy; @@ -42,16 +44,20 @@ using Volo.Abp.Security.Claims; using Volo.Abp.Security.Encryption; using Volo.Abp.SettingManagement.EntityFrameworkCore; using Volo.Abp.TenantManagement.EntityFrameworkCore; +using Volo.Abp.Threading; using Volo.Abp.VirtualFileSystem; +using Volo.Abp.Http.Client.IdentityModel; namespace LINGYUN.Platform { [DependsOn( typeof(AbpFileManagementApplicationModule), typeof(AbpFileManagementHttpApiModule), - typeof(AppPlatformApplicationModule), - typeof(AppPlatformHttpApiModule), - typeof(AppPlatformEntityFrameworkCoreModule), + typeof(PlatformApplicationModule), + typeof(PlatformHttpApiModule), + typeof(PlatformEntityFrameworkCoreModule), + typeof(AbpIdentityHttpApiClientModule), + typeof(AbpHttpClientIdentityModelModule), typeof(AbpAspNetCoreMultiTenancyModule), typeof(AbpFeatureManagementEntityFrameworkCoreModule), typeof(AbpAuditLoggingEntityFrameworkCoreModule), @@ -282,6 +288,7 @@ namespace LINGYUN.Platform public override void OnApplicationInitialization(ApplicationInitializationContext context) { var app = context.GetApplicationBuilder(); + var env = context.GetEnvironment(); app.UseForwardedHeaders(); // http调用链 @@ -312,6 +319,13 @@ namespace LINGYUN.Platform app.UseAuditing(); // 路由 app.UseConfiguredEndpoints(); + + if (env.IsDevelopment()) + { + AsyncHelper.RunSync(async () => + await app.ApplicationServices.GetRequiredService() + .SeedAsync()); + } } } } diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/LINGYUN.Platform.HttpApi.Host.csproj b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/LINGYUN.Platform.HttpApi.Host.csproj index 073b299c9..936db6c7f 100644 --- a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/LINGYUN.Platform.HttpApi.Host.csproj +++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/LINGYUN.Platform.HttpApi.Host.csproj @@ -40,6 +40,8 @@ + + diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201203105205_Add-Menu-Layout-Data-And-More-Entity.Designer.cs b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201203105205_Add-Menu-Layout-Data-And-More-Entity.Designer.cs new file mode 100644 index 000000000..063d1f977 --- /dev/null +++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201203105205_Add-Menu-Layout-Data-And-More-Entity.Designer.cs @@ -0,0 +1,637 @@ +// +using System; +using LINGYUN.Platform.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.Platform.Migrations +{ + [DbContext(typeof(PlatformHttpApiHostMigrationsDbContext))] + [Migration("20201203105205_Add-Menu-Layout-Data-And-More-Entity")] + partial class AddMenuLayoutDataAndMoreEntity + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) + .HasAnnotation("ProductVersion", "3.1.8") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("LINGYUN.Platform.Datas.Data", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .IsRequired() + .HasColumnName("Code") + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); + + b.Property("ParentId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("AppPlatformDatas"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DataId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Value") + .IsRequired() + .HasColumnName("Value") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ValueType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DataId"); + + b.HasIndex("Name"); + + b.ToTable("AppPlatformDataItems"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Layouts.Layout", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DataId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("Redirect") + .HasColumnName("Redirect") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("AppPlatformLayouts"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.Menu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Component") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("ParentId") + .HasColumnType("char(36)"); + + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("Redirect") + .HasColumnName("Redirect") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.ToTable("AppPlatformMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.RoleMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("RoleName") + .IsRequired() + .HasColumnName("RoleName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("RoleName", "MenuId"); + + b.ToTable("AppPlatformRoleMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.UserMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UserId", "MenuId"); + + b.ToTable("AppPlatformUserMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.AppVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(2048); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Title") + .IsRequired() + .HasColumnName("Title") + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("Version") + .IsRequired() + .HasColumnName("Version") + .HasColumnType("varchar(20) CHARACTER SET utf8mb4") + .HasMaxLength(20); + + b.HasKey("Id"); + + b.HasIndex("Version"); + + b.ToTable("AppPlatformVersion"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AppVersionId") + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DownloadCount") + .HasColumnType("int"); + + b.Property("FileType") + .HasColumnType("int"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("SHA256") + .IsRequired() + .HasColumnName("SHA256") + .HasColumnType("varchar(65) CHARACTER SET utf8mb4") + .HasMaxLength(65); + + b.Property("Size") + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Version") + .IsRequired() + .HasColumnName("Version") + .HasColumnType("varchar(20) CHARACTER SET utf8mb4") + .HasMaxLength(20); + + b.HasKey("Id"); + + b.HasIndex("AppVersionId"); + + b.HasIndex("Path", "Name", "Version") + .IsUnique(); + + b.ToTable("AppPlatformVersionFile"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => + { + b.HasOne("LINGYUN.Platform.Datas.Data", null) + .WithMany("Items") + .HasForeignKey("DataId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.Menu", b => + { + b.HasOne("LINGYUN.Platform.Menus.Menu", null) + .WithMany("Children") + .HasForeignKey("ParentId"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b => + { + b.HasOne("LINGYUN.Platform.Versions.AppVersion", "AppVersion") + .WithMany("Files") + .HasForeignKey("AppVersionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201203105205_Add-Menu-Layout-Data-And-More-Entity.cs b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201203105205_Add-Menu-Layout-Data-And-More-Entity.cs new file mode 100644 index 000000000..482b88e52 --- /dev/null +++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201203105205_Add-Menu-Layout-Data-And-More-Entity.cs @@ -0,0 +1,338 @@ +using System; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace LINGYUN.Platform.Migrations +{ + public partial class AddMenuLayoutDataAndMoreEntity : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AppPlatformRoleRoute"); + + migrationBuilder.DropTable( + name: "AppPlatformRoute"); + + migrationBuilder.DropTable( + name: "AppPlatformUserRoute"); + + migrationBuilder.CreateTable( + name: "AppPlatformDatas", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + LastModificationTime = table.Column(nullable: true), + LastModifierId = table.Column(nullable: true), + IsDeleted = table.Column(nullable: false, defaultValue: false), + DeleterId = table.Column(nullable: true), + DeletionTime = table.Column(nullable: true), + TenantId = table.Column(nullable: true), + Name = table.Column(maxLength: 30, nullable: false), + Code = table.Column(maxLength: 1024, nullable: false), + DisplayName = table.Column(maxLength: 128, nullable: false), + Description = table.Column(maxLength: 128, nullable: true), + ParentId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AppPlatformDatas", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AppPlatformLayouts", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + LastModificationTime = table.Column(nullable: true), + LastModifierId = table.Column(nullable: true), + IsDeleted = table.Column(nullable: false, defaultValue: false), + DeleterId = table.Column(nullable: true), + DeletionTime = table.Column(nullable: true), + TenantId = table.Column(nullable: true), + Path = table.Column(maxLength: 255, nullable: true), + Name = table.Column(maxLength: 64, nullable: false), + DisplayName = table.Column(maxLength: 128, nullable: false), + Description = table.Column(nullable: true), + Redirect = table.Column(maxLength: 255, nullable: true), + Code = table.Column(nullable: true), + PlatformType = table.Column(nullable: false), + DataId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AppPlatformLayouts", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AppPlatformMenus", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + LastModificationTime = table.Column(nullable: true), + LastModifierId = table.Column(nullable: true), + IsDeleted = table.Column(nullable: false, defaultValue: false), + DeleterId = table.Column(nullable: true), + DeletionTime = table.Column(nullable: true), + TenantId = table.Column(nullable: true), + Path = table.Column(maxLength: 255, nullable: true), + Name = table.Column(maxLength: 64, nullable: false), + DisplayName = table.Column(maxLength: 128, nullable: false), + Description = table.Column(nullable: true), + Redirect = table.Column(maxLength: 255, nullable: true), + PlatformType = table.Column(nullable: false), + Code = table.Column(nullable: true), + Component = table.Column(nullable: true), + ParentId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AppPlatformMenus", x => x.Id); + table.ForeignKey( + name: "FK_AppPlatformMenus_AppPlatformMenus_ParentId", + column: x => x.ParentId, + principalTable: "AppPlatformMenus", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "AppPlatformRoleMenus", + columns: table => new + { + Id = table.Column(nullable: false), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + LastModificationTime = table.Column(nullable: true), + LastModifierId = table.Column(nullable: true), + TenantId = table.Column(nullable: true), + MenuId = table.Column(nullable: false), + RoleName = table.Column(maxLength: 256, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AppPlatformRoleMenus", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AppPlatformUserMenus", + columns: table => new + { + Id = table.Column(nullable: false), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + LastModificationTime = table.Column(nullable: true), + LastModifierId = table.Column(nullable: true), + TenantId = table.Column(nullable: true), + MenuId = table.Column(nullable: false), + UserId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AppPlatformUserMenus", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AppPlatformDataItems", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(maxLength: 40, nullable: true), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + LastModificationTime = table.Column(nullable: true), + LastModifierId = table.Column(nullable: true), + IsDeleted = table.Column(nullable: false, defaultValue: false), + DeleterId = table.Column(nullable: true), + DeletionTime = table.Column(nullable: true), + TenantId = table.Column(nullable: true), + Name = table.Column(maxLength: 30, nullable: false), + DisplayName = table.Column(maxLength: 128, nullable: false), + Value = table.Column(maxLength: 128, nullable: false), + Description = table.Column(maxLength: 128, nullable: true), + ValueType = table.Column(nullable: false), + DataId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AppPlatformDataItems", x => x.Id); + table.ForeignKey( + name: "FK_AppPlatformDataItems_AppPlatformDatas_DataId", + column: x => x.DataId, + principalTable: "AppPlatformDatas", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_AppPlatformDataItems_DataId", + table: "AppPlatformDataItems", + column: "DataId"); + + migrationBuilder.CreateIndex( + name: "IX_AppPlatformDataItems_Name", + table: "AppPlatformDataItems", + column: "Name"); + + migrationBuilder.CreateIndex( + name: "IX_AppPlatformDatas_Name", + table: "AppPlatformDatas", + column: "Name"); + + migrationBuilder.CreateIndex( + name: "IX_AppPlatformMenus_ParentId", + table: "AppPlatformMenus", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_AppPlatformRoleMenus_RoleName_MenuId", + table: "AppPlatformRoleMenus", + columns: new[] { "RoleName", "MenuId" }); + + migrationBuilder.CreateIndex( + name: "IX_AppPlatformUserMenus_UserId_MenuId", + table: "AppPlatformUserMenus", + columns: new[] { "UserId", "MenuId" }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AppPlatformDataItems"); + + migrationBuilder.DropTable( + name: "AppPlatformLayouts"); + + migrationBuilder.DropTable( + name: "AppPlatformMenus"); + + migrationBuilder.DropTable( + name: "AppPlatformRoleMenus"); + + migrationBuilder.DropTable( + name: "AppPlatformUserMenus"); + + migrationBuilder.DropTable( + name: "AppPlatformDatas"); + + migrationBuilder.CreateTable( + name: "AppPlatformRoleRoute", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + CreationTime = table.Column(type: "datetime(6)", nullable: false), + CreatorId = table.Column(type: "char(36)", nullable: true), + DeleterId = table.Column(type: "char(36)", nullable: true), + DeletionTime = table.Column(type: "datetime(6)", nullable: true), + IsDeleted = table.Column(type: "tinyint(1)", nullable: false), + LastModificationTime = table.Column(type: "datetime(6)", nullable: true), + LastModifierId = table.Column(type: "char(36)", nullable: true), + RoleName = table.Column(type: "varchar(256) CHARACTER SET utf8mb4", maxLength: 256, nullable: false), + RouteId = table.Column(type: "char(36)", nullable: false), + TenantId = table.Column(type: "char(36)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AppPlatformRoleRoute", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AppPlatformRoute", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false), + AlwaysShow = table.Column(type: "tinyint(1)", nullable: false), + Code = table.Column(type: "varchar(95) CHARACTER SET utf8mb4", maxLength: 95, nullable: false), + ConcurrencyStamp = table.Column(type: "varchar(40) CHARACTER SET utf8mb4", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime(6)", nullable: false), + CreatorId = table.Column(type: "char(36)", nullable: true), + DeleterId = table.Column(type: "char(36)", nullable: true), + DeletionTime = table.Column(type: "datetime(6)", nullable: true), + Description = table.Column(type: "varchar(255) CHARACTER SET utf8mb4", maxLength: 255, nullable: true), + DisplayName = table.Column(type: "varchar(128) CHARACTER SET utf8mb4", maxLength: 128, nullable: false), + ExtraProperties = table.Column(type: "longtext CHARACTER SET utf8mb4", nullable: true), + FullName = table.Column(type: "varchar(128) CHARACTER SET utf8mb4", maxLength: 128, nullable: true), + Icon = table.Column(type: "varchar(128) CHARACTER SET utf8mb4", maxLength: 128, nullable: true), + IsDeleted = table.Column(type: "tinyint(1)", nullable: false, defaultValue: false), + IsMenu = table.Column(type: "tinyint(1)", nullable: false), + IsPublic = table.Column(type: "tinyint(1)", nullable: false), + IsSideBar = table.Column(type: "tinyint(1)", nullable: false), + IsStatic = table.Column(type: "tinyint(1)", nullable: false), + IsToolBar = table.Column(type: "tinyint(1)", nullable: false), + LastModificationTime = table.Column(type: "datetime(6)", nullable: true), + LastModifierId = table.Column(type: "char(36)", nullable: true), + LinkUrl = table.Column(type: "varchar(255) CHARACTER SET utf8mb4", maxLength: 255, nullable: false), + Name = table.Column(type: "varchar(64) CHARACTER SET utf8mb4", maxLength: 64, nullable: false), + ParentId = table.Column(type: "char(36)", nullable: true), + PlatformType = table.Column(type: "int", nullable: false), + TenantId = table.Column(type: "char(36)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AppPlatformRoute", x => x.Id); + table.ForeignKey( + name: "FK_AppPlatformRoute_AppPlatformRoute_ParentId", + column: x => x.ParentId, + principalTable: "AppPlatformRoute", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "AppPlatformUserRoute", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + CreationTime = table.Column(type: "datetime(6)", nullable: false), + CreatorId = table.Column(type: "char(36)", nullable: true), + DeleterId = table.Column(type: "char(36)", nullable: true), + DeletionTime = table.Column(type: "datetime(6)", nullable: true), + IsDeleted = table.Column(type: "tinyint(1)", nullable: false), + LastModificationTime = table.Column(type: "datetime(6)", nullable: true), + LastModifierId = table.Column(type: "char(36)", nullable: true), + RouteId = table.Column(type: "char(36)", nullable: false), + TenantId = table.Column(type: "char(36)", nullable: true), + UserId = table.Column(type: "char(36)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AppPlatformUserRoute", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_AppPlatformRoleRoute_RoleName_RouteId", + table: "AppPlatformRoleRoute", + columns: new[] { "RoleName", "RouteId" }); + + migrationBuilder.CreateIndex( + name: "IX_AppPlatformRoute_Code", + table: "AppPlatformRoute", + column: "Code"); + + migrationBuilder.CreateIndex( + name: "IX_AppPlatformRoute_ParentId", + table: "AppPlatformRoute", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_AppPlatformUserRoute_UserId_RouteId", + table: "AppPlatformUserRoute", + columns: new[] { "UserId", "RouteId" }); + } + } +} diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201204082313_Add-Data-Item-AllowBeNull-Field.Designer.cs b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201204082313_Add-Data-Item-AllowBeNull-Field.Designer.cs new file mode 100644 index 000000000..103485eb5 --- /dev/null +++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201204082313_Add-Data-Item-AllowBeNull-Field.Designer.cs @@ -0,0 +1,643 @@ +// +using System; +using LINGYUN.Platform.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.Platform.Migrations +{ + [DbContext(typeof(PlatformHttpApiHostMigrationsDbContext))] + [Migration("20201204082313_Add-Data-Item-AllowBeNull-Field")] + partial class AddDataItemAllowBeNullField + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) + .HasAnnotation("ProductVersion", "3.1.8") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("LINGYUN.Platform.Datas.Data", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .IsRequired() + .HasColumnName("Code") + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); + + b.Property("ParentId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("AppPlatformDatas"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllowBeNull") + .HasColumnType("tinyint(1)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DataId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Value") + .IsRequired() + .HasColumnName("Value") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ValueType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DataId"); + + b.HasIndex("Name"); + + b.ToTable("AppPlatformDataItems"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Layouts.Layout", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DataId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("Redirect") + .HasColumnName("Redirect") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("AppPlatformLayouts"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.Menu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Component") + .IsRequired() + .HasColumnName("Component") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("ParentId") + .HasColumnType("char(36)"); + + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("Redirect") + .HasColumnName("Redirect") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.ToTable("AppPlatformMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.RoleMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("RoleName") + .IsRequired() + .HasColumnName("RoleName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("RoleName", "MenuId"); + + b.ToTable("AppPlatformRoleMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.UserMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UserId", "MenuId"); + + b.ToTable("AppPlatformUserMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.AppVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(2048); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Title") + .IsRequired() + .HasColumnName("Title") + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("Version") + .IsRequired() + .HasColumnName("Version") + .HasColumnType("varchar(20) CHARACTER SET utf8mb4") + .HasMaxLength(20); + + b.HasKey("Id"); + + b.HasIndex("Version"); + + b.ToTable("AppPlatformVersion"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AppVersionId") + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DownloadCount") + .HasColumnType("int"); + + b.Property("FileType") + .HasColumnType("int"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("SHA256") + .IsRequired() + .HasColumnName("SHA256") + .HasColumnType("varchar(65) CHARACTER SET utf8mb4") + .HasMaxLength(65); + + b.Property("Size") + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Version") + .IsRequired() + .HasColumnName("Version") + .HasColumnType("varchar(20) CHARACTER SET utf8mb4") + .HasMaxLength(20); + + b.HasKey("Id"); + + b.HasIndex("AppVersionId"); + + b.HasIndex("Path", "Name", "Version") + .IsUnique(); + + b.ToTable("AppPlatformVersionFile"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => + { + b.HasOne("LINGYUN.Platform.Datas.Data", null) + .WithMany("Items") + .HasForeignKey("DataId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.Menu", b => + { + b.HasOne("LINGYUN.Platform.Menus.Menu", null) + .WithMany("Children") + .HasForeignKey("ParentId"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b => + { + b.HasOne("LINGYUN.Platform.Versions.AppVersion", "AppVersion") + .WithMany("Files") + .HasForeignKey("AppVersionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201204082313_Add-Data-Item-AllowBeNull-Field.cs b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201204082313_Add-Data-Item-AllowBeNull-Field.cs new file mode 100644 index 000000000..a2a963fd0 --- /dev/null +++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201204082313_Add-Data-Item-AllowBeNull-Field.cs @@ -0,0 +1,40 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace LINGYUN.Platform.Migrations +{ + public partial class AddDataItemAllowBeNullField : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "Component", + table: "AppPlatformMenus", + maxLength: 255, + nullable: false, + oldClrType: typeof(string), + oldType: "longtext CHARACTER SET utf8mb4", + oldNullable: true); + + migrationBuilder.AddColumn( + name: "AllowBeNull", + table: "AppPlatformDataItems", + nullable: false, + defaultValue: false); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "AllowBeNull", + table: "AppPlatformDataItems"); + + migrationBuilder.AlterColumn( + name: "Component", + table: "AppPlatformMenus", + type: "longtext CHARACTER SET utf8mb4", + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 255); + } + } +} diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201204083250_Data-Description-Field-Allow-Be-Long.Designer.cs b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201204083250_Data-Description-Field-Allow-Be-Long.Designer.cs new file mode 100644 index 000000000..643bc76f4 --- /dev/null +++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201204083250_Data-Description-Field-Allow-Be-Long.Designer.cs @@ -0,0 +1,645 @@ +// +using System; +using LINGYUN.Platform.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.Platform.Migrations +{ + [DbContext(typeof(PlatformHttpApiHostMigrationsDbContext))] + [Migration("20201204083250_Data-Description-Field-Allow-Be-Long")] + partial class DataDescriptionFieldAllowBeLong + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) + .HasAnnotation("ProductVersion", "3.1.8") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("LINGYUN.Platform.Datas.Data", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .IsRequired() + .HasColumnName("Code") + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); + + b.Property("ParentId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("AppPlatformDatas"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllowBeNull") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(true); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DataId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Value") + .IsRequired() + .HasColumnName("Value") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ValueType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DataId"); + + b.HasIndex("Name"); + + b.ToTable("AppPlatformDataItems"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Layouts.Layout", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DataId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("Redirect") + .HasColumnName("Redirect") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("AppPlatformLayouts"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.Menu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Component") + .IsRequired() + .HasColumnName("Component") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("ParentId") + .HasColumnType("char(36)"); + + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("Redirect") + .HasColumnName("Redirect") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.ToTable("AppPlatformMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.RoleMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("RoleName") + .IsRequired() + .HasColumnName("RoleName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("RoleName", "MenuId"); + + b.ToTable("AppPlatformRoleMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.UserMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UserId", "MenuId"); + + b.ToTable("AppPlatformUserMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.AppVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(2048); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Title") + .IsRequired() + .HasColumnName("Title") + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("Version") + .IsRequired() + .HasColumnName("Version") + .HasColumnType("varchar(20) CHARACTER SET utf8mb4") + .HasMaxLength(20); + + b.HasKey("Id"); + + b.HasIndex("Version"); + + b.ToTable("AppPlatformVersion"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AppVersionId") + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DownloadCount") + .HasColumnType("int"); + + b.Property("FileType") + .HasColumnType("int"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("SHA256") + .IsRequired() + .HasColumnName("SHA256") + .HasColumnType("varchar(65) CHARACTER SET utf8mb4") + .HasMaxLength(65); + + b.Property("Size") + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Version") + .IsRequired() + .HasColumnName("Version") + .HasColumnType("varchar(20) CHARACTER SET utf8mb4") + .HasMaxLength(20); + + b.HasKey("Id"); + + b.HasIndex("AppVersionId"); + + b.HasIndex("Path", "Name", "Version") + .IsUnique(); + + b.ToTable("AppPlatformVersionFile"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => + { + b.HasOne("LINGYUN.Platform.Datas.Data", null) + .WithMany("Items") + .HasForeignKey("DataId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.Menu", b => + { + b.HasOne("LINGYUN.Platform.Menus.Menu", null) + .WithMany("Children") + .HasForeignKey("ParentId"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b => + { + b.HasOne("LINGYUN.Platform.Versions.AppVersion", "AppVersion") + .WithMany("Files") + .HasForeignKey("AppVersionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201204083250_Data-Description-Field-Allow-Be-Long.cs b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201204083250_Data-Description-Field-Allow-Be-Long.cs new file mode 100644 index 000000000..f143e72aa --- /dev/null +++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201204083250_Data-Description-Field-Allow-Be-Long.cs @@ -0,0 +1,69 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace LINGYUN.Platform.Migrations +{ + public partial class DataDescriptionFieldAllowBeLong : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "Description", + table: "AppPlatformDatas", + maxLength: 1024, + nullable: true, + oldClrType: typeof(string), + oldType: "varchar(128) CHARACTER SET utf8mb4", + oldMaxLength: 128, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Description", + table: "AppPlatformDataItems", + maxLength: 1024, + nullable: true, + oldClrType: typeof(string), + oldType: "varchar(128) CHARACTER SET utf8mb4", + oldMaxLength: 128, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "AllowBeNull", + table: "AppPlatformDataItems", + nullable: false, + defaultValue: true, + oldClrType: typeof(bool), + oldType: "tinyint(1)"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "Description", + table: "AppPlatformDatas", + type: "varchar(128) CHARACTER SET utf8mb4", + maxLength: 128, + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 1024, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Description", + table: "AppPlatformDataItems", + type: "varchar(128) CHARACTER SET utf8mb4", + maxLength: 128, + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 1024, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "AllowBeNull", + table: "AppPlatformDataItems", + type: "tinyint(1)", + nullable: false, + oldClrType: typeof(bool), + oldDefaultValue: true); + } + } +} diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201204093329_Menu-Code-Limit-Length.Designer.cs b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201204093329_Menu-Code-Limit-Length.Designer.cs new file mode 100644 index 000000000..729ff54c7 --- /dev/null +++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201204093329_Menu-Code-Limit-Length.Designer.cs @@ -0,0 +1,649 @@ +// +using System; +using LINGYUN.Platform.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.Platform.Migrations +{ + [DbContext(typeof(PlatformHttpApiHostMigrationsDbContext))] + [Migration("20201204093329_Menu-Code-Limit-Length")] + partial class MenuCodeLimitLength + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) + .HasAnnotation("ProductVersion", "3.1.8") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("LINGYUN.Platform.Datas.Data", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .IsRequired() + .HasColumnName("Code") + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); + + b.Property("ParentId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("AppPlatformDatas"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllowBeNull") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(true); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DataId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Value") + .IsRequired() + .HasColumnName("Value") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ValueType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DataId"); + + b.HasIndex("Name"); + + b.ToTable("AppPlatformDataItems"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Layouts.Layout", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DataId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("Redirect") + .HasColumnName("Redirect") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("AppPlatformLayouts"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.Menu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .IsRequired() + .HasColumnName("Code") + .HasColumnType("varchar(23) CHARACTER SET utf8mb4") + .HasMaxLength(23); + + b.Property("Component") + .IsRequired() + .HasColumnName("Component") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("ParentId") + .HasColumnType("char(36)"); + + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("Redirect") + .HasColumnName("Redirect") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.ToTable("AppPlatformMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.RoleMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("RoleName") + .IsRequired() + .HasColumnName("RoleName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("RoleName", "MenuId"); + + b.ToTable("AppPlatformRoleMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.UserMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UserId", "MenuId"); + + b.ToTable("AppPlatformUserMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.AppVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(2048); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Title") + .IsRequired() + .HasColumnName("Title") + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("Version") + .IsRequired() + .HasColumnName("Version") + .HasColumnType("varchar(20) CHARACTER SET utf8mb4") + .HasMaxLength(20); + + b.HasKey("Id"); + + b.HasIndex("Version"); + + b.ToTable("AppPlatformVersion"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AppVersionId") + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DownloadCount") + .HasColumnType("int"); + + b.Property("FileType") + .HasColumnType("int"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("SHA256") + .IsRequired() + .HasColumnName("SHA256") + .HasColumnType("varchar(65) CHARACTER SET utf8mb4") + .HasMaxLength(65); + + b.Property("Size") + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Version") + .IsRequired() + .HasColumnName("Version") + .HasColumnType("varchar(20) CHARACTER SET utf8mb4") + .HasMaxLength(20); + + b.HasKey("Id"); + + b.HasIndex("AppVersionId"); + + b.HasIndex("Path", "Name", "Version") + .IsUnique(); + + b.ToTable("AppPlatformVersionFile"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => + { + b.HasOne("LINGYUN.Platform.Datas.Data", null) + .WithMany("Items") + .HasForeignKey("DataId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.Menu", b => + { + b.HasOne("LINGYUN.Platform.Menus.Menu", null) + .WithMany("Children") + .HasForeignKey("ParentId") + .OnDelete(DeleteBehavior.Restrict); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b => + { + b.HasOne("LINGYUN.Platform.Versions.AppVersion", "AppVersion") + .WithMany("Files") + .HasForeignKey("AppVersionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201204093329_Menu-Code-Limit-Length.cs b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201204093329_Menu-Code-Limit-Length.cs new file mode 100644 index 000000000..6155be9c7 --- /dev/null +++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201204093329_Menu-Code-Limit-Length.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace LINGYUN.Platform.Migrations +{ + public partial class MenuCodeLimitLength : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "Code", + table: "AppPlatformMenus", + maxLength: 23, + nullable: false, + oldClrType: typeof(string), + oldType: "longtext CHARACTER SET utf8mb4", + oldNullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "Code", + table: "AppPlatformMenus", + type: "longtext CHARACTER SET utf8mb4", + nullable: true, + oldClrType: typeof(string), + oldMaxLength: 23); + } + } +} diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201208082630_Remove-Menu-Children.Designer.cs b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201208082630_Remove-Menu-Children.Designer.cs new file mode 100644 index 000000000..f9b25e086 --- /dev/null +++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201208082630_Remove-Menu-Children.Designer.cs @@ -0,0 +1,639 @@ +// +using System; +using LINGYUN.Platform.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.Platform.Migrations +{ + [DbContext(typeof(PlatformHttpApiHostMigrationsDbContext))] + [Migration("20201208082630_Remove-Menu-Children")] + partial class RemoveMenuChildren + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) + .HasAnnotation("ProductVersion", "3.1.8") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("LINGYUN.Platform.Datas.Data", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .IsRequired() + .HasColumnName("Code") + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); + + b.Property("ParentId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("AppPlatformDatas"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllowBeNull") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(true); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DataId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Value") + .IsRequired() + .HasColumnName("Value") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ValueType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DataId"); + + b.HasIndex("Name"); + + b.ToTable("AppPlatformDataItems"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Layouts.Layout", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DataId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("Redirect") + .HasColumnName("Redirect") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("AppPlatformLayouts"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.Menu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .IsRequired() + .HasColumnName("Code") + .HasColumnType("varchar(23) CHARACTER SET utf8mb4") + .HasMaxLength(23); + + b.Property("Component") + .IsRequired() + .HasColumnName("Component") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("ParentId") + .HasColumnType("char(36)"); + + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("Redirect") + .HasColumnName("Redirect") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("AppPlatformMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.RoleMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("RoleName") + .IsRequired() + .HasColumnName("RoleName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("RoleName", "MenuId"); + + b.ToTable("AppPlatformRoleMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.UserMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UserId", "MenuId"); + + b.ToTable("AppPlatformUserMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.AppVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(2048); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Title") + .IsRequired() + .HasColumnName("Title") + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("Version") + .IsRequired() + .HasColumnName("Version") + .HasColumnType("varchar(20) CHARACTER SET utf8mb4") + .HasMaxLength(20); + + b.HasKey("Id"); + + b.HasIndex("Version"); + + b.ToTable("AppPlatformVersion"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AppVersionId") + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DownloadCount") + .HasColumnType("int"); + + b.Property("FileType") + .HasColumnType("int"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("SHA256") + .IsRequired() + .HasColumnName("SHA256") + .HasColumnType("varchar(65) CHARACTER SET utf8mb4") + .HasMaxLength(65); + + b.Property("Size") + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Version") + .IsRequired() + .HasColumnName("Version") + .HasColumnType("varchar(20) CHARACTER SET utf8mb4") + .HasMaxLength(20); + + b.HasKey("Id"); + + b.HasIndex("AppVersionId"); + + b.HasIndex("Path", "Name", "Version") + .IsUnique(); + + b.ToTable("AppPlatformVersionFile"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => + { + b.HasOne("LINGYUN.Platform.Datas.Data", null) + .WithMany("Items") + .HasForeignKey("DataId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b => + { + b.HasOne("LINGYUN.Platform.Versions.AppVersion", "AppVersion") + .WithMany("Files") + .HasForeignKey("AppVersionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201208082630_Remove-Menu-Children.cs b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201208082630_Remove-Menu-Children.cs new file mode 100644 index 000000000..a71f4cbaf --- /dev/null +++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201208082630_Remove-Menu-Children.cs @@ -0,0 +1,34 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace LINGYUN.Platform.Migrations +{ + public partial class RemoveMenuChildren : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_AppPlatformMenus_AppPlatformMenus_ParentId", + table: "AppPlatformMenus"); + + migrationBuilder.DropIndex( + name: "IX_AppPlatformMenus_ParentId", + table: "AppPlatformMenus"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateIndex( + name: "IX_AppPlatformMenus_ParentId", + table: "AppPlatformMenus", + column: "ParentId"); + + migrationBuilder.AddForeignKey( + name: "FK_AppPlatformMenus_AppPlatformMenus_ParentId", + table: "AppPlatformMenus", + column: "ParentId", + principalTable: "AppPlatformMenus", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + } +} diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201219031303_Rename-Data-Item-Value-To-DefaultValue.Designer.cs b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201219031303_Rename-Data-Item-Value-To-DefaultValue.Designer.cs new file mode 100644 index 000000000..e1b3a780f --- /dev/null +++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201219031303_Rename-Data-Item-Value-To-DefaultValue.Designer.cs @@ -0,0 +1,638 @@ +// +using System; +using LINGYUN.Platform.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.Platform.Migrations +{ + [DbContext(typeof(PlatformHttpApiHostMigrationsDbContext))] + [Migration("20201219031303_Rename-Data-Item-Value-To-DefaultValue")] + partial class RenameDataItemValueToDefaultValue + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) + .HasAnnotation("ProductVersion", "3.1.8") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("LINGYUN.Platform.Datas.Data", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .IsRequired() + .HasColumnName("Code") + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); + + b.Property("ParentId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("AppPlatformDatas"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllowBeNull") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(true); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DataId") + .HasColumnType("char(36)"); + + b.Property("DefaultValue") + .HasColumnName("DefaultValue") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("ValueType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DataId"); + + b.HasIndex("Name"); + + b.ToTable("AppPlatformDataItems"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Layouts.Layout", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DataId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("Redirect") + .HasColumnName("Redirect") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("AppPlatformLayouts"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.Menu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .IsRequired() + .HasColumnName("Code") + .HasColumnType("varchar(23) CHARACTER SET utf8mb4") + .HasMaxLength(23); + + b.Property("Component") + .IsRequired() + .HasColumnName("Component") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("ParentId") + .HasColumnType("char(36)"); + + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("Redirect") + .HasColumnName("Redirect") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("AppPlatformMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.RoleMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("RoleName") + .IsRequired() + .HasColumnName("RoleName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("RoleName", "MenuId"); + + b.ToTable("AppPlatformRoleMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.UserMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UserId", "MenuId"); + + b.ToTable("AppPlatformUserMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.AppVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(2048); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Title") + .IsRequired() + .HasColumnName("Title") + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("Version") + .IsRequired() + .HasColumnName("Version") + .HasColumnType("varchar(20) CHARACTER SET utf8mb4") + .HasMaxLength(20); + + b.HasKey("Id"); + + b.HasIndex("Version"); + + b.ToTable("AppPlatformVersion"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AppVersionId") + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DownloadCount") + .HasColumnType("int"); + + b.Property("FileType") + .HasColumnType("int"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("SHA256") + .IsRequired() + .HasColumnName("SHA256") + .HasColumnType("varchar(65) CHARACTER SET utf8mb4") + .HasMaxLength(65); + + b.Property("Size") + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Version") + .IsRequired() + .HasColumnName("Version") + .HasColumnType("varchar(20) CHARACTER SET utf8mb4") + .HasMaxLength(20); + + b.HasKey("Id"); + + b.HasIndex("AppVersionId"); + + b.HasIndex("Path", "Name", "Version") + .IsUnique(); + + b.ToTable("AppPlatformVersionFile"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => + { + b.HasOne("LINGYUN.Platform.Datas.Data", null) + .WithMany("Items") + .HasForeignKey("DataId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b => + { + b.HasOne("LINGYUN.Platform.Versions.AppVersion", "AppVersion") + .WithMany("Files") + .HasForeignKey("AppVersionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201219031303_Rename-Data-Item-Value-To-DefaultValue.cs b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201219031303_Rename-Data-Item-Value-To-DefaultValue.cs new file mode 100644 index 000000000..dca448a80 --- /dev/null +++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201219031303_Rename-Data-Item-Value-To-DefaultValue.cs @@ -0,0 +1,35 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace LINGYUN.Platform.Migrations +{ + public partial class RenameDataItemValueToDefaultValue : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Value", + table: "AppPlatformDataItems"); + + migrationBuilder.AddColumn( + name: "DefaultValue", + table: "AppPlatformDataItems", + maxLength: 128, + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "DefaultValue", + table: "AppPlatformDataItems"); + + migrationBuilder.AddColumn( + name: "Value", + table: "AppPlatformDataItems", + type: "varchar(128) CHARACTER SET utf8mb4", + maxLength: 128, + nullable: false, + defaultValue: ""); + } + } +} diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201219092956_Add-Layout-Id-Column-To-Menu.Designer.cs b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201219092956_Add-Layout-Id-Column-To-Menu.Designer.cs new file mode 100644 index 000000000..da24916ef --- /dev/null +++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201219092956_Add-Layout-Id-Column-To-Menu.Designer.cs @@ -0,0 +1,641 @@ +// +using System; +using LINGYUN.Platform.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.Platform.Migrations +{ + [DbContext(typeof(PlatformHttpApiHostMigrationsDbContext))] + [Migration("20201219092956_Add-Layout-Id-Column-To-Menu")] + partial class AddLayoutIdColumnToMenu + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) + .HasAnnotation("ProductVersion", "3.1.8") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("LINGYUN.Platform.Datas.Data", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .IsRequired() + .HasColumnName("Code") + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); + + b.Property("ParentId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("AppPlatformDatas"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllowBeNull") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(true); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DataId") + .HasColumnType("char(36)"); + + b.Property("DefaultValue") + .HasColumnName("DefaultValue") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("ValueType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DataId"); + + b.HasIndex("Name"); + + b.ToTable("AppPlatformDataItems"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Layouts.Layout", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DataId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("Redirect") + .HasColumnName("Redirect") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("AppPlatformLayouts"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.Menu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .IsRequired() + .HasColumnName("Code") + .HasColumnType("varchar(23) CHARACTER SET utf8mb4") + .HasMaxLength(23); + + b.Property("Component") + .IsRequired() + .HasColumnName("Component") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("LayoutId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("ParentId") + .HasColumnType("char(36)"); + + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("Redirect") + .HasColumnName("Redirect") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("AppPlatformMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.RoleMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("RoleName") + .IsRequired() + .HasColumnName("RoleName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("RoleName", "MenuId"); + + b.ToTable("AppPlatformRoleMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.UserMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UserId", "MenuId"); + + b.ToTable("AppPlatformUserMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.AppVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(2048); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Title") + .IsRequired() + .HasColumnName("Title") + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("Version") + .IsRequired() + .HasColumnName("Version") + .HasColumnType("varchar(20) CHARACTER SET utf8mb4") + .HasMaxLength(20); + + b.HasKey("Id"); + + b.HasIndex("Version"); + + b.ToTable("AppPlatformVersion"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AppVersionId") + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DownloadCount") + .HasColumnType("int"); + + b.Property("FileType") + .HasColumnType("int"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("SHA256") + .IsRequired() + .HasColumnName("SHA256") + .HasColumnType("varchar(65) CHARACTER SET utf8mb4") + .HasMaxLength(65); + + b.Property("Size") + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Version") + .IsRequired() + .HasColumnName("Version") + .HasColumnType("varchar(20) CHARACTER SET utf8mb4") + .HasMaxLength(20); + + b.HasKey("Id"); + + b.HasIndex("AppVersionId"); + + b.HasIndex("Path", "Name", "Version") + .IsUnique(); + + b.ToTable("AppPlatformVersionFile"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => + { + b.HasOne("LINGYUN.Platform.Datas.Data", null) + .WithMany("Items") + .HasForeignKey("DataId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b => + { + b.HasOne("LINGYUN.Platform.Versions.AppVersion", "AppVersion") + .WithMany("Files") + .HasForeignKey("AppVersionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201219092956_Add-Layout-Id-Column-To-Menu.cs b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201219092956_Add-Layout-Id-Column-To-Menu.cs new file mode 100644 index 000000000..1519dee5b --- /dev/null +++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201219092956_Add-Layout-Id-Column-To-Menu.cs @@ -0,0 +1,24 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace LINGYUN.Platform.Migrations +{ + public partial class AddLayoutIdColumnToMenu : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "LayoutId", + table: "AppPlatformMenus", + nullable: false, + defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "LayoutId", + table: "AppPlatformMenus"); + } + } +} diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201221061225_Add-Is-Public-Column-To-Menu.Designer.cs b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201221061225_Add-Is-Public-Column-To-Menu.Designer.cs new file mode 100644 index 000000000..5f27b7874 --- /dev/null +++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201221061225_Add-Is-Public-Column-To-Menu.Designer.cs @@ -0,0 +1,644 @@ +// +using System; +using LINGYUN.Platform.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.Platform.Migrations +{ + [DbContext(typeof(PlatformHttpApiHostMigrationsDbContext))] + [Migration("20201221061225_Add-Is-Public-Column-To-Menu")] + partial class AddIsPublicColumnToMenu + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) + .HasAnnotation("ProductVersion", "3.1.8") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("LINGYUN.Platform.Datas.Data", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .IsRequired() + .HasColumnName("Code") + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); + + b.Property("ParentId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("AppPlatformDatas"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllowBeNull") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(true); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DataId") + .HasColumnType("char(36)"); + + b.Property("DefaultValue") + .HasColumnName("DefaultValue") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("ValueType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DataId"); + + b.HasIndex("Name"); + + b.ToTable("AppPlatformDataItems"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Layouts.Layout", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DataId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("Redirect") + .HasColumnName("Redirect") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("AppPlatformLayouts"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.Menu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .IsRequired() + .HasColumnName("Code") + .HasColumnType("varchar(23) CHARACTER SET utf8mb4") + .HasMaxLength(23); + + b.Property("Component") + .IsRequired() + .HasColumnName("Component") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("IsPublic") + .HasColumnType("tinyint(1)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("LayoutId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("ParentId") + .HasColumnType("char(36)"); + + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("Redirect") + .HasColumnName("Redirect") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("AppPlatformMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.RoleMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("RoleName") + .IsRequired() + .HasColumnName("RoleName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("RoleName", "MenuId"); + + b.ToTable("AppPlatformRoleMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.UserMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UserId", "MenuId"); + + b.ToTable("AppPlatformUserMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.AppVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(2048); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Title") + .IsRequired() + .HasColumnName("Title") + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("Version") + .IsRequired() + .HasColumnName("Version") + .HasColumnType("varchar(20) CHARACTER SET utf8mb4") + .HasMaxLength(20); + + b.HasKey("Id"); + + b.HasIndex("Version"); + + b.ToTable("AppPlatformVersion"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AppVersionId") + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DownloadCount") + .HasColumnType("int"); + + b.Property("FileType") + .HasColumnType("int"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("SHA256") + .IsRequired() + .HasColumnName("SHA256") + .HasColumnType("varchar(65) CHARACTER SET utf8mb4") + .HasMaxLength(65); + + b.Property("Size") + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Version") + .IsRequired() + .HasColumnName("Version") + .HasColumnType("varchar(20) CHARACTER SET utf8mb4") + .HasMaxLength(20); + + b.HasKey("Id"); + + b.HasIndex("AppVersionId"); + + b.HasIndex("Path", "Name", "Version") + .IsUnique(); + + b.ToTable("AppPlatformVersionFile"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => + { + b.HasOne("LINGYUN.Platform.Datas.Data", null) + .WithMany("Items") + .HasForeignKey("DataId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b => + { + b.HasOne("LINGYUN.Platform.Versions.AppVersion", "AppVersion") + .WithMany("Files") + .HasForeignKey("AppVersionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201221061225_Add-Is-Public-Column-To-Menu.cs b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201221061225_Add-Is-Public-Column-To-Menu.cs new file mode 100644 index 000000000..89516b7f7 --- /dev/null +++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201221061225_Add-Is-Public-Column-To-Menu.cs @@ -0,0 +1,23 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace LINGYUN.Platform.Migrations +{ + public partial class AddIsPublicColumnToMenu : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "IsPublic", + table: "AppPlatformMenus", + nullable: false, + defaultValue: false); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "IsPublic", + table: "AppPlatformMenus"); + } + } +} diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/PlatformHttpApiHostMigrationsDbContextModelSnapshot.cs b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/PlatformHttpApiHostMigrationsDbContextModelSnapshot.cs index 6f8cdc429..1a1ed68fe 100644 --- a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/PlatformHttpApiHostMigrationsDbContextModelSnapshot.cs +++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/PlatformHttpApiHostMigrationsDbContextModelSnapshot.cs @@ -16,71 +16,102 @@ namespace LINGYUN.Platform.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) - .HasAnnotation("ProductVersion", "3.1.5") + .HasAnnotation("ProductVersion", "3.1.8") .HasAnnotation("Relational:MaxIdentifierLength", 64); - modelBuilder.Entity("LINGYUN.Platform.Routes.RoleRoute", b => + modelBuilder.Entity("LINGYUN.Platform.Datas.Data", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("int"); + .HasColumnType("char(36)"); + + b.Property("Code") + .IsRequired() + .HasColumnName("Code") + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); b.Property("CreationTime") + .HasColumnName("CreationTime") .HasColumnType("datetime(6)"); - b.Property("CreatorId") + b.Property("CreatorId") + .HasColumnName("CreatorId") .HasColumnType("char(36)"); - b.Property("DeleterId") + b.Property("DeleterId") + .HasColumnName("DeleterId") .HasColumnType("char(36)"); b.Property("DeletionTime") + .HasColumnName("DeletionTime") .HasColumnType("datetime(6)"); + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + b.Property("IsDeleted") - .HasColumnType("tinyint(1)"); + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") .HasColumnType("datetime(6)"); - b.Property("LastModifierId") + b.Property("LastModifierId") + .HasColumnName("LastModifierId") .HasColumnType("char(36)"); - b.Property("RoleName") + b.Property("Name") .IsRequired() - .HasColumnName("RoleName") - .HasColumnType("varchar(256) CHARACTER SET utf8mb4") - .HasMaxLength(256); + .HasColumnName("Name") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); - b.Property("RouteId") - .IsRequired() + b.Property("ParentId") .HasColumnType("char(36)"); - b.Property("TenantId") + b.Property("TenantId") .HasColumnName("TenantId") .HasColumnType("char(36)"); b.HasKey("Id"); - b.HasIndex("RoleName", "RouteId"); + b.HasIndex("Name"); - b.ToTable("AppPlatformRoleRoute"); + b.ToTable("AppPlatformDatas"); }); - modelBuilder.Entity("LINGYUN.Platform.Routes.Route", b => + modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("char(36)"); - b.Property("AlwaysShow") - .HasColumnType("tinyint(1)"); - - b.Property("Code") - .IsRequired() - .HasColumnName("Code") - .HasColumnType("varchar(95) CHARACTER SET utf8mb4") - .HasMaxLength(95); + b.Property("AllowBeNull") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(true); b.Property("ConcurrencyStamp") .IsConcurrencyToken() @@ -92,11 +123,19 @@ namespace LINGYUN.Platform.Migrations .HasColumnName("CreationTime") .HasColumnType("datetime(6)"); - b.Property("CreatorId") + b.Property("CreatorId") .HasColumnName("CreatorId") .HasColumnType("char(36)"); - b.Property("DeleterId") + b.Property("DataId") + .HasColumnType("char(36)"); + + b.Property("DefaultValue") + .HasColumnName("DefaultValue") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("DeleterId") .HasColumnName("DeleterId") .HasColumnType("char(36)"); @@ -106,8 +145,8 @@ namespace LINGYUN.Platform.Migrations b.Property("Description") .HasColumnName("Description") - .HasColumnType("varchar(255) CHARACTER SET utf8mb4") - .HasMaxLength(255); + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); b.Property("DisplayName") .IsRequired() @@ -119,50 +158,203 @@ namespace LINGYUN.Platform.Migrations .HasColumnName("ExtraProperties") .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("FullName") - .HasColumnName("FullName") - .HasColumnType("varchar(128) CHARACTER SET utf8mb4") - .HasMaxLength(128); + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("ValueType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DataId"); - b.Property("Icon") - .HasColumnName("Icon") + b.HasIndex("Name"); + + b.ToTable("AppPlatformDataItems"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Layouts.Layout", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DataId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") .HasColumnType("varchar(128) CHARACTER SET utf8mb4") .HasMaxLength(128); + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") .HasColumnType("tinyint(1)") .HasDefaultValue(false); - b.Property("IsMenu") - .HasColumnType("tinyint(1)"); + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); - b.Property("IsPublic") - .HasColumnType("tinyint(1)"); + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); - b.Property("IsSideBar") - .HasColumnType("tinyint(1)"); + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); - b.Property("IsStatic") - .HasColumnType("tinyint(1)"); + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("Redirect") + .HasColumnName("Redirect") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("AppPlatformLayouts"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.Menu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .IsRequired() + .HasColumnName("Code") + .HasColumnType("varchar(23) CHARACTER SET utf8mb4") + .HasMaxLength(23); + + b.Property("Component") + .IsRequired() + .HasColumnName("Component") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("IsToolBar") + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("IsPublic") .HasColumnType("tinyint(1)"); b.Property("LastModificationTime") .HasColumnName("LastModificationTime") .HasColumnType("datetime(6)"); - b.Property("LastModifierId") + b.Property("LastModifierId") .HasColumnName("LastModifierId") .HasColumnType("char(36)"); - b.Property("LinkUrl") - .IsRequired() - .HasColumnName("LinkUrl") - .HasColumnType("varchar(255) CHARACTER SET utf8mb4") - .HasMaxLength(255); + b.Property("LayoutId") + .HasColumnType("char(36)"); b.Property("Name") .IsRequired() @@ -170,74 +362,115 @@ namespace LINGYUN.Platform.Migrations .HasColumnType("varchar(64) CHARACTER SET utf8mb4") .HasMaxLength(64); - b.Property("ParentId") + b.Property("ParentId") .HasColumnType("char(36)"); + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + b.Property("PlatformType") .HasColumnType("int"); - b.Property("TenantId") + b.Property("Redirect") + .HasColumnName("Redirect") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("TenantId") .HasColumnName("TenantId") .HasColumnType("char(36)"); b.HasKey("Id"); - b.HasIndex("Code"); - - b.HasIndex("ParentId"); - - b.ToTable("AppPlatformRoute"); + b.ToTable("AppPlatformMenus"); }); - modelBuilder.Entity("LINGYUN.Platform.Routes.UserRoute", b => + modelBuilder.Entity("LINGYUN.Platform.Menus.RoleMenu", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("int"); + .HasColumnType("char(36)"); b.Property("CreationTime") + .HasColumnName("CreationTime") .HasColumnType("datetime(6)"); - b.Property("CreatorId") + b.Property("CreatorId") + .HasColumnName("CreatorId") .HasColumnType("char(36)"); - b.Property("DeleterId") + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") .HasColumnType("char(36)"); - b.Property("DeletionTime") + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("RoleName") + .IsRequired() + .HasColumnName("RoleName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("RoleName", "MenuId"); + + b.ToTable("AppPlatformRoleMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.UserMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") .HasColumnType("datetime(6)"); - b.Property("IsDeleted") - .HasColumnType("tinyint(1)"); + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") .HasColumnType("datetime(6)"); - b.Property("LastModifierId") + b.Property("LastModifierId") + .HasColumnName("LastModifierId") .HasColumnType("char(36)"); - b.Property("RouteId") - .IsRequired() + b.Property("MenuId") .HasColumnType("char(36)"); - b.Property("TenantId") + b.Property("TenantId") .HasColumnName("TenantId") .HasColumnType("char(36)"); - b.Property("UserId") - .IsRequired() + b.Property("UserId") .HasColumnType("char(36)"); b.HasKey("Id"); - b.HasIndex("UserId", "RouteId"); + b.HasIndex("UserId", "MenuId"); - b.ToTable("AppPlatformUserRoute"); + b.ToTable("AppPlatformUserMenus"); }); modelBuilder.Entity("LINGYUN.Platform.Versions.AppVersion", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("char(36)"); @@ -251,11 +484,11 @@ namespace LINGYUN.Platform.Migrations .HasColumnName("CreationTime") .HasColumnType("datetime(6)"); - b.Property("CreatorId") + b.Property("CreatorId") .HasColumnName("CreatorId") .HasColumnType("char(36)"); - b.Property("DeleterId") + b.Property("DeleterId") .HasColumnName("DeleterId") .HasColumnType("char(36)"); @@ -282,7 +515,7 @@ namespace LINGYUN.Platform.Migrations .HasColumnName("LastModificationTime") .HasColumnType("datetime(6)"); - b.Property("LastModifierId") + b.Property("LastModifierId") .HasColumnName("LastModifierId") .HasColumnType("char(36)"); @@ -292,7 +525,7 @@ namespace LINGYUN.Platform.Migrations b.Property("PlatformType") .HasColumnType("int"); - b.Property("TenantId") + b.Property("TenantId") .HasColumnName("TenantId") .HasColumnType("char(36)"); @@ -321,15 +554,14 @@ namespace LINGYUN.Platform.Migrations .ValueGeneratedOnAdd() .HasColumnType("int"); - b.Property("AppVersionId") - .IsRequired() + b.Property("AppVersionId") .HasColumnType("char(36)"); b.Property("CreationTime") .HasColumnName("CreationTime") .HasColumnType("datetime(6)"); - b.Property("CreatorId") + b.Property("CreatorId") .HasColumnName("CreatorId") .HasColumnType("char(36)"); @@ -343,7 +575,7 @@ namespace LINGYUN.Platform.Migrations .HasColumnName("LastModificationTime") .HasColumnType("datetime(6)"); - b.Property("LastModifierId") + b.Property("LastModifierId") .HasColumnName("LastModifierId") .HasColumnType("char(36)"); @@ -367,7 +599,7 @@ namespace LINGYUN.Platform.Migrations b.Property("Size") .HasColumnType("bigint"); - b.Property("TenantId") + b.Property("TenantId") .HasColumnName("TenantId") .HasColumnType("char(36)"); @@ -387,11 +619,13 @@ namespace LINGYUN.Platform.Migrations b.ToTable("AppPlatformVersionFile"); }); - modelBuilder.Entity("LINGYUN.Platform.Routes.Route", b => + modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => { - b.HasOne("LINGYUN.Platform.Routes.Route", null) - .WithMany() - .HasForeignKey("ParentId"); + b.HasOne("LINGYUN.Platform.Datas.Data", null) + .WithMany("Items") + .HasForeignKey("DataId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b => diff --git a/vueJs/debug.log b/vueJs/debug.log new file mode 100644 index 000000000..b7d44f1be --- /dev/null +++ b/vueJs/debug.log @@ -0,0 +1,5 @@ +[1209/172403.293:ERROR:directory_reader_win.cc(43)] FindFirstFile: ϵͳҲָ· (0x3) +[1210/084724.360:ERROR:directory_reader_win.cc(43)] FindFirstFile: ϵͳҲָ· (0x3) +[1211/094715.020:ERROR:directory_reader_win.cc(43)] FindFirstFile: ϵͳҲָ· (0x3) +[1219/155359.779:ERROR:directory_reader_win.cc(43)] FindFirstFile: ϵͳҲָ· (0x3) +[1220/155401.094:ERROR:directory_reader_win.cc(43)] FindFirstFile: ϵͳҲָ· (0x3) diff --git a/vueJs/src/api/data-dictionary.ts b/vueJs/src/api/data-dictionary.ts new file mode 100644 index 000000000..de6fb6b2a --- /dev/null +++ b/vueJs/src/api/data-dictionary.ts @@ -0,0 +1,115 @@ +import ApiService from './serviceBase' +import { urlStringify } from '@/utils/index' +import { ListResultDto, PagedResultDto, PagedAndSortedResultRequestDto } from './types' + +const sourceUrl = '/api/platform/datas' +/** 远程服务地址 */ +const serviceUrl = process.env.VUE_APP_BASE_API + +/** 数据字典api接口 */ +export default class DataDictionaryService { + public static get(id: string) { + const _url = sourceUrl + '/' + id + return ApiService.Get(_url, serviceUrl) + } + + public static getList(payload: GetDataByPaged) { + const _url = sourceUrl + '?' + urlStringify(payload) + return ApiService.Get>(_url, serviceUrl) + } + + public static getAll() { + const _url = sourceUrl + '/all' + return ApiService.Get>(_url, serviceUrl) + } + + public static create(payload: DataCreate) { + return ApiService.Post(sourceUrl, payload, serviceUrl) + } + + public static update(id: string, payload: DataUpdate) { + const _url = sourceUrl + '/' + id + return ApiService.Put(_url, payload, serviceUrl) + } + + public static delete(id: string) { + const _url = sourceUrl + '/' + id + return ApiService.Delete(_url, serviceUrl) + } + + public static appendItem(id: string, payload: DataItemCreate) { + const _url = sourceUrl + '/' + id + '/items' + return ApiService.Post(_url, payload, serviceUrl) + } + + public static updateItem(id: string, name: string, payload: DataItemUpdate) { + const _url = sourceUrl + '/' + id + '/items/' + name + return ApiService.Put(_url, payload, serviceUrl) + } + + public static removeItem(id: string, name: string) { + const _url = sourceUrl + '/' + id + '/items/' + name + return ApiService.Delete(_url, serviceUrl) + } +} + +export enum ValueType { + String = 0, + Numeic = 1, + Boolean = 2, + Date = 3, + DateTime = 4, + Array = 5 +} + +export class DataItem { + id!: string + name!: string + defaultValue!: string + displayName!: string + description?: string + allowBeNull!: boolean + valueType!: ValueType +} + +export class Data { + id!: string + name!: string + code!: string + displayName!: string + description?: string + parentId?: string + items = new Array() +} + +export class GetDataByPaged extends PagedAndSortedResultRequestDto { + filter = '' +} + +export class DataCreateOrUpdate { + name = '' + displayName = '' + description? = '' +} + +export class DataCreate extends DataCreateOrUpdate { + parentId?: string +} + +export class DataUpdate extends DataCreateOrUpdate { +} + +export class DataItemCreateOrUpdate { + defaultValue = '' + displayName = '' + description? = '' + allowBeNull = true + valueType = ValueType.String +} + +export class DataItemUpdate extends DataItemCreateOrUpdate { +} + +export class DataItemCreate extends DataItemCreateOrUpdate { + name = '' +} diff --git a/vueJs/src/api/layout.ts b/vueJs/src/api/layout.ts new file mode 100644 index 000000000..137c50232 --- /dev/null +++ b/vueJs/src/api/layout.ts @@ -0,0 +1,105 @@ +import ApiService from './serviceBase' +import { urlStringify } from '@/utils/index' +import { FullAuditedEntityDto, PagedResultDto, PagedAndSortedResultRequestDto } from './types' + +const sourceUrl = '/api/platform/layouts' +/** 远程服务地址 */ +const serviceUrl = process.env.VUE_APP_BASE_API + +/** 路由相关pi接口 */ +export default class LayoutService { + public static get(id: string) { + const _url = sourceUrl + '/' + id + return ApiService.Get(_url, serviceUrl) + } + + public static getList(payload: GetLayoutByPaged) { + const _url = sourceUrl + '?' + urlStringify(payload) + return ApiService.Get>(_url, serviceUrl) + } + + public static create(payload: LayoutCreate) { + return ApiService.Post(sourceUrl, payload, serviceUrl) + } + + public static update(id: string, payload: LayoutUpdate) { + const _url = sourceUrl + '/' + id + return ApiService.Put(_url, payload, serviceUrl) + } + + public static delete(id: string) { + const _url = sourceUrl + '/' + id + return ApiService.Delete(_url, serviceUrl) + } +} + +export enum PlatformType { + None = 0, + WinCe = 2, + WinForm = 4, + Desktop = WinCe | WinForm, + WebForm = 8, + WebMvc = 16, + WebMvvm = 32, + Web = WebForm | WebMvc | WebMvvm, + Android = 64, + iOS = 128, + Mobile = Android | iOS, + MiniProgram = 256, + All = Desktop | Web | Mobile | MiniProgram +} + +export const PlatformTypes = [ + { key: 'None', value: PlatformType.None }, + { key: 'WinCe', value: PlatformType.WinCe }, + { key: 'WinForm', value: PlatformType.WinForm }, + { key: 'Desktop', value: PlatformType.Desktop }, + { key: 'WebForm', value: PlatformType.WebForm }, + { key: 'WebMvc', value: PlatformType.WebMvc }, + { key: 'WebMvvm', value: PlatformType.WebMvvm }, + { key: 'Web', value: PlatformType.Web }, + { key: 'Android', value: PlatformType.Android }, + { key: 'iOS', value: PlatformType.iOS }, + { key: 'Mobile', value: PlatformType.Mobile }, + { key: 'MiniProgram', value: PlatformType.MiniProgram }, + { key: 'All', value: PlatformType.All } +] + +export class Route { + id!: string + name!: string + path!: string + displayName!: string + description?: string + redirect?: string + meta: {[key: string]: any} = {} +} + +export class Layout extends Route { + code!: string + platformType!: PlatformType + dataId!: string +} + +export class LayoutCreateOrUpdate { + name!: string + path!: string + displayName!: string + description?: string + redirect?: string + platformType!: PlatformType +} + +export class LayoutCreate extends LayoutCreateOrUpdate { + dataId!: string +} + +export class LayoutUpdate extends LayoutCreateOrUpdate { + +} + +export class GetLayoutByPaged extends PagedAndSortedResultRequestDto { + filter = '' + reverse = false + platformType?: PlatformType | null +} diff --git a/vueJs/src/api/menu.ts b/vueJs/src/api/menu.ts new file mode 100644 index 000000000..47cc43238 --- /dev/null +++ b/vueJs/src/api/menu.ts @@ -0,0 +1,110 @@ +import ApiService from './serviceBase' +import { Route, PlatformType } from './layout' +import { urlStringify } from '@/utils/index' +import { ISortedResultRequest, PagedResultDto, PagedAndSortedResultRequestDto, ListResultDto } from './types' + +const sourceUrl = '/api/platform/menus' +/** 远程服务地址 */ +const serviceUrl = process.env.VUE_APP_BASE_API + +/** 路由相关pi接口 */ +export default class MenuService { + public static get(id: string) { + const _url = sourceUrl + '/' + id + return ApiService.Get(_url, serviceUrl) + } + + public static getAll(payload: GetAllMenu) { + const _url = sourceUrl + '/all?' + urlStringify(payload) + return ApiService.Get>(_url, serviceUrl) + } + + public static getList(payload: GetMenuByPaged) { + const _url = sourceUrl + '?' + urlStringify(payload) + return ApiService.Get>(_url, serviceUrl) + } + + public static getMyMenuList(platformType: PlatformType) { + const _url = sourceUrl + '/by-current-user?platformType=' + platformType + return ApiService.Get>(_url, serviceUrl) + } + + public static getRoleMenuList(payload: GetRoleMenu) { + const _url = sourceUrl + '/by-role?' + urlStringify(payload) + return ApiService.Get>(_url, serviceUrl) + } + + public static create(payload: MenuCreate) { + return ApiService.Post(sourceUrl, payload, serviceUrl) + } + + public static update(id: string, payload: MenuUpdate) { + const _url = sourceUrl + '/' + id + return ApiService.Put(_url, payload, serviceUrl) + } + + public static delete(id: string) { + const _url = sourceUrl + '/' + id + return ApiService.Delete(_url, serviceUrl) + } + + public static setRoleMenu(payload: RoleMenu) { + const _url = sourceUrl + '/by-role' + return ApiService.Put(_url, payload,serviceUrl) + } +} + +export class MenuCreateOrUpdate { + name!: string + path!: string + component!: string + displayName!: string + description?: string + redirect?: string + isPublic!: boolean + platformType!: PlatformType + meta: {[key: string]: any} = {} +} + +export class MenuCreate extends MenuCreateOrUpdate { + layoutId!: string + parentId?: string +} + +export class MenuUpdate extends MenuCreateOrUpdate { + +} + +export class GetAllMenu implements ISortedResultRequest { + filter = '' + sorting = '' + reverse = false + parentId?: string + platformType?: PlatformType +} + +export class GetRoleMenu { + role!: string + platformType!: PlatformType +} + +export class GetMenuByPaged extends PagedAndSortedResultRequestDto { + filter = '' + reverse = false + platformType?: PlatformType +} + +export class Menu extends Route { + code!: string + layoutId!: string + component!: string + platformType!: PlatformType + parentId?: string + isPublic!: boolean + children = new Array() +} + +export class RoleMenu { + roleName!: string + menuIds = new Array() +} diff --git a/vueJs/src/components/Breadcrumb/index.vue b/vueJs/src/components/Breadcrumb/index.vue index 22f554670..a5649a942 100644 --- a/vueJs/src/components/Breadcrumb/index.vue +++ b/vueJs/src/components/Breadcrumb/index.vue @@ -11,11 +11,11 @@ {{ $t('route.' + item.meta.title) }} + >{{ routeDisplayName(item) }} {{ $t('route.' + item.meta.title) }} + >{{ routeDisplayName(item) }} @@ -32,6 +32,15 @@ import { RouteRecord, Route } from 'vue-router' export default class extends Vue { private breadcrumbs: RouteRecord[] = [] + get routeDisplayName() { + return (route: any) => { + if (route.meta.displayName) { + return route.meta.displayName + } + return this.$t('route.' + route.meta.title) + } + } + @Watch('$route') private onRouteChange(route: Route) { // if you go to the redirect page, do not update the breadcrumbs diff --git a/vueJs/src/layout/components/Sidebar/SidebarItem.vue b/vueJs/src/layout/components/Sidebar/SidebarItem.vue index 7be0eb4a7..add043c67 100644 --- a/vueJs/src/layout/components/Sidebar/SidebarItem.vue +++ b/vueJs/src/layout/components/Sidebar/SidebarItem.vue @@ -17,7 +17,11 @@ :name="theOnlyOneChild.meta.icon" /> {{ theOnlyOneChild.meta.displayName }} + {{ $t('route.' + theOnlyOneChild.meta.title) }} @@ -34,7 +38,11 @@ :name="item.meta.icon" /> {{ item.meta.displayName }} + {{ $t('route.' + item.meta.title) }} diff --git a/vueJs/src/permission.ts b/vueJs/src/permission.ts index 4a5c14ca0..87f17e146 100644 --- a/vueJs/src/permission.ts +++ b/vueJs/src/permission.ts @@ -37,6 +37,7 @@ router.beforeEach(async(to: Route, _: Route, next: any) => { UserModule.RefreshCurrentUser() await PermissionModule.GenerateRoutes() + console.log(PermissionModule.dynamicRoutes) // Dynamically add accessible routes router.addRoutes(PermissionModule.dynamicRoutes) // Hack: ensure addRoutes is complete @@ -72,5 +73,10 @@ router.afterEach((to: Route) => { NProgress.done() // set page title - document.title = getPageTitle(to.meta.title) + //document.title = getPageTitle(to.meta.title) + if (to.meta.displayName) { + document.title = to.meta.displayName + } else { + document.title = getPageTitle(to.meta.title) + } }) diff --git a/vueJs/src/router/modules/admin.ts b/vueJs/src/router/modules/admin.ts index 32eb3aa68..00802cb7e 100644 --- a/vueJs/src/router/modules/admin.ts +++ b/vueJs/src/router/modules/admin.ts @@ -70,6 +70,26 @@ const adminRouter: RouteConfig = { icon: 'claim-type', roles: ['AbpIdentity.IdentityClaimTypes'] } + }, + { + path: 'data-dictionary', + component: () => import(/* webpackChunkName: "claim-type" */ '@/views/admin/data-dictionary/index.vue'), + name: 'data-dictionary', + meta: { + title: '数据字典', + icon: 'data-dictionary', + roles: ['AbpIdentity.IdentityClaimTypes'] + } + }, + { + path: 'menus', + component: () => import(/* webpackChunkName: "claim-type" */ '@/views/admin/menus/index.vue'), + name: 'menus', + meta: { + title: '菜单', + icon: 'menus', + roles: ['AbpIdentity.IdentityClaimTypes'] + } } ] } diff --git a/vueJs/src/store/modules/permission.ts b/vueJs/src/store/modules/permission.ts index d11fdcff9..6b16518a1 100644 --- a/vueJs/src/store/modules/permission.ts +++ b/vueJs/src/store/modules/permission.ts @@ -1,8 +1,12 @@ import { VuexModule, Module, Mutation, Action, getModule } from 'vuex-module-decorators' import { RouteConfig } from 'vue-router' +//eslint-disable-next-line import { asyncRoutes, constantRoutes } from '@/router' import store from '@/store' import { AbpModule } from '@/store/modules/abp' +import MenuService, { Menu } from '@/api/menu' +import { PlatformType } from '@/api/layout' +import { generateTree } from '@/utils' const hasPermission = (roles: string[], route: RouteConfig) => { if (route.meta && route.meta.roles) { @@ -26,6 +30,45 @@ export const filterAsyncRoutes = (routes: RouteConfig[], roles: string[]) => { return res } +const filterDynamicRoutes = (menus: Menu[]) => { + const res: RouteConfig[] = [] + + menus.forEach(menu => { + const r: RouteConfig = { + path: menu.path, + name: menu.name, + redirect: menu.redirect, + // meta自行转换 + meta: { + activeMenu: menu.meta['activeMenu'], + affix: mapMetaBoolean('affix', menu.meta), // 需要转换为正确的bool类型 + noCache: mapMetaBoolean('noCache', menu.meta), + breadcrumb: mapMetaBoolean('breadcrumb', menu.meta), + alwaysShow: mapMetaBoolean('alwaysShow', menu.meta), + hidden: mapMetaBoolean('hidden', menu.meta), + icon: menu.meta['icon'], + title: menu.meta['title'], + displayName: menu.displayName, + roles: mapMetaArray('roles', menu.meta) // 需要转换为正确的array类型 + } + } + r.component = resolve => require([`@/${menu.component}`], resolve) // 需要这种格式才可以正确加载动态路由 + if (menu.children && menu.children.length > 0) { + r.children = filterDynamicRoutes(menu.children) + } + res.push(r) + }) + return res +} + +const mapMetaBoolean = (key: string, meta: any) => { + return typeof meta[key] === 'boolean' ? meta[key] : meta[key] === 'true' +} + +const mapMetaArray = (key: string, meta: any) => { + return Array.isArray(meta[key]) ? meta[key] : String(meta[key]).split(',') +} + export interface IPermissionState { routes: RouteConfig[] dynamicRoutes: RouteConfig[] @@ -69,15 +112,22 @@ class Permission extends VuexModule implements IPermissionState { @Action public async GenerateRoutes() { - await this.GetPermissions() + await this.GetPermissions() // 保留授权 // 没必要再针对admin角色授权,改成全部后台授权 // if (this.authorizedPermissions.includes('admin')) { // accessedRoutes = asyncRoutes // } else { // accessedRoutes = filterAsyncRoutes(asyncRoutes, this.authorizedPermissions) // } - const accessedRoutes = filterAsyncRoutes(asyncRoutes, this.authorizedPermissions) - this.SET_ROUTES(accessedRoutes) + + // 取消注释用来启用后端动态路由配置 + const { items } = await MenuService.getMyMenuList(PlatformType.WebMvvm) + const dynamicRoutes = filterDynamicRoutes(generateTree(items)) + this.SET_ROUTES(dynamicRoutes) + + // 取消注释用来启用前端动态路由配置 + // const accessedRoutes = filterAsyncRoutes(asyncRoutes, this.authorizedPermissions) + // this.SET_ROUTES(accessedRoutes) } @Action ResetPermissions() { diff --git a/vueJs/src/utils/index.ts b/vueJs/src/utils/index.ts index 309a364ec..0e9521efb 100644 --- a/vueJs/src/utils/index.ts +++ b/vueJs/src/utils/index.ts @@ -1,3 +1,15 @@ +/** + * 递归生成树结构 + * @param array 参与计算的对象数组 + * @param id 当前层级的父节点标识 + * @param parentIdKey 父节点名称 + */ +export function generateTree(array: any, id = null, parentIdKey = 'parentId') { + return array + .filter((item: any) => item[parentIdKey] === id) + .map((item: any) => ({...item, children: generateTree(array, item.id)})) +} + export function urlStringify(payload: any) { let urlParam = '' Object.keys(payload).forEach(key => { diff --git a/vueJs/src/views/admin/data-dictionary/components/CreateOrUpdateDataDialog.vue b/vueJs/src/views/admin/data-dictionary/components/CreateOrUpdateDataDialog.vue new file mode 100644 index 000000000..d0ca4fa4f --- /dev/null +++ b/vueJs/src/views/admin/data-dictionary/components/CreateOrUpdateDataDialog.vue @@ -0,0 +1,172 @@ + + + + + diff --git a/vueJs/src/views/admin/data-dictionary/components/CreateOrUpdateDataItemDialog.vue b/vueJs/src/views/admin/data-dictionary/components/CreateOrUpdateDataItemDialog.vue new file mode 100644 index 000000000..0044e7622 --- /dev/null +++ b/vueJs/src/views/admin/data-dictionary/components/CreateOrUpdateDataItemDialog.vue @@ -0,0 +1,238 @@ + + + + + diff --git a/vueJs/src/views/admin/data-dictionary/components/DataDictionaryTree.vue b/vueJs/src/views/admin/data-dictionary/components/DataDictionaryTree.vue new file mode 100644 index 000000000..973276d5d --- /dev/null +++ b/vueJs/src/views/admin/data-dictionary/components/DataDictionaryTree.vue @@ -0,0 +1,208 @@ + + + + + diff --git a/vueJs/src/views/admin/data-dictionary/components/DataItemTable.vue b/vueJs/src/views/admin/data-dictionary/components/DataItemTable.vue new file mode 100644 index 000000000..591da5647 --- /dev/null +++ b/vueJs/src/views/admin/data-dictionary/components/DataItemTable.vue @@ -0,0 +1,233 @@ + + + + + diff --git a/vueJs/src/views/admin/data-dictionary/index.vue b/vueJs/src/views/admin/data-dictionary/index.vue new file mode 100644 index 000000000..9dc1c71e8 --- /dev/null +++ b/vueJs/src/views/admin/data-dictionary/index.vue @@ -0,0 +1,49 @@ + + + + + diff --git a/vueJs/src/views/admin/menus/components/CreateOrUpdateMenuDialog.vue b/vueJs/src/views/admin/menus/components/CreateOrUpdateMenuDialog.vue new file mode 100644 index 000000000..b35d9b873 --- /dev/null +++ b/vueJs/src/views/admin/menus/components/CreateOrUpdateMenuDialog.vue @@ -0,0 +1,360 @@ + + + + + diff --git a/vueJs/src/views/admin/menus/components/MenuMetaInput.vue b/vueJs/src/views/admin/menus/components/MenuMetaInput.vue new file mode 100644 index 000000000..e11f31720 --- /dev/null +++ b/vueJs/src/views/admin/menus/components/MenuMetaInput.vue @@ -0,0 +1,98 @@ + + + + + diff --git a/vueJs/src/views/admin/menus/index.vue b/vueJs/src/views/admin/menus/index.vue new file mode 100644 index 000000000..ce39e8d38 --- /dev/null +++ b/vueJs/src/views/admin/menus/index.vue @@ -0,0 +1,267 @@ + + + + + diff --git a/vueJs/src/views/admin/roles/components/ManageRoleMenuDialog.vue b/vueJs/src/views/admin/roles/components/ManageRoleMenuDialog.vue new file mode 100644 index 000000000..9a24276a1 --- /dev/null +++ b/vueJs/src/views/admin/roles/components/ManageRoleMenuDialog.vue @@ -0,0 +1,169 @@ + + + + + diff --git a/vueJs/src/views/admin/roles/index.vue b/vueJs/src/views/admin/roles/index.vue index 1bba292f5..e4e6c886d 100644 --- a/vueJs/src/views/admin/roles/index.vue +++ b/vueJs/src/views/admin/roles/index.vue @@ -120,6 +120,12 @@ > {{ $t('AbpIdentity.ManageClaim') }} + + {{ $t('AppPlatform.Menu:Manage') }} + + + Date: Mon, 21 Dec 2020 18:28:09 +0800 Subject: [PATCH 2/3] add layout view --- .../LINGYUN/Platform/Layouts/Dto/LayoutDto.cs | 4 - .../Platform/Layouts/ILayoutAppService.cs | 4 +- .../Platform/Menus/Dto/MenuGetAllInput.cs | 2 + .../Platform/Menus/Dto/MenuGetListInput.cs | 2 + .../Platform/Layouts/LayoutAppService.cs | 26 +- .../LINGYUN/Platform/Menus/MenuAppService.cs | 6 +- .../LINGYUN.Platform.Domain.Shared.csproj | 4 + .../Platform/Localization/Resources/en.json | 13 +- .../Localization/Resources/zh-Hans.json | 7 +- .../Platform/Layouts/ILayoutRepository.cs | 7 +- .../LINGYUN/Platform/Layouts/Layout.cs | 9 - .../LINGYUN/Platform/Menus/IMenuRepository.cs | 3 + .../Platform/PlatformDataSeedContributor.cs | 20 +- .../Platform/Routes/IRouteDataSeeder.cs | 1 - .../Platform/Routes/RouteDataSeeder.cs | 2 - .../Layouts/EfCoreLayoutRepository.cs | 14 +- .../Platform/Menus/EfCoreMenuRepository.cs | 6 + .../Platform/Layouts/LayoutController.cs | 7 + aspnet-core/modules/platform/README.md | 24 + .../LINGYUN.ApiGateway.Host/event-bus-cap.db | Bin 40960 -> 40960 bytes ...3615_Remove-Layout-Column-Code.Designer.cs | 641 ++++++++++++++++++ ...0201221093615_Remove-Layout-Column-Code.cs | 23 + ...ApiHostMigrationsDbContextModelSnapshot.cs | 3 - vueJs/debug.log | 1 + vueJs/src/api/layout.ts | 8 +- vueJs/src/api/menu.ts | 3 + vueJs/src/router/index.ts | 5 + vueJs/src/router/modules/admin.ts | 20 - vueJs/src/router/modules/container.ts | 37 + .../components/CreateOrUpdateLayoutDialog.vue | 275 ++++++++ vueJs/src/views/container/layouts/index.vue | 237 +++++++ .../components/CreateOrUpdateMenuDialog.vue | 4 + .../menus/components/MenuMetaInput.vue | 0 .../{admin => container}/menus/index.vue | 131 ++-- 34 files changed, 1403 insertions(+), 146 deletions(-) create mode 100644 aspnet-core/modules/platform/README.md create mode 100644 aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201221093615_Remove-Layout-Column-Code.Designer.cs create mode 100644 aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201221093615_Remove-Layout-Column-Code.cs create mode 100644 vueJs/src/router/modules/container.ts create mode 100644 vueJs/src/views/container/layouts/components/CreateOrUpdateLayoutDialog.vue create mode 100644 vueJs/src/views/container/layouts/index.vue rename vueJs/src/views/{admin => container}/menus/components/CreateOrUpdateMenuDialog.vue (98%) rename vueJs/src/views/{admin => container}/menus/components/MenuMetaInput.vue (100%) rename vueJs/src/views/{admin => container}/menus/index.vue (69%) diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/LayoutDto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/LayoutDto.cs index 5e59b7547..e9357e1c0 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/LayoutDto.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/LayoutDto.cs @@ -5,10 +5,6 @@ namespace LINGYUN.Platform.Layouts { public class LayoutDto : RouteDto { - /// - /// 布局编号 - /// - public string Code { get; set; } /// /// 所属平台 /// diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/ILayoutAppService.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/ILayoutAppService.cs index 408877ac7..69dc95752 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/ILayoutAppService.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/ILayoutAppService.cs @@ -1,4 +1,6 @@ using System; +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; namespace LINGYUN.Platform.Layouts @@ -11,6 +13,6 @@ namespace LINGYUN.Platform.Layouts LayoutCreateDto, LayoutUpdateDto> { - + Task> GetAllListAsync(); } } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetAllInput.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetAllInput.cs index e9a54631a..0e8c645a2 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetAllInput.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetAllInput.cs @@ -14,5 +14,7 @@ namespace LINGYUN.Platform.Menus public Guid? ParentId { get; set; } public string Sorting { get; set; } + + public Guid? LayoutId { get; set; } } } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetListInput.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetListInput.cs index 5a86ff7b6..0c073b8e9 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetListInput.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetListInput.cs @@ -12,5 +12,7 @@ namespace LINGYUN.Platform.Menus public bool Reverse { get; set; } public Guid? ParentId { get; set; } + + public Guid? LayoutId { get; set; } } } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Layouts/LayoutAppService.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Layouts/LayoutAppService.cs index 30a289f75..1e7137616 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Layouts/LayoutAppService.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Layouts/LayoutAppService.cs @@ -1,5 +1,6 @@ using LINGYUN.Platform.Datas; using LINGYUN.Platform.Permissions; +using LINGYUN.Platform.Routes; using LINGYUN.Platform.Utils; using Microsoft.AspNetCore.Authorization; using System; @@ -13,42 +14,27 @@ namespace LINGYUN.Platform.Layouts [Authorize(PlatformPermissions.Layout.Default)] public class LayoutAppService : PlatformApplicationServiceBase, ILayoutAppService { - protected IDataRepository DataRepository { get; } protected ILayoutRepository LayoutRepository { get; } public LayoutAppService( - IDataRepository dataRepository, ILayoutRepository layoutRepository) { - DataRepository = dataRepository; LayoutRepository = layoutRepository; } [Authorize(PlatformPermissions.Layout.Create)] public virtual async Task CreateAsync(LayoutCreateDto input) { - var data = DataRepository.FindAsync(input.DataId); - if (data == null) - { - throw new UserFriendlyException($"数据字典 {input.DataId} 的不存在或已删除!"); - } - var layout = await LayoutRepository.FindByNameAsync(input.Name); if (layout != null) { throw new UserFriendlyException($"已经存在名为 {input.Name} 的布局!"); } - var lastLayout = await LayoutRepository.GetLastOrNullAsync(); - var code = lastLayout != null - ? CodeNumberGenerator.CalculateNextCode(lastLayout.Code) - : CodeNumberGenerator.CreateCode(1); - layout = new Layout( GuidGenerator.Create(), input.Path, input.Name, - code, input.DisplayName, input.DataId, input.PlatformType, @@ -83,11 +69,19 @@ namespace LINGYUN.Platform.Layouts return ObjectMapper.Map(layout); } + public virtual async Task> GetAllListAsync() + { + var layouts = await LayoutRepository.GetListAsync(); + + return new ListResultDto( + ObjectMapper.Map, List>(layouts)); + } + public virtual async Task> GetListAsync(GetLayoutListInput input) { var count = await LayoutRepository.GetCountAsync(input.PlatformType, input.Filter); - var layouts = await LayoutRepository.GetListAsync( + var layouts = await LayoutRepository.GetPagedListAsync( input.PlatformType, input.Filter, input.Sorting, input.Reverse, false, input.SkipCount, input.MaxResultCount); diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Menus/MenuAppService.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Menus/MenuAppService.cs index e3e378848..6c39a5237 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Menus/MenuAppService.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Menus/MenuAppService.cs @@ -60,7 +60,7 @@ namespace LINGYUN.Platform.Menus { var menus = await MenuRepository.GetAllAsync( input.Filter, input.Sorting, input.Reverse, - input.PlatformType, input.ParentId); + input.PlatformType, input.ParentId, input.LayoutId); return new ListResultDto( ObjectMapper.Map, List>(menus)); @@ -68,11 +68,11 @@ namespace LINGYUN.Platform.Menus public virtual async Task> GetListAsync(MenuGetListInput input) { - var count = await MenuRepository.GetCountAsync(input.Filter, input.PlatformType, input.ParentId); + var count = await MenuRepository.GetCountAsync(input.Filter, input.PlatformType, input.ParentId, input.LayoutId); var menus = await MenuRepository.GetListAsync( input.Filter, input.Sorting, input.Reverse, - input.PlatformType, input.ParentId, + input.PlatformType, input.ParentId, input.LayoutId, input.SkipCount, input.MaxResultCount); return new PagedResultDto(count, diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN.Platform.Domain.Shared.csproj b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN.Platform.Domain.Shared.csproj index 066eb3595..75b0aa691 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN.Platform.Domain.Shared.csproj +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN.Platform.Domain.Shared.csproj @@ -21,4 +21,8 @@ + + + + diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/en.json b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/en.json index 9cd1bf49a..dad8a587e 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/en.json +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/en.json @@ -28,22 +28,25 @@ "DisplayName:Component": "Component", "DisplayName:Filter": "Filter", "DisplayName:PlatformType": "Platform Type", - "DisplayName:SecrchMenu": "Secrch", + "DisplayName:SecrchMenu": "Secrch Menu", + "DisplayName:SecrchLayout": "Secrch Layout", "DisplayName:Layout": "Layout", "DisplayName:Basic": "Basic", "DisplayName:DataDictionary": "Data Dictionary", + "Layout:AddNew": "Add New", + "Layout:Edit": "Edit", + "Layout:EditByName": "Edit Layout - {0}", + "Layout:Delete": "Delete Layout", "Menu:AddNew": "Add New", "Menu:AddChildren": "Add Children", "Menu:Edit": "Edit", "Menu:EditByName": "Edit Menu - {0}", - "Menu:Delete": "Delete", - "Menu:WillDelete": "The menu {0} will be deleted", - "Data:WillDelete": "The dictionary {0} will be deleted", + "Menu:Delete": "Delete Menu", "Menu:Manage": "Manage Menus", "Data:AddNew": "Add New", "Data:AddChildren": "Add Children", "Data:Edit": "Edit", - "Data:Delete": "Delete", + "Data:Delete": "Delete Data", "Data:AppendItem": "Append Item", "Data:EditItem": "Edit Item", "Data:RemoveItem": "Remove Item", diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/zh-Hans.json b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/zh-Hans.json index f5c536e60..318540f9a 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/zh-Hans.json +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/zh-Hans.json @@ -29,17 +29,20 @@ "DisplayName:Filter": "筛选", "DisplayName:PlatformType": "平台类型", "DisplayName:SecrchMenu": "查询菜单", + "DisplayName:SecrchLayout": "查询布局", "DisplayName:Layout": "布局", "DisplayName:Basic": "基础信息", "DisplayName:DataDictionary": "数据字典", + "Layout:AddNew": "添加新布局", + "Layout:Edit": "编辑布局", + "Layout:EditByName": "编辑布局 - {0}", + "Layout:Delete": "删除布局", "Menu:AddNew": "添加新菜单", "Menu:AddChildren": "添加子菜单", "Menu:Edit": "编辑菜单", "Menu:EditByName": "编辑菜单 - {0}", "Menu:Delete": "删除菜单", - "Menu:WillDelete": "将要删除菜单 {0}", "Menu:Manage": "管理菜单", - "Data:WillDelete": "将要删除字典 {0}", "Data:AddNew": "添加新字典", "Data:AddChildren": "添加下级字典", "Data:Edit": "编辑字典", diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Layouts/ILayoutRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Layouts/ILayoutRepository.cs index 5c5604548..9f09e047b 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Layouts/ILayoutRepository.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Layouts/ILayoutRepository.cs @@ -20,18 +20,15 @@ namespace LINGYUN.Platform.Layouts bool includeDetails = true, CancellationToken cancellationToken = default); - Task GetLastOrNullAsync( - CancellationToken cancellationToken = default); - Task GetCountAsync( PlatformType? platformType = null, string filter = "", CancellationToken cancellationToken = default); - Task> GetListAsync( + Task> GetPagedListAsync( PlatformType? platformType = null, string filter = "", - string sorting = nameof(Layout.Code), + string sorting = nameof(Layout.Name), bool reverse = false, bool includeDetails = false, int skipCount = 0, diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Layouts/Layout.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Layouts/Layout.cs index 6699c22cd..32bf46ff2 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Layouts/Layout.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Layouts/Layout.cs @@ -1,7 +1,6 @@ using JetBrains.Annotations; using LINGYUN.Platform.Routes; using System; -using Volo.Abp; namespace LINGYUN.Platform.Layouts { @@ -10,10 +9,6 @@ namespace LINGYUN.Platform.Layouts /// public class Layout : Route { - /// - /// 布局编号 - /// - public virtual string Code { get; set; } /// /// 所属平台 /// @@ -29,7 +24,6 @@ namespace LINGYUN.Platform.Layouts [NotNull] Guid id, [NotNull] string path, [NotNull] string name, - [NotNull] string code, [NotNull] string displayName, [NotNull] Guid dataId, [NotNull] PlatformType platformType = PlatformType.None, @@ -38,9 +32,6 @@ namespace LINGYUN.Platform.Layouts [CanBeNull] Guid? tenantId = null) : base(id, path, name, displayName, redirect, description, tenantId) { - Check.NotNullOrWhiteSpace(code, nameof(code)); - - Code = code; DataId = dataId; PlatformType = platformType; } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IMenuRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IMenuRepository.cs index b57c0b44e..f2fdafb60 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IMenuRepository.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IMenuRepository.cs @@ -77,6 +77,7 @@ namespace LINGYUN.Platform.Menus string filter = "", PlatformType? platformType = null, Guid? parentId = null, + Guid? layoutId = null, CancellationToken cancellationToken = default); Task> GetListAsync( @@ -85,6 +86,7 @@ namespace LINGYUN.Platform.Menus bool reverse = false, PlatformType? platformType = null, Guid? parentId = null, + Guid? layoutId = null, int skipCount = 0, int maxResultCount = 10, CancellationToken cancellationToken = default); @@ -95,6 +97,7 @@ namespace LINGYUN.Platform.Menus bool reverse = false, PlatformType? platformType = null, Guid? parentId = null, + Guid? layoutId = null, CancellationToken cancellationToken = default); Task RemoveAllRolesAsync( diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDataSeedContributor.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDataSeedContributor.cs index 466feba01..c34500e6e 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDataSeedContributor.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDataSeedContributor.cs @@ -138,7 +138,6 @@ namespace LINGYUN.Platform var layout = await RouteDataSeeder.SeedLayoutAsync( "Layout", "layout/index.vue", - CodeNumberGenerator.CreateCode(1), "Vue Admin Layout", data.Id, PlatformType.WebMvvm, // 针对当前的vue管理页 @@ -567,10 +566,10 @@ namespace LINGYUN.Platform await SeedMenuAsync( layout, data, - "layout", - "layout", + "layouts", + "layouts", CodeNumberGenerator.AppendCode(containerRoot.Code, CodeNumberGenerator.CreateCode(1)), - "views/admin/layouts/index.vue", + "views/container/layouts/index.vue", "Manage Layouts", "", "Manage Layouts", @@ -578,7 +577,7 @@ namespace LINGYUN.Platform containerRoot.TenantId, new Dictionary() { - { "title", "layout" }, + { "title", "layouts" }, { "icon", "layout" } }, new string[] { "admin" }); @@ -589,7 +588,7 @@ namespace LINGYUN.Platform "menus", "menus", CodeNumberGenerator.AppendCode(containerRoot.Code, CodeNumberGenerator.CreateCode(2)), - "views/admin/menus/index.vue", + "views/container/menus/index.vue", "Manage Menus", "", "Manage Menus", @@ -718,6 +717,7 @@ namespace LINGYUN.Platform Guid? tenantId = null, Dictionary meta = null, string[] roles = null, + Guid[] users = null, bool isPublic = false ) { @@ -754,6 +754,14 @@ namespace LINGYUN.Platform } } + if (users != null) + { + foreach (var user in users) + { + await RouteDataSeeder.SeedUserMenuAsync(user, menu, tenantId); + } + } + return menu; } } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/IRouteDataSeeder.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/IRouteDataSeeder.cs index 59357c51c..3faf37fb0 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/IRouteDataSeeder.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/IRouteDataSeeder.cs @@ -11,7 +11,6 @@ namespace LINGYUN.Platform.Routes Task SeedLayoutAsync( string name, string path, - string code, string displayName, Guid dataId, PlatformType platformType = PlatformType.None, diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/RouteDataSeeder.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/RouteDataSeeder.cs index a5daf80ec..f44680e3b 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/RouteDataSeeder.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/RouteDataSeeder.cs @@ -34,7 +34,6 @@ namespace LINGYUN.Platform.Routes public virtual async Task SeedLayoutAsync( string name, string path, - string code, string displayName, Guid dataId, PlatformType platformType = PlatformType.None, @@ -50,7 +49,6 @@ namespace LINGYUN.Platform.Routes GuidGenerator.Create(), path, name, - code, displayName, dataId, platformType, diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Layouts/EfCoreLayoutRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Layouts/EfCoreLayoutRepository.cs index 3d0abf5db..903dd8e65 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Layouts/EfCoreLayoutRepository.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Layouts/EfCoreLayoutRepository.cs @@ -42,25 +42,17 @@ namespace LINGYUN.Platform.Layouts .CountAsync(GetCancellationToken(cancellationToken)); } - public virtual async Task GetLastOrNullAsync( - CancellationToken cancellationToken = default) - { - return await DbSet - .OrderByDescending(x => x.Code) - .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); - } - - public virtual async Task> GetListAsync( + public virtual async Task> GetPagedListAsync( PlatformType? platformType = null, string filter = "", - string sorting = "Code", + string sorting = nameof(Layout.Name), bool reverse = false, bool includeDetails = false, int skipCount = 0, int maxResultCount = 10, CancellationToken cancellationToken = default) { - sorting ??= nameof(Layout.Code); + sorting ??= nameof(Layout.Name); sorting = reverse ? sorting + " DESC" : sorting; return await DbSet diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs index 2a66d9a33..f934545e5 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs @@ -148,6 +148,7 @@ namespace LINGYUN.Platform.Menus bool reverse = false, PlatformType? platformType = null, Guid? parentId = null, + Guid? layoutId = null, CancellationToken cancellationToken = default) { sorting ??= nameof(Menu.Code); @@ -155,6 +156,7 @@ namespace LINGYUN.Platform.Menus return await DbSet .WhereIf(parentId.HasValue, x => x.ParentId == parentId) + .WhereIf(layoutId.HasValue, x => x.LayoutId == layoutId) .WhereIf(platformType.HasValue, menu => menu.PlatformType.HasFlag(platformType.Value)) .WhereIf(!filter.IsNullOrWhiteSpace(), menu => menu.Path.Contains(filter) || menu.Name.Contains(filter) || @@ -168,10 +170,12 @@ namespace LINGYUN.Platform.Menus string filter = "", PlatformType? platformType = null, Guid? parentId = null, + Guid? layoutId = null, CancellationToken cancellationToken = default) { return await DbSet .WhereIf(parentId.HasValue, x => x.ParentId == parentId) + .WhereIf(layoutId.HasValue, x => x.LayoutId == layoutId) .WhereIf(platformType.HasValue, menu => menu.PlatformType.HasFlag(platformType.Value)) .WhereIf(!filter.IsNullOrWhiteSpace(), menu => menu.Path.Contains(filter) || menu.Name.Contains(filter) || @@ -186,6 +190,7 @@ namespace LINGYUN.Platform.Menus bool reverse = false, PlatformType? platformType = null, Guid? parentId = null, + Guid? layoutId = null, int skipCount = 0, int maxResultCount = 10, CancellationToken cancellationToken = default) @@ -195,6 +200,7 @@ namespace LINGYUN.Platform.Menus return await DbSet .WhereIf(parentId.HasValue, x => x.ParentId == parentId) + .WhereIf(layoutId.HasValue, x => x.LayoutId == layoutId) .WhereIf(platformType.HasValue, menu => menu.PlatformType.HasFlag(platformType.Value)) .WhereIf(!filter.IsNullOrWhiteSpace(), menu => menu.Path.Contains(filter) || menu.Name.Contains(filter) || diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Layouts/LayoutController.cs b/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Layouts/LayoutController.cs index 789316b2a..ac7e6bd33 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Layouts/LayoutController.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Layouts/LayoutController.cs @@ -40,6 +40,13 @@ namespace LINGYUN.Platform.Layouts return await LayoutAppService.GetAsync(id); } + [HttpGet] + [Route("all")] + public virtual async Task> GetAllListAsync() + { + return await LayoutAppService.GetAllListAsync(); + } + [HttpGet] public virtual async Task> GetListAsync(GetLayoutListInput input) { diff --git a/aspnet-core/modules/platform/README.md b/aspnet-core/modules/platform/README.md new file mode 100644 index 000000000..d1bc08765 --- /dev/null +++ b/aspnet-core/modules/platform/README.md @@ -0,0 +1,24 @@ +# LINGYUN.Platform.Domain + +平台管理模块 + +#### 注意 + +> 动态菜单管理 + + ## IDataSeedContributor + 说明: 用于预置菜单数据的接口,模块默认已初始化与vue-admin相关的菜单 + + ## 其他注意事项 + 不论是布局(path)还是菜单(component),都不需要添加 @/ 的前缀(这通常在前端定义路由时需要),因为前端不支持这样的形式 + + +## 配置使用 + + +```csharp +[DependsOn(typeof(PlatformDomainModule))] +public class YouProjectModule : AbpModule +{ + // other +} diff --git a/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/event-bus-cap.db b/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/event-bus-cap.db index 82cd869b882d713c5ff0180bb83d1d8bebf2db37..dc066d37fec461d90669698c4d938b7f2fe9c2fb 100644 GIT binary patch delta 229 zcmZoTz|?SnX@WGP=|mZ4M$?T6OZeFsdABg|ZrRKwu!>i##gmbTO|X&Kuq~Ry*;!s_ z4)1{_OBE(JMz;!@7+9JaS{hgyT38wyn;Bb}Ois+J=Q1)>Fto5TFtak5Jh4@pA5GEZ z_^t?1BV8lI5U3(^Ju@>i3o|qG$&K-zjtI@>dO%Z6jLa;I42%qP4S`yWVCGurnOj(x tn;4h`mnJ8trlzE(a4|42F!Fz4;Qz9jOW_qiH#ajIC)A~z|LZdr002)YJSqSH delta 217 zcmZoTz|?SnX@WGP@kAMCM&peMOZeFs1Q-}NWj1pOtl|}AU|{lL6KrHQY>Vb_c9s|F zm)K)mIoVLMi`T@$(7@Eh*wO+>noLg2tLHW}R4_ENGB&X?Hk_OoEX{9jY>2FAaza=5 zWO-Rm9*_b(Q%h4zBV)_Sjq#q7Yh~H3z=CF$CYDC#CPoHE2D*kuKm;?;NYB*R*c>Pq mT$-GmnwpZD!o>gtK!@_*+RUZ!ik} +using System; +using LINGYUN.Platform.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.Platform.Migrations +{ + [DbContext(typeof(PlatformHttpApiHostMigrationsDbContext))] + [Migration("20201221093615_Remove-Layout-Column-Code")] + partial class RemoveLayoutColumnCode + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) + .HasAnnotation("ProductVersion", "3.1.8") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("LINGYUN.Platform.Datas.Data", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .IsRequired() + .HasColumnName("Code") + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); + + b.Property("ParentId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("AppPlatformDatas"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllowBeNull") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(true); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DataId") + .HasColumnType("char(36)"); + + b.Property("DefaultValue") + .HasColumnName("DefaultValue") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("ValueType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DataId"); + + b.HasIndex("Name"); + + b.ToTable("AppPlatformDataItems"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Layouts.Layout", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DataId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("Redirect") + .HasColumnName("Redirect") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("AppPlatformLayouts"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.Menu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .IsRequired() + .HasColumnName("Code") + .HasColumnType("varchar(23) CHARACTER SET utf8mb4") + .HasMaxLength(23); + + b.Property("Component") + .IsRequired() + .HasColumnName("Component") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("IsPublic") + .HasColumnType("tinyint(1)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("LayoutId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("ParentId") + .HasColumnType("char(36)"); + + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("Redirect") + .HasColumnName("Redirect") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("AppPlatformMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.RoleMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("RoleName") + .IsRequired() + .HasColumnName("RoleName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("RoleName", "MenuId"); + + b.ToTable("AppPlatformRoleMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.UserMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UserId", "MenuId"); + + b.ToTable("AppPlatformUserMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.AppVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(2048); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Title") + .IsRequired() + .HasColumnName("Title") + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("Version") + .IsRequired() + .HasColumnName("Version") + .HasColumnType("varchar(20) CHARACTER SET utf8mb4") + .HasMaxLength(20); + + b.HasKey("Id"); + + b.HasIndex("Version"); + + b.ToTable("AppPlatformVersion"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AppVersionId") + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DownloadCount") + .HasColumnType("int"); + + b.Property("FileType") + .HasColumnType("int"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("SHA256") + .IsRequired() + .HasColumnName("SHA256") + .HasColumnType("varchar(65) CHARACTER SET utf8mb4") + .HasMaxLength(65); + + b.Property("Size") + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Version") + .IsRequired() + .HasColumnName("Version") + .HasColumnType("varchar(20) CHARACTER SET utf8mb4") + .HasMaxLength(20); + + b.HasKey("Id"); + + b.HasIndex("AppVersionId"); + + b.HasIndex("Path", "Name", "Version") + .IsUnique(); + + b.ToTable("AppPlatformVersionFile"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => + { + b.HasOne("LINGYUN.Platform.Datas.Data", null) + .WithMany("Items") + .HasForeignKey("DataId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b => + { + b.HasOne("LINGYUN.Platform.Versions.AppVersion", "AppVersion") + .WithMany("Files") + .HasForeignKey("AppVersionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201221093615_Remove-Layout-Column-Code.cs b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201221093615_Remove-Layout-Column-Code.cs new file mode 100644 index 000000000..3dc9febef --- /dev/null +++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201221093615_Remove-Layout-Column-Code.cs @@ -0,0 +1,23 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace LINGYUN.Platform.Migrations +{ + public partial class RemoveLayoutColumnCode : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Code", + table: "AppPlatformLayouts"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Code", + table: "AppPlatformLayouts", + type: "longtext CHARACTER SET utf8mb4", + nullable: true); + } + } +} diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/PlatformHttpApiHostMigrationsDbContextModelSnapshot.cs b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/PlatformHttpApiHostMigrationsDbContextModelSnapshot.cs index 1a1ed68fe..63f721ef2 100644 --- a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/PlatformHttpApiHostMigrationsDbContextModelSnapshot.cs +++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/PlatformHttpApiHostMigrationsDbContextModelSnapshot.cs @@ -200,9 +200,6 @@ namespace LINGYUN.Platform.Migrations .ValueGeneratedOnAdd() .HasColumnType("char(36)"); - b.Property("Code") - .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("ConcurrencyStamp") .IsConcurrencyToken() .HasColumnName("ConcurrencyStamp") diff --git a/vueJs/debug.log b/vueJs/debug.log index b7d44f1be..9fd001a32 100644 --- a/vueJs/debug.log +++ b/vueJs/debug.log @@ -3,3 +3,4 @@ [1211/094715.020:ERROR:directory_reader_win.cc(43)] FindFirstFile: ϵͳҲָ· (0x3) [1219/155359.779:ERROR:directory_reader_win.cc(43)] FindFirstFile: ϵͳҲָ· (0x3) [1220/155401.094:ERROR:directory_reader_win.cc(43)] FindFirstFile: ϵͳҲָ· (0x3) +[1221/155401.113:ERROR:directory_reader_win.cc(43)] FindFirstFile: ϵͳҲָ· (0x3) diff --git a/vueJs/src/api/layout.ts b/vueJs/src/api/layout.ts index 137c50232..af8cc757a 100644 --- a/vueJs/src/api/layout.ts +++ b/vueJs/src/api/layout.ts @@ -1,6 +1,6 @@ import ApiService from './serviceBase' import { urlStringify } from '@/utils/index' -import { FullAuditedEntityDto, PagedResultDto, PagedAndSortedResultRequestDto } from './types' +import { ListResultDto, PagedResultDto, PagedAndSortedResultRequestDto } from './types' const sourceUrl = '/api/platform/layouts' /** 远程服务地址 */ @@ -13,6 +13,11 @@ export default class LayoutService { return ApiService.Get(_url, serviceUrl) } + public static getAllList() { + const _url = sourceUrl + '/all' + return ApiService.Get>(_url, serviceUrl) + } + public static getList(payload: GetLayoutByPaged) { const _url = sourceUrl + '?' + urlStringify(payload) return ApiService.Get>(_url, serviceUrl) @@ -76,7 +81,6 @@ export class Route { } export class Layout extends Route { - code!: string platformType!: PlatformType dataId!: string } diff --git a/vueJs/src/api/menu.ts b/vueJs/src/api/menu.ts index 47cc43238..dd29a114a 100644 --- a/vueJs/src/api/menu.ts +++ b/vueJs/src/api/menu.ts @@ -80,6 +80,7 @@ export class GetAllMenu implements ISortedResultRequest { sorting = '' reverse = false parentId?: string + layoutId?: string platformType?: PlatformType } @@ -91,6 +92,8 @@ export class GetRoleMenu { export class GetMenuByPaged extends PagedAndSortedResultRequestDto { filter = '' reverse = false + layoutId?: string + parentId?: string platformType?: PlatformType } diff --git a/vueJs/src/router/index.ts b/vueJs/src/router/index.ts index 3566d6c04..0335c36cc 100644 --- a/vueJs/src/router/index.ts +++ b/vueJs/src/router/index.ts @@ -10,11 +10,15 @@ import Layout from '@/layout/index.vue' // import tableRouter from './modules/table' // import nestedRouter from './modules/nested' // import taskRouter from './modules/task' +// 就算是动态菜单,依然要在这里定义一下路径,这是为了告诉webpack哪些文件需要打包,否则会找不到页面路径 +// 当然,更好的方法是指定webpack配置 + import adminRouter from './modules/admin' import auditingRouter from './modules/auditing' import apigatewayRouter from './modules/apigateway' import identityServerRouter from './modules/identityServer' import fileManagementRouter from './modules/file-management' +import containerRouter from './modules/container' Vue.use(Router) /* @@ -164,6 +168,7 @@ export const asyncRoutes: RouteConfig[] = [ apigatewayRouter, identityServerRouter, fileManagementRouter, + containerRouter, { path: '*', component: () => import(/* webpackChunkName: "error-page-404" */ '@/views/error-page/404.vue'), diff --git a/vueJs/src/router/modules/admin.ts b/vueJs/src/router/modules/admin.ts index 00802cb7e..32eb3aa68 100644 --- a/vueJs/src/router/modules/admin.ts +++ b/vueJs/src/router/modules/admin.ts @@ -70,26 +70,6 @@ const adminRouter: RouteConfig = { icon: 'claim-type', roles: ['AbpIdentity.IdentityClaimTypes'] } - }, - { - path: 'data-dictionary', - component: () => import(/* webpackChunkName: "claim-type" */ '@/views/admin/data-dictionary/index.vue'), - name: 'data-dictionary', - meta: { - title: '数据字典', - icon: 'data-dictionary', - roles: ['AbpIdentity.IdentityClaimTypes'] - } - }, - { - path: 'menus', - component: () => import(/* webpackChunkName: "claim-type" */ '@/views/admin/menus/index.vue'), - name: 'menus', - meta: { - title: '菜单', - icon: 'menus', - roles: ['AbpIdentity.IdentityClaimTypes'] - } } ] } diff --git a/vueJs/src/router/modules/container.ts b/vueJs/src/router/modules/container.ts new file mode 100644 index 000000000..1be5469c0 --- /dev/null +++ b/vueJs/src/router/modules/container.ts @@ -0,0 +1,37 @@ +import { RouteConfig } from 'vue-router' +import Layout from '@/layout/index.vue' + +const containerRouter: RouteConfig = { + path: '/container', + component: Layout, + meta: { + title: 'container', + icon: 'container', + roles: ['Platform.Layout', 'Platform.Menus'], + alwaysShow: true + }, + children: [ + { + path: 'layouts', + component: () => import(/* webpackChunkName: "layouts" */ '@/views/container/layouts/index.vue'), + name: 'layouts', + meta: { + title: 'layouts', + icon: 'layouts', + roles: ['Platform.Layout'] + } + }, + { + path: 'menus', + component: () => import(/* webpackChunkName: "menus" */ '@/views/container/menus/index.vue'), + name: 'menus', + meta: { + title: 'menus', + icon: 'menus', + roles: ['ApiGateway.Menus'] + } + } + ] +} + +export default containerRouter diff --git a/vueJs/src/views/container/layouts/components/CreateOrUpdateLayoutDialog.vue b/vueJs/src/views/container/layouts/components/CreateOrUpdateLayoutDialog.vue new file mode 100644 index 000000000..016de8522 --- /dev/null +++ b/vueJs/src/views/container/layouts/components/CreateOrUpdateLayoutDialog.vue @@ -0,0 +1,275 @@ + + + + + diff --git a/vueJs/src/views/container/layouts/index.vue b/vueJs/src/views/container/layouts/index.vue new file mode 100644 index 000000000..593d1df51 --- /dev/null +++ b/vueJs/src/views/container/layouts/index.vue @@ -0,0 +1,237 @@ + + + + + diff --git a/vueJs/src/views/admin/menus/components/CreateOrUpdateMenuDialog.vue b/vueJs/src/views/container/menus/components/CreateOrUpdateMenuDialog.vue similarity index 98% rename from vueJs/src/views/admin/menus/components/CreateOrUpdateMenuDialog.vue rename to vueJs/src/views/container/menus/components/CreateOrUpdateMenuDialog.vue index b35d9b873..3aa84600b 100644 --- a/vueJs/src/views/admin/menus/components/CreateOrUpdateMenuDialog.vue +++ b/vueJs/src/views/container/menus/components/CreateOrUpdateMenuDialog.vue @@ -282,6 +282,10 @@ export default class CreateOrUpdateMenuDialog extends Vue { private onLayoutChanged() { const layout = this.layouts.find(x => x.id === this.layoutId) if (layout) { + if (!this.parentId) { + // 对于根菜单,自动设置组件路径为布局路径 + this.menu.component = layout.path + } DataService .get(layout.dataId) .then(res => { diff --git a/vueJs/src/views/admin/menus/components/MenuMetaInput.vue b/vueJs/src/views/container/menus/components/MenuMetaInput.vue similarity index 100% rename from vueJs/src/views/admin/menus/components/MenuMetaInput.vue rename to vueJs/src/views/container/menus/components/MenuMetaInput.vue diff --git a/vueJs/src/views/admin/menus/index.vue b/vueJs/src/views/container/menus/index.vue similarity index 69% rename from vueJs/src/views/admin/menus/index.vue rename to vueJs/src/views/container/menus/index.vue index ce39e8d38..910b15061 100644 --- a/vueJs/src/views/admin/menus/index.vue +++ b/vueJs/src/views/container/menus/index.vue @@ -1,60 +1,69 @@