├── modules ├── 01_Blog │ ├── Blog.UI │ │ ├── .env │ │ ├── .eslintrc.js │ │ ├── src │ │ │ ├── index.js │ │ │ ├── store │ │ │ │ └── index.js │ │ │ ├── api │ │ │ │ └── article.js │ │ │ └── main.js │ │ ├── .prettierrc │ │ └── .vscode │ │ │ └── settings.json │ ├── Blog.Web │ │ ├── _modules │ │ │ └── 6221_Blog │ │ │ │ └── _module.json │ │ └── Blog.Web.csproj │ └── Blog.Core │ │ ├── Application │ │ └── Article │ │ │ ├── ArticleService.cs │ │ │ └── IArticleService.cs │ │ ├── Blog.Core.csproj │ │ ├── Infrastructure │ │ ├── BlogDbContext.cs │ │ └── Repositories │ │ │ └── ArticleRepository.cs │ │ └── Domain │ │ └── Article │ │ ├── IArticleRepository.cs │ │ └── ArticleEntity.cs ├── 00_Admin │ ├── Admin.UI │ │ ├── .env │ │ ├── .env.development │ │ ├── src │ │ │ ├── api │ │ │ │ ├── dict │ │ │ │ │ ├── dto.ts │ │ │ │ │ └── index.ts │ │ │ │ ├── dictItem │ │ │ │ │ └── index.ts │ │ │ │ ├── http.ts │ │ │ │ ├── dictGroup │ │ │ │ │ └── index.ts │ │ │ │ ├── module │ │ │ │ │ └── index.ts │ │ │ │ ├── menuGroup │ │ │ │ │ └── index.ts │ │ │ │ ├── common │ │ │ │ │ └── index.ts │ │ │ │ ├── account │ │ │ │ │ └── index.ts │ │ │ │ ├── menu │ │ │ │ │ └── index.ts │ │ │ │ ├── index.ts │ │ │ │ ├── role │ │ │ │ │ └── index.ts │ │ │ │ └── authorize │ │ │ │ │ └── index.ts │ │ │ ├── types │ │ │ │ ├── mod.d.ts │ │ │ │ ├── env.d.ts │ │ │ │ ├── mkh.d.ts │ │ │ │ └── menu.ts │ │ │ ├── locales │ │ │ │ ├── lang │ │ │ │ │ ├── zh-cn │ │ │ │ │ │ └── routes.ts │ │ │ │ │ ├── en │ │ │ │ │ │ └── routes.ts │ │ │ │ │ └── th │ │ │ │ │ │ └── routes.ts │ │ │ │ └── index.ts │ │ │ ├── components │ │ │ │ ├── role-select │ │ │ │ │ └── index.vue │ │ │ │ ├── platform-select │ │ │ │ │ └── index.vue │ │ │ │ ├── module-select │ │ │ │ │ └── index.vue │ │ │ │ ├── enum-radio │ │ │ │ │ └── index.vue │ │ │ │ ├── enum-checkbox │ │ │ │ │ └── index.vue │ │ │ │ ├── dict-select │ │ │ │ │ └── index.vue │ │ │ │ ├── dict-cascader │ │ │ │ │ └── index.vue │ │ │ │ └── enum-select │ │ │ │ │ └── index.vue │ │ │ ├── store │ │ │ │ └── index.ts │ │ │ ├── views │ │ │ │ ├── module │ │ │ │ │ └── index │ │ │ │ │ │ └── page.ts │ │ │ │ └── account │ │ │ │ │ └── index │ │ │ │ │ └── page.ts │ │ │ ├── options │ │ │ │ ├── locale.en.ts │ │ │ │ ├── locale.zh-cn.ts │ │ │ │ ├── locale.th.ts │ │ │ │ └── index.ts │ │ │ ├── index.ts │ │ │ └── main.ts │ │ ├── tsconfig.json │ │ ├── .prettierrc │ │ ├── tsconfig.lib.json │ │ ├── .vscode │ │ │ └── settings.json │ │ ├── build │ │ │ ├── app.config.ts │ │ │ ├── lib.config.ts │ │ │ └── patch-types.ts │ │ ├── .eslintrc │ │ ├── tsconfig.base.json │ │ └── api-extractor.json │ ├── Admin.Core │ │ ├── Domain │ │ │ ├── Dict │ │ │ │ ├── DictEntity.Extend.cs │ │ │ │ ├── IDictRepository.cs │ │ │ │ └── DictEntity.cs │ │ │ ├── Menu │ │ │ │ ├── IMenuRepository.cs │ │ │ │ ├── MenuType.cs │ │ │ │ └── MenuOpenTarget.cs │ │ │ ├── Role │ │ │ │ ├── IRoleRepository.cs │ │ │ │ ├── RoleEntity.Extend.cs │ │ │ │ └── RoleEntity.cs │ │ │ ├── DictItem │ │ │ │ └── IDictItemRepository.cs │ │ │ ├── RoleMenu │ │ │ │ ├── IRoleMenuRepository.cs │ │ │ │ └── RoleMenuEntity.cs │ │ │ ├── DictGroup │ │ │ │ ├── IDictGroupRepository.cs │ │ │ │ └── DictGroupEntity.cs │ │ │ ├── MenuGroup │ │ │ │ ├── IMenuGroupRepository.cs │ │ │ │ └── MenuGroupEntity.cs │ │ │ ├── RoleButton │ │ │ │ ├── IRoleButtonRepository.cs │ │ │ │ └── RoleButtonEntity.cs │ │ │ ├── AccountSkin │ │ │ │ ├── IAccountSkinRepository.cs │ │ │ │ └── AccountSkinEntity.cs │ │ │ ├── JwtAuthInfo │ │ │ │ └── IJwtAuthInfoRepository.cs │ │ │ ├── RolePermission │ │ │ │ ├── IRolePermissionRepository.cs │ │ │ │ └── RolePermissionEntity.cs │ │ │ └── Account │ │ │ │ └── AccountEntity.Extend.cs │ │ ├── Infrastructure │ │ │ ├── AdminDbContext.cs │ │ │ ├── Repositories │ │ │ │ ├── MenuRepository.cs │ │ │ │ ├── RoleRepository.cs │ │ │ │ ├── DictItemRepository.cs │ │ │ │ ├── RoleMenuRepository.cs │ │ │ │ ├── DictGroupRepository.cs │ │ │ │ ├── MenuGroupRepository.cs │ │ │ │ ├── RoleButtonRepository.cs │ │ │ │ ├── AccountSkinRepository.cs │ │ │ │ ├── JwtAuthInfoRepository.cs │ │ │ │ └── RolePermissionRepository.cs │ │ │ ├── AdminConfig.cs │ │ │ ├── AdminException.cs │ │ │ ├── ModuleServicesConfigurator.cs │ │ │ ├── AdminLocalizer.cs │ │ │ ├── Defaults │ │ │ │ ├── DefaultCredentialClaimExtender.cs │ │ │ │ └── DefaultPasswordHandler.cs │ │ │ ├── IAccountPermissionResolver.cs │ │ │ ├── IPasswordHandler.cs │ │ │ ├── IAccountProfileResolver.cs │ │ │ ├── ICredentialClaimExtender.cs │ │ │ └── IVerifyCodeProvider.cs │ │ └── Application │ │ │ ├── DictGroup │ │ │ └── Dto │ │ │ │ ├── DictGroupQueryDto.cs │ │ │ │ ├── DictGroupUpdateDto.cs │ │ │ │ └── DictGroupAddDto.cs │ │ │ ├── MenuGroup │ │ │ └── Dto │ │ │ │ ├── MenuGroupQueryDto.cs │ │ │ │ ├── MenuGroupAddDto.cs │ │ │ │ └── MenuGroupUpdateDto.cs │ │ │ ├── Dict │ │ │ └── Dto │ │ │ │ ├── DictUpdateDto.cs │ │ │ │ ├── DictQueryDto.cs │ │ │ │ └── DictAddDto.cs │ │ │ ├── Menu │ │ │ └── Dto │ │ │ │ ├── MenuUpdateDto.cs │ │ │ │ └── MenuQueryDto.cs │ │ │ ├── DictItem │ │ │ └── Dto │ │ │ │ ├── DictItemUpdateDto.cs │ │ │ │ └── DictItemQueryDto.cs │ │ │ ├── Role │ │ │ └── Dto │ │ │ │ ├── RoleUpdateDto.cs │ │ │ │ └── RoleAddDto.cs │ │ │ ├── Account │ │ │ └── Dto │ │ │ │ ├── AccountQueryDto.cs │ │ │ │ ├── AccountUpdateDto.cs │ │ │ │ └── AccountSkinUpdateDto.cs │ │ │ └── Authorize │ │ │ ├── Vo │ │ │ └── ProfileSkinVo.cs │ │ │ └── Dto │ │ │ └── RefreshTokenDto.cs │ └── Admin.Web │ │ ├── _modules │ │ └── 6220_Admin │ │ │ └── _module.json │ │ ├── ModuleController.cs │ │ ├── Admin.Web.csproj │ │ └── Controllers │ │ └── ModuleController.cs └── WebHost │ ├── Program.cs │ ├── Properties │ └── launchSettings.json │ └── appsettings.Development.json ├── img ├── logo.png └── cli_demo.gif ├── test ├── 02_Data │ ├── Data.Web.Test │ │ ├── Startup.cs │ │ ├── appsettings.Development.json │ │ ├── appsettings.json │ │ ├── Data.Web.Test.csproj │ │ ├── Properties │ │ │ └── launchSettings.json │ │ ├── Controllers │ │ │ └── TransactionAttributeController.cs │ │ └── Program.cs │ ├── Data.Adapter.MySql.Test │ │ ├── BaseTest.cs │ │ └── DbContextTests.cs │ ├── Data.Adapter.Sqlite.Test │ │ ├── BaseTest.cs │ │ └── DbContextTests.cs │ ├── Data.Adapter.PostgreSQL.Test │ │ ├── BaseTest.cs │ │ ├── Domain │ │ │ ├── Json │ │ │ │ ├── IJsonRepository.cs │ │ │ │ └── JsonEntity.cs │ │ │ └── MoreDataType │ │ │ │ └── IMoreDataTypeRepository.cs │ │ ├── Infrastructure │ │ │ └── Repositories │ │ │ │ ├── JsonRepository.cs │ │ │ │ └── MoreDataTypeRepository.cs │ │ └── DbContextTests.cs │ ├── Data.Adapter.SqlServer.Test │ │ ├── BaseTest.cs │ │ └── DbContextTests.cs │ ├── Data.Common.Test │ │ ├── Infrastructure │ │ │ ├── BlogDbContext.cs │ │ │ └── Repositories │ │ │ │ ├── ArticleRepository.cs │ │ │ │ └── CategoryRepository.cs │ │ ├── Service │ │ │ └── IArticleService.cs │ │ ├── Domain │ │ │ ├── Article │ │ │ │ ├── IArticleRepository.cs │ │ │ │ └── ArticleEntity.cs │ │ │ └── Category │ │ │ │ ├── ICategoryRepository.cs │ │ │ │ └── CategoryEntity.cs │ │ └── CustomAccountResolver.cs │ └── Data.Core.Test │ │ └── EntityDescriptorTests.cs ├── Directory.Build.props └── 01_Utils │ ├── Utils.Web.Test │ ├── appsettings.Development.json │ ├── appsettings.json │ ├── Utils.Web.Test.csproj │ ├── Properties │ │ └── launchSettings.json │ └── Program.cs │ └── Utils.Tests │ ├── Product.cs │ ├── Models │ └── ResultModelTests.cs │ ├── BaseTest.cs │ ├── Extensions │ ├── ArrayExtensionsTests.cs │ └── EnumerableExtensionsTests.cs │ └── Encrypt │ ├── Md5EncryptTests.cs │ └── TripleDesEncryptTests.cs ├── src ├── Config │ ├── Config.Abstractions │ │ ├── IConfig.cs │ │ ├── Config.Abstractions.csproj │ │ └── IConfigProvider.cs │ └── Config.Core │ │ ├── Config.Core.csproj │ │ └── ModuleConfigureContextExtensions.cs ├── Data │ ├── Data.Abstractions │ │ ├── Entities │ │ │ ├── IEntity.cs │ │ │ ├── Entity.cs │ │ │ ├── ITenant.cs │ │ │ └── ISoftDelete.cs │ │ ├── Annotations │ │ │ ├── KeyAttribute.cs │ │ │ ├── NullableAttribute.cs │ │ │ ├── NotMappingColumnAttribute.cs │ │ │ ├── EnableEntityAddEvent.cs │ │ │ ├── EnableEntityAllEvent.cs │ │ │ ├── EnableEntityDeleteEvent.cs │ │ │ ├── EnableEntityUpdateEvent.cs │ │ │ ├── IgnoreOnEntityEvent.cs │ │ │ ├── EnableEntitySoftDeleteEvent.cs │ │ │ ├── TransactionAttribute.cs │ │ │ ├── LengthAttribute.cs │ │ │ └── PrecisionAttribute.cs │ │ ├── Exceptions │ │ │ ├── EntityAddException.cs │ │ │ ├── EntityUpdateException.cs │ │ │ └── EntityNotFoundException.cs │ │ ├── Logger │ │ │ ├── IDbLoggerProvider.cs │ │ │ └── DbLogger.cs │ │ ├── Query │ │ │ ├── QuerySortDto.cs │ │ │ ├── IShardingByMonthQuery.cs │ │ │ └── QueryPagingDto.cs │ │ ├── Schema │ │ │ ├── TableSchema.cs │ │ │ └── DatabaseSchema.cs │ │ ├── ICodeFirstProvider.cs │ │ ├── IRepositoryManager.cs │ │ ├── IUnitOfWork.cs │ │ ├── IOperatorResolver.cs │ │ ├── Descriptors │ │ │ └── IRepositoryDescriptor.cs │ │ ├── Data.Abstractions.csproj │ │ ├── Extensions │ │ │ └── EnumerableExtensions.cs │ │ └── Sharding │ │ │ ├── IShardingPolicyProvider.cs │ │ │ └── ShardingPolicy.cs │ ├── Data.Core │ │ ├── Internal │ │ │ ├── DefaultOperatorResolver.cs │ │ │ ├── DbConstants.cs │ │ │ ├── QueryStructure │ │ │ │ ├── QueryGroupBy.cs │ │ │ │ └── QueryUpdate.cs │ │ │ └── RepositoryManager.cs │ │ ├── DbLoggerProvider.cs │ │ ├── Descriptors │ │ │ └── RepositoryDescriptor.cs │ │ ├── Data.Core.csproj │ │ ├── Sharding │ │ │ └── Providers │ │ │ │ ├── DayShardingPolicyProvider.cs │ │ │ │ ├── MonthShardingPolicyProvider.cs │ │ │ │ └── YearShardingPolicyProvider.cs │ │ └── Repository │ │ │ └── RepositoryAbstract.Exists.cs │ └── Adapters │ │ ├── Data.Adapter.Sqlite │ │ ├── GuidTypeHandler.cs │ │ ├── Data.Adapter.Sqlite.csproj │ │ └── SqliteExtensions.cs │ │ ├── Data.Adapter.PostgreSQL │ │ └── Data.Adapter.PostgreSQL.csproj │ │ ├── Data.Adapter.MySql │ │ ├── Data.Adapter.MySql.csproj │ │ └── MySqlExtensions.cs │ │ └── Data.Adapter.SqlServer │ │ ├── Data.Adapter.SqlServer.csproj │ │ └── SqlServerExtensions.cs ├── Auth │ ├── Auth.Core │ │ ├── PermissionRequirement.cs │ │ ├── DefaultPermissionValidateHandler.cs │ │ ├── DefaultTenantResolver.cs │ │ ├── MkhAuthBuilder.cs │ │ ├── DefaultPlatformProvider.cs │ │ └── Auth.Core.csproj │ ├── Auth.Abstractions │ │ ├── ICredential.cs │ │ ├── Annotations │ │ │ ├── AllowWhenAuthenticatedAttribute.cs │ │ │ └── DisableAuditAttribute.cs │ │ ├── Auth.Abstractions.csproj │ │ ├── IPermissionResolver.cs │ │ ├── IPermissionValidateHandler.cs │ │ ├── ICredentialBuilder.cs │ │ ├── ITenantResolver.cs │ │ └── IPlatformProvider.cs │ └── Auth.Jwt │ │ ├── Auth.Jwt.csproj │ │ ├── JwtOptions.cs │ │ └── JwtCredential.cs ├── Utils │ ├── Utils │ │ ├── Enums │ │ │ ├── Sex.cs │ │ │ ├── Whether.cs │ │ │ └── Week.cs │ │ ├── Annotations │ │ │ ├── IgnoreAttribute.cs │ │ │ ├── SwaggerIgnoreAttribute.cs │ │ │ ├── ScopedInjectAttribute.cs │ │ │ ├── TransientInjectAttribute.cs │ │ │ ├── SingletonInjectAttribute.cs │ │ │ └── ObjectMapAttribute.cs │ │ ├── App │ │ │ └── IAppShutdownHandler.cs │ │ ├── Exceptions │ │ │ ├── MkhSystemException.cs │ │ │ └── MkhBusinessException.cs │ │ ├── Models │ │ │ ├── OptionCollectionResultModel.cs │ │ │ └── FileDownloadModel.cs │ │ ├── Validations │ │ │ ├── PhoneValidationAttribute.cs │ │ │ └── GuidNotEmptyValidationAttribute.cs │ │ ├── File │ │ │ ├── FileSizeUnit.cs │ │ │ └── FileExtensions.cs │ │ ├── Extensions │ │ │ ├── ServiceCollectionExtensions.cs │ │ │ ├── GuidExtensions.cs │ │ │ ├── ArrayExtensions.cs │ │ │ └── ConfigurationExtensions.cs │ │ ├── Map │ │ │ └── IMapper.cs │ │ ├── Json │ │ │ └── Converters │ │ │ │ └── DateTimeConverter.cs │ │ └── Utils.csproj │ └── Utils.Web │ │ ├── ActionDescriptor.cs │ │ ├── Utils.Web.csproj │ │ ├── Extensions │ │ └── HttpRequestExtensions.cs │ │ └── ControllerDescriptor.cs ├── TaskScheduler │ ├── TaskScheduler.Core │ │ ├── TaskCollection.cs │ │ ├── TaskScheduler.Core.csproj │ │ └── TaskDescriptor.cs │ └── TaskScheduler.Abstractions │ │ ├── ITaskCollection.cs │ │ ├── TaskScheduler.Abstractions.csproj │ │ ├── ITask.cs │ │ ├── TaskExecutionContext.cs │ │ └── ITaskDescriptor.cs ├── Module │ ├── Module.Abstractions │ │ ├── IModuleLocalizer.cs │ │ ├── Options │ │ │ ├── ModuleOptions.cs │ │ │ └── CommonOptions.cs │ │ ├── Module.Abstractions.csproj │ │ ├── IModuleCollection.cs │ │ ├── ModuleLayerAssemblies.cs │ │ ├── ModuleEnumDescriptor.cs │ │ ├── IModuleServicesConfigurator.cs │ │ └── ModuleConfigureContext.cs │ ├── Module.Web │ │ ├── IModuleMvcOptionsConfigurator.cs │ │ └── Module.Web.csproj │ └── Module.Core │ │ ├── Module.Core.csproj │ │ ├── Constants.cs │ │ └── ModuleLocalizerAbstract.cs ├── Excel │ ├── Excel.Core │ │ ├── Excel.Core.csproj │ │ └── ServiceCollectionExtensions.cs │ ├── Excel.Abstractions │ │ ├── Annotations │ │ │ └── IgnoreOnExcelExportAttribute.cs │ │ ├── ExcelOptions.cs │ │ ├── ExcelModel.cs │ │ ├── Export │ │ │ ├── IExcelExportQuery.cs │ │ │ ├── ExcelExportTemplateModel.cs │ │ │ └── IExcelExportBuilder.cs │ │ ├── Excel.Abstractions.csproj │ │ ├── ExcelOptionsBuilder.cs │ │ └── IExcelProvider.cs │ └── Providers │ │ └── Excel.EPPlus │ │ ├── Excel.EPPlus.csproj │ │ ├── EPPlusExcelProvider.cs │ │ └── ExcelOptionsBuilderExtensions.cs ├── Logging │ ├── Logging.Abstractions │ │ ├── Logging.Abstractions.csproj │ │ └── BaseLogModel.cs │ └── Logging.Core │ │ ├── Logging.Core.csproj │ │ ├── ServiceCollectionExtensions.cs │ │ └── DefaultProviders │ │ ├── LoginLogHandler.cs │ │ └── AuditLogHandler.cs ├── Idenity │ ├── Identity.Abstractions │ │ └── Identity.Abstractions.csproj │ └── Identity.Core │ │ ├── Identity.Core.csproj │ │ └── ServiceCollectionExtensions.cs ├── MessageQueue │ └── MessageQueue.RabbitMQ │ │ ├── DefaultExchange.cs │ │ ├── MessageQueue.RabbitMQ.csproj │ │ ├── Consumer.cs │ │ ├── ServiceCollectionExtensions.cs │ │ └── RabbitMQConfig.cs ├── Cache │ ├── Cache.Core │ │ ├── Cache.Core.csproj │ │ ├── CacheBuilder.cs │ │ └── ServiceCollectionExtensions.cs │ ├── Cache.Abstractions │ │ ├── Cache.Abstractions.csproj │ │ └── ICacheBuilder.cs │ └── Cache.Redis │ │ ├── RedisOptions.cs │ │ ├── Cache.Redis.csproj │ │ └── IRedisSerializer.cs └── Mapper │ └── Mapper │ ├── Mapper.csproj │ └── DefaultMapper.cs └── nuget_publish.ps1 /modules/01_Blog/Blog.UI/.env: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/.env: -------------------------------------------------------------------------------- 1 | MKH_API_URL=/api/ -------------------------------------------------------------------------------- /img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/17MKH/Mkh/HEAD/img/logo.png -------------------------------------------------------------------------------- /img/cli_demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/17MKH/Mkh/HEAD/img/cli_demo.gif -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/.env.development: -------------------------------------------------------------------------------- 1 | MKH_API_URL=http://localhost:6220/api/ -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/api/dict/dto.ts: -------------------------------------------------------------------------------- 1 | export interface DictEntity { 2 | id: number 3 | } 4 | -------------------------------------------------------------------------------- /test/02_Data/Data.Web.Test/Startup.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/17MKH/Mkh/HEAD/test/02_Data/Data.Web.Test/Startup.cs -------------------------------------------------------------------------------- /modules/01_Blog/Blog.UI/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['plugin:vue/vue3-recommended', 'prettier'], 3 | } 4 | -------------------------------------------------------------------------------- /modules/01_Blog/Blog.UI/src/index.js: -------------------------------------------------------------------------------- 1 | import mod from '@mkh-mod-blog' 2 | mod.callback = ({ store }) => { 3 | console.log(store) 4 | } 5 | -------------------------------------------------------------------------------- /test/02_Data/Data.Adapter.MySql.Test/BaseTest.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/17MKH/Mkh/HEAD/test/02_Data/Data.Adapter.MySql.Test/BaseTest.cs -------------------------------------------------------------------------------- /test/02_Data/Data.Adapter.Sqlite.Test/BaseTest.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/17MKH/Mkh/HEAD/test/02_Data/Data.Adapter.Sqlite.Test/BaseTest.cs -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.base.json", 3 | "include": [ 4 | "build/**/*.ts", 5 | ] 6 | } -------------------------------------------------------------------------------- /test/02_Data/Data.Adapter.PostgreSQL.Test/BaseTest.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/17MKH/Mkh/HEAD/test/02_Data/Data.Adapter.PostgreSQL.Test/BaseTest.cs -------------------------------------------------------------------------------- /test/02_Data/Data.Adapter.SqlServer.Test/BaseTest.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/17MKH/Mkh/HEAD/test/02_Data/Data.Adapter.SqlServer.Test/BaseTest.cs -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Domain/Dict/DictEntity.Extend.cs: -------------------------------------------------------------------------------- 1 | namespace Mkh.Mod.Admin.Core.Domain.Dict; 2 | 3 | public partial class DictEntity 4 | { 5 | } -------------------------------------------------------------------------------- /modules/01_Blog/Blog.UI/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 2, 3 | "semi": false, 4 | "singleQuote": true, 5 | "printWidth": 200, 6 | "arrowParens": "avoid" 7 | } 8 | -------------------------------------------------------------------------------- /src/Config/Config.Abstractions/IConfig.cs: -------------------------------------------------------------------------------- 1 | namespace Mkh.Config.Abstractions; 2 | 3 | /// 4 | /// 配置类接口 5 | /// 6 | public interface IConfig 7 | { 8 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 2, 3 | "semi": false, 4 | "singleQuote": true, 5 | "printWidth": 200, 6 | "vueIndentScriptAndStyle": true 7 | } 8 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/api/dictItem/index.ts: -------------------------------------------------------------------------------- 1 | import { crud } from 'mkh-ui' 2 | import http from '../http' 3 | 4 | export default { 5 | ...crud(http, 'DictItem'), 6 | } 7 | -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Entities/IEntity.cs: -------------------------------------------------------------------------------- 1 | namespace Mkh.Data.Abstractions.Entities; 2 | 3 | /// 4 | /// 实体接口 5 | /// 6 | public interface IEntity 7 | { 8 | } -------------------------------------------------------------------------------- /modules/01_Blog/Blog.Web/_modules/6221_Blog/_module.json: -------------------------------------------------------------------------------- 1 | {"Id": 6221,"Name":"个人博客","Code":"Blog","Icon":"article","Version":"0.0.1","Description":"17MKH Module Blog(个人博客) - Blog.Web"} 2 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Web/_modules/6220_Admin/_module.json: -------------------------------------------------------------------------------- 1 | {"Id": 6220,"Name":"权限管理","Code":"Admin","Icon":"permission","Version":"1.3.1","Description":"17MKH Module Admin(权限管理) - Admin.Web"} 2 | -------------------------------------------------------------------------------- /modules/01_Blog/Blog.Core/Application/Article/ArticleService.cs: -------------------------------------------------------------------------------- 1 | namespace Mkh.Mod.Blog.Core.Application.Article 2 | { 3 | public class ArticleService : IArticleService 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/types/mod.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'virtual:mkh-mod-admin*' { 2 | import type { ModuleDefinition } from 'mkh-ui' 3 | const mod: ModuleDefinition 4 | export default mod 5 | } 6 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/api/http.ts: -------------------------------------------------------------------------------- 1 | import { createHttp, bootstrapOptions } from 'mkh-ui' 2 | import mod from 'virtual:mkh-mod-admin?base' 3 | 4 | export default createHttp(bootstrapOptions, mod.code) 5 | -------------------------------------------------------------------------------- /modules/01_Blog/Blog.UI/src/store/index.js: -------------------------------------------------------------------------------- 1 | const state = { 2 | id: 1, 3 | } 4 | 5 | const mutations = {} 6 | 7 | export default { 8 | namespaced: true, 9 | state, 10 | mutations, 11 | } 12 | -------------------------------------------------------------------------------- /src/Config/Config.Abstractions/Config.Abstractions.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17MKH 配置抽象库 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | 6 | 7 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/locales/lang/zh-cn/routes.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | admin_account: '账户管理', 3 | admin_dict: '字典管理', 4 | admin_menu: '菜单管理', 5 | admin_module: '模块中心', 6 | admin_role: '角色管理', 7 | } 8 | -------------------------------------------------------------------------------- /modules/01_Blog/Blog.Core/Blog.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/api/dictGroup/index.ts: -------------------------------------------------------------------------------- 1 | import { crud } from 'mkh-ui' 2 | import http from '../http' 3 | 4 | export default { 5 | ...crud(http, 'DictGroup'), 6 | select: () => http.get('DictGroup/Select'), 7 | } 8 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/components/role-select/index.vue: -------------------------------------------------------------------------------- 1 | 4 | 7 | -------------------------------------------------------------------------------- /test/02_Data/Data.Common.Test/Infrastructure/BlogDbContext.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Core; 2 | 3 | namespace Data.Common.Test.Infrastructure 4 | { 5 | public class BlogDbContext : DbContext 6 | { 7 | 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/locales/lang/en/routes.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | admin_account: 'Account', 3 | admin_dict: 'Dictionary', 4 | admin_menu: 'Menu', 5 | admin_module: 'Module Center', 6 | admin_role: 'Role', 7 | } 8 | -------------------------------------------------------------------------------- /modules/WebHost/Program.cs: -------------------------------------------------------------------------------- 1 | 2 | using Mkh.Host.Web; 3 | 4 | namespace WebHost; 5 | 6 | public class Program 7 | { 8 | public static void Main(string[] args) 9 | { 10 | new HostBootstrap().Run(args); 11 | } 12 | } -------------------------------------------------------------------------------- /test/02_Data/Data.Common.Test/Service/IArticleService.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace Data.Common.Test.Service 4 | { 5 | public interface IArticleService 6 | { 7 | Task Add(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Web/ModuleController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | using Mkh.Module.Web; 3 | 4 | namespace Mkh.Mod.Admin.Web; 5 | 6 | [Area("Admin")] 7 | public abstract class ModuleController : ControllerAbstract 8 | { 9 | 10 | } -------------------------------------------------------------------------------- /test/02_Data/Data.Common.Test/Domain/Article/IArticleRepository.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions; 2 | 3 | namespace Data.Common.Test.Domain.Article 4 | { 5 | public interface IArticleRepository : IRepository 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Infrastructure/AdminDbContext.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Core; 2 | 3 | namespace Mkh.Mod.Admin.Core.Infrastructure; 4 | 5 | /// 6 | /// 权限管理模块数据库上下文 7 | /// 8 | public class AdminDbContext : DbContext 9 | { 10 | } -------------------------------------------------------------------------------- /modules/01_Blog/Blog.Core/Application/Article/IArticleService.cs: -------------------------------------------------------------------------------- 1 | namespace Mkh.Mod.Blog.Core.Application.Article 2 | { 3 | /// 4 | /// 文章服务 5 | /// 6 | public interface IArticleService 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/01_Utils/Utils.Web.Test/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/02_Data/Data.Common.Test/Domain/Category/ICategoryRepository.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions; 2 | 3 | namespace Data.Common.Test.Domain.Category 4 | { 5 | public interface ICategoryRepository : IRepository 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/02_Data/Data.Web.Test/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Auth/Auth.Core/PermissionRequirement.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Authorization; 2 | 3 | namespace Mkh.Auth.Core; 4 | 5 | public class PermissionRequirement : IAuthorizationRequirement 6 | { 7 | public PermissionRequirement() 8 | { 9 | } 10 | } -------------------------------------------------------------------------------- /src/Utils/Utils/Enums/Sex.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Mkh.Utils.Enums; 4 | 5 | /// 6 | /// 性别 7 | /// 8 | public enum Sex 9 | { 10 | [Description("男")] 11 | Boy, 12 | [Description("女")] 13 | Girl 14 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Domain/Menu/IMenuRepository.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions; 2 | 3 | namespace Mkh.Mod.Admin.Core.Domain.Menu; 4 | 5 | /// 6 | /// 菜单仓储 7 | /// 8 | public interface IMenuRepository : IRepository 9 | { 10 | } -------------------------------------------------------------------------------- /test/01_Utils/Utils.Web.Test/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /test/02_Data/Data.Web.Test/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/api/module/index.ts: -------------------------------------------------------------------------------- 1 | import http from '../http' 2 | 3 | const urls = { 4 | //获取权限列表 5 | GET_PERMISSIONS: 'Module/Permissions', 6 | } 7 | 8 | export default { 9 | getPermissions: (params) => http.get(urls.GET_PERMISSIONS, params), 10 | } 11 | -------------------------------------------------------------------------------- /src/Auth/Auth.Abstractions/ICredential.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Utils.Json.Converters; 2 | 3 | namespace Mkh.Auth.Abstractions 4 | { 5 | /// 6 | /// 凭据 7 | /// 8 | [JsonPolymorphism] 9 | public interface ICredential 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Annotations/KeyAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mkh.Data.Abstractions.Annotations; 4 | 5 | /// 6 | /// 主键 7 | /// 8 | [AttributeUsage(AttributeTargets.Property)] 9 | public class KeyAttribute : Attribute 10 | { 11 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Domain/Role/IRoleRepository.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions; 2 | 3 | namespace Mkh.Mod.Admin.Core.Domain.Role; 4 | 5 | /// 6 | /// 角色仓储 7 | /// 8 | public interface IRoleRepository : IRepository 9 | { 10 | 11 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.base.json", 3 | "compilerOptions": { 4 | "declaration": true, 5 | }, 6 | "include": [ 7 | "src/**/*.ts", 8 | "src/**/*.d.ts", 9 | "src/**/*.vue" 10 | ] 11 | } -------------------------------------------------------------------------------- /modules/01_Blog/Blog.Core/Infrastructure/BlogDbContext.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Core; 2 | 3 | namespace Mkh.Mod.Blog.Core.Infrastructure 4 | { 5 | /// 6 | /// 博客模块数据库仓储 7 | /// 8 | public class BlogDbContext : DbContext 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/api/menuGroup/index.ts: -------------------------------------------------------------------------------- 1 | import { crud } from 'mkh-ui' 2 | import http from '../http' 3 | 4 | const urls = { 5 | SELECT: 'MenuGroup/Select', 6 | } 7 | export default { 8 | ...crud(http, 'MenuGroup'), 9 | select: () => http.get(urls.SELECT), 10 | } 11 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/store/index.ts: -------------------------------------------------------------------------------- 1 | import { defineStore } from 'pinia' 2 | 3 | export default defineStore('mod.admin', { 4 | state: () => { 5 | return { 6 | dict: { 7 | groupCode: '', 8 | dictCode: '', 9 | }, 10 | } 11 | }, 12 | }) 13 | -------------------------------------------------------------------------------- /modules/01_Blog/Blog.UI/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.defaultFormatter": "esbenp.prettier-vscode", 3 | "editor.formatOnPaste": true, 4 | "editor.formatOnSave": true, 5 | "editor.formatOnType": true, 6 | "editor.codeActionsOnSave": { 7 | "source.fixAll.eslint": true 8 | } 9 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Domain/DictItem/IDictItemRepository.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions; 2 | 3 | namespace Mkh.Mod.Admin.Core.Domain.DictItem; 4 | 5 | /// 6 | /// 数据字典项仓储 7 | /// 8 | public interface IDictItemRepository : IRepository 9 | { 10 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Domain/RoleMenu/IRoleMenuRepository.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions; 2 | 3 | namespace Mkh.Mod.Admin.Core.Domain.RoleMenu; 4 | 5 | /// 6 | /// 角色菜单绑定关系仓储 7 | /// 8 | public interface IRoleMenuRepository : IRepository 9 | { 10 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.defaultFormatter": "esbenp.prettier-vscode", 3 | "editor.formatOnPaste": true, 4 | "editor.formatOnSave": true, 5 | "editor.formatOnType": true, 6 | "editor.codeActionsOnSave": { 7 | "source.fixAll.eslint": true 8 | } 9 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Domain/DictGroup/IDictGroupRepository.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions; 2 | 3 | namespace Mkh.Mod.Admin.Core.Domain.DictGroup; 4 | 5 | /// 6 | /// 数据字典分组仓储 7 | /// 8 | public interface IDictGroupRepository : IRepository 9 | { 10 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Domain/MenuGroup/IMenuGroupRepository.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions; 2 | 3 | namespace Mkh.Mod.Admin.Core.Domain.MenuGroup; 4 | 5 | /// 6 | /// 菜单分组仓储 7 | /// 8 | public interface IMenuGroupRepository : IRepository 9 | { 10 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/locales/lang/th/routes.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | admin_account: 'จัดการบัญชี',//'账户管理', 3 | admin_dict: 'จัดการประเภทหน่วย', //'字典管理', 4 | admin_menu: 'จัดการเมนู',//'菜单管理', 5 | admin_module: 'โมดูลผู้ดูแลระบบ',//'模块中心', 6 | admin_role: 'ตำแหน่ง', //'角色管理', 7 | } 8 | -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Annotations/NullableAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mkh.Data.Abstractions.Annotations; 4 | 5 | /// 6 | /// 可空的 7 | /// 8 | [AttributeUsage(AttributeTargets.Property)] 9 | public class NullableAttribute : Attribute 10 | { 11 | 12 | } -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Exceptions/EntityAddException.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Utils.Exceptions; 2 | 3 | namespace Mkh.Data.Abstractions.Exceptions; 4 | 5 | public class EntityAddException : MkhSystemException 6 | { 7 | public EntityAddException() : base("Data", "AddError") 8 | { 9 | } 10 | } -------------------------------------------------------------------------------- /src/TaskScheduler/TaskScheduler.Core/TaskCollection.cs: -------------------------------------------------------------------------------- 1 | using Mkh.TaskScheduler.Abstractions; 2 | using Mkh.Utils.Abstracts; 3 | 4 | namespace Mkh.TaskScheduler.Core 5 | { 6 | internal class TaskCollection : CollectionAbstract, ITaskCollection 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Domain/RoleButton/IRoleButtonRepository.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions; 2 | 3 | namespace Mkh.Mod.Admin.Core.Domain.RoleButton; 4 | 5 | /// 6 | /// 角色按钮绑定关系仓储 7 | /// 8 | public interface IRoleButtonRepository : IRepository 9 | { 10 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Infrastructure/Repositories/MenuRepository.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Core.Repository; 2 | using Mkh.Mod.Admin.Core.Domain.Menu; 3 | 4 | namespace Mkh.Mod.Admin.Core.Infrastructure.Repositories; 5 | 6 | public class MenuRepository : RepositoryAbstract, IMenuRepository 7 | { 8 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Infrastructure/Repositories/RoleRepository.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Core.Repository; 2 | using Mkh.Mod.Admin.Core.Domain.Role; 3 | 4 | namespace Mkh.Mod.Admin.Core.Infrastructure.Repositories; 5 | 6 | public class RoleRepository : RepositoryAbstract, IRoleRepository 7 | { 8 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/types/env.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.vue' { 2 | import type { DefineComponent } from 'vue' 3 | // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types 4 | const component: DefineComponent<{}, {}, any> 5 | export default component 6 | } 7 | -------------------------------------------------------------------------------- /src/Module/Module.Abstractions/IModuleLocalizer.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Localization; 2 | 3 | namespace Mkh.Module.Abstractions 4 | { 5 | /// 6 | /// 模块多语言读取器 7 | /// 8 | public interface IModuleLocalizer : IStringLocalizer 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Domain/AccountSkin/IAccountSkinRepository.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions; 2 | 3 | namespace Mkh.Mod.Admin.Core.Domain.AccountSkin; 4 | 5 | /// 6 | /// 账户配置实体 7 | /// 8 | public interface IAccountSkinRepository : IRepository 9 | { 10 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Domain/JwtAuthInfo/IJwtAuthInfoRepository.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions; 2 | 3 | namespace Mkh.Mod.Admin.Core.Domain.JwtAuthInfo; 4 | 5 | /// 6 | /// JWT认证信息仓储 7 | /// 8 | public interface IJwtAuthInfoRepository : IRepository 9 | { 10 | } -------------------------------------------------------------------------------- /modules/01_Blog/Blog.Core/Domain/Article/IArticleRepository.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions; 2 | 3 | namespace Blog.Core.Domain.Article 4 | { 5 | /// 6 | /// 文章仓储 7 | /// 8 | public interface IArticleRepository : IRepository 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Exceptions/EntityUpdateException.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Utils.Exceptions; 2 | 3 | namespace Mkh.Data.Abstractions.Exceptions; 4 | 5 | public class EntityUpdateException : MkhSystemException 6 | { 7 | public EntityUpdateException() : base("Data", "UpdateError") 8 | { 9 | } 10 | } -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Annotations/NotMappingColumnAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mkh.Data.Abstractions.Annotations; 4 | 5 | /// 6 | /// 指定属性不映射列 7 | /// 8 | [AttributeUsage(AttributeTargets.Property)] 9 | public class NotMappingColumnAttribute : Attribute 10 | { 11 | } -------------------------------------------------------------------------------- /src/TaskScheduler/TaskScheduler.Abstractions/ITaskCollection.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Mkh.TaskScheduler.Abstractions 4 | { 5 | /// 6 | /// 任务 7 | /// 8 | public interface ITaskCollection : IList 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Utils/Utils/Annotations/IgnoreAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mkh.Utils.Annotations; 4 | 5 | /// 6 | /// 忽略 7 | /// 8 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field)] 9 | public class IgnoreAttribute : Attribute 10 | { 11 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/types/mkh.d.ts: -------------------------------------------------------------------------------- 1 | import { ModuleDefinition } from 'mkh-ui' 2 | 3 | declare module 'mkh-ui' { 4 | export interface ModuleDefinition { 5 | /** 主题色 */ 6 | color: string 7 | } 8 | 9 | export interface Profile { 10 | /** 角色编号 */ 11 | roleId: string 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /modules/01_Blog/Blog.UI/src/api/article.js: -------------------------------------------------------------------------------- 1 | const urls = { 2 | /** 获取账户默认密码 */ 3 | DEFAULT_PASSWORD: 'Account/DefaultPassword', 4 | } 5 | export default http => { 6 | const getDefaultPassword = () => { 7 | return http.get(urls.DEFAULT_PASSWORD) 8 | } 9 | 10 | return { getDefaultPassword } 11 | } 12 | -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Exceptions/EntityNotFoundException.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Utils.Exceptions; 2 | 3 | namespace Mkh.Data.Abstractions.Exceptions; 4 | 5 | public class EntityNotFoundException : MkhSystemException 6 | { 7 | public EntityNotFoundException() : base("Data", "EntityNotFound") 8 | { 9 | } 10 | } -------------------------------------------------------------------------------- /src/Utils/Utils/Annotations/SwaggerIgnoreAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mkh.Utils.Annotations; 4 | 5 | /// 6 | /// 在Swagger中忽略该字段或属性 7 | /// 8 | [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] 9 | public class SwaggerIgnoreAttribute : Attribute 10 | { 11 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Domain/RolePermission/IRolePermissionRepository.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions; 2 | 3 | namespace Mkh.Mod.Admin.Core.Domain.RolePermission; 4 | 5 | /// 6 | /// 角色权限绑定关系仓储 7 | /// 8 | public interface IRolePermissionRepository : IRepository 9 | { 10 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Infrastructure/Repositories/DictItemRepository.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Core.Repository; 2 | using Mkh.Mod.Admin.Core.Domain.DictItem; 3 | 4 | namespace Mkh.Mod.Admin.Core.Infrastructure.Repositories; 5 | 6 | public class DictItemRepository : RepositoryAbstract, IDictItemRepository 7 | { 8 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Infrastructure/Repositories/RoleMenuRepository.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Core.Repository; 2 | using Mkh.Mod.Admin.Core.Domain.RoleMenu; 3 | 4 | namespace Mkh.Mod.Admin.Core.Infrastructure.Repositories; 5 | 6 | public class RoleMenuRepository : RepositoryAbstract, IRoleMenuRepository 7 | { 8 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Infrastructure/Repositories/DictGroupRepository.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Core.Repository; 2 | using Mkh.Mod.Admin.Core.Domain.DictGroup; 3 | 4 | namespace Mkh.Mod.Admin.Core.Infrastructure.Repositories; 5 | 6 | public class DictGroupRepository : RepositoryAbstract, IDictGroupRepository 7 | { 8 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Infrastructure/Repositories/MenuGroupRepository.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Core.Repository; 2 | using Mkh.Mod.Admin.Core.Domain.MenuGroup; 3 | 4 | namespace Mkh.Mod.Admin.Core.Infrastructure.Repositories; 5 | 6 | public class MenuGroupRepository : RepositoryAbstract, IMenuGroupRepository 7 | { 8 | } -------------------------------------------------------------------------------- /src/Excel/Excel.Core/Excel.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17MKH Excel核心库 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Infrastructure/Repositories/RoleButtonRepository.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Core.Repository; 2 | using Mkh.Mod.Admin.Core.Domain.RoleButton; 3 | 4 | namespace Mkh.Mod.Admin.Core.Infrastructure.Repositories; 5 | 6 | public class RoleButtonRepository : RepositoryAbstract, IRoleButtonRepository 7 | { 8 | } -------------------------------------------------------------------------------- /src/TaskScheduler/TaskScheduler.Abstractions/TaskScheduler.Abstractions.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17MKH 任务调度抽象库 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Infrastructure/Repositories/AccountSkinRepository.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Core.Repository; 2 | using Mkh.Mod.Admin.Core.Domain.AccountSkin; 3 | 4 | namespace Mkh.Mod.Admin.Core.Infrastructure.Repositories; 5 | 6 | public class AccountSkinRepository : RepositoryAbstract, IAccountSkinRepository 7 | { 8 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Infrastructure/Repositories/JwtAuthInfoRepository.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Core.Repository; 2 | using Mkh.Mod.Admin.Core.Domain.JwtAuthInfo; 3 | 4 | namespace Mkh.Mod.Admin.Core.Infrastructure.Repositories; 5 | 6 | public class JwtAuthInfoRepository : RepositoryAbstract, IJwtAuthInfoRepository 7 | { 8 | } -------------------------------------------------------------------------------- /modules/01_Blog/Blog.Core/Infrastructure/Repositories/ArticleRepository.cs: -------------------------------------------------------------------------------- 1 | using Blog.Core.Domain.Article; 2 | using Mkh.Data.Core.Repository; 3 | 4 | namespace Mkh.Mod.Blog.Core.Infrastructure.Repositories 5 | { 6 | public class ArticleRepository : RepositoryAbstract, IArticleRepository 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Annotations/EnableEntityAddEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mkh.Data.Abstractions.Annotations 4 | { 5 | /// 6 | /// 启用实体新增事件 7 | /// 8 | [AttributeUsage(AttributeTargets.Class)] 9 | public class EnableEntityAddEvent : Attribute 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Annotations/EnableEntityAllEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mkh.Data.Abstractions.Annotations 4 | { 5 | /// 6 | /// 启用实体所有事件 7 | /// 8 | [AttributeUsage(AttributeTargets.Class)] 9 | public class EnableEntityAllEvent : Attribute 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Utils/Utils/App/IAppShutdownHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace Mkh.Utils.App; 4 | 5 | /// 6 | /// 应用关闭处理接口 7 | /// 8 | public interface IAppShutdownHandler 9 | { 10 | /// 11 | /// 处理 12 | /// 13 | /// 14 | Task Handle(); 15 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Application/DictGroup/Dto/DictGroupQueryDto.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions.Query; 2 | 3 | namespace Mkh.Mod.Admin.Core.Application.DictGroup.Dto; 4 | 5 | public class DictGroupQueryDto : QueryDto 6 | { 7 | /// 8 | /// 分组名称 9 | /// 10 | public string Name { get; set; } 11 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Application/MenuGroup/Dto/MenuGroupQueryDto.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions.Query; 2 | 3 | namespace Mkh.Mod.Admin.Core.Application.MenuGroup.Dto; 4 | 5 | public class MenuGroupQueryDto : QueryDto 6 | { 7 | /// 8 | /// 菜单名称 9 | /// 10 | public string Name { get; set; } 11 | } -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Annotations/EnableEntityDeleteEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mkh.Data.Abstractions.Annotations 4 | { 5 | /// 6 | /// 启用实体删除事件 7 | /// 8 | [AttributeUsage(AttributeTargets.Class)] 9 | public class EnableEntityDeleteEvent : Attribute 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Annotations/EnableEntityUpdateEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mkh.Data.Abstractions.Annotations 4 | { 5 | /// 6 | /// 启用实体更新事件 7 | /// 8 | [AttributeUsage(AttributeTargets.Class)] 9 | public class EnableEntityUpdateEvent : Attribute 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Annotations/IgnoreOnEntityEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mkh.Data.Abstractions.Annotations 4 | { 5 | /// 6 | /// 在实体事件中忽略指定属性 7 | /// 8 | [AttributeUsage(AttributeTargets.Property)] 9 | public class IgnoreOnEntityEvent : Attribute 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/01_Utils/Utils.Web.Test/Utils.Web.Test.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Domain/Role/RoleEntity.Extend.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions.Annotations; 2 | 3 | namespace Mkh.Mod.Admin.Core.Domain.Role; 4 | 5 | public partial class RoleEntity 6 | { 7 | /// 8 | /// 菜单组名称 9 | /// 10 | [NotMappingColumn] 11 | public string MenuGroupName { get; set; } 12 | } -------------------------------------------------------------------------------- /src/Excel/Excel.Abstractions/Annotations/IgnoreOnExcelExportAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mkh.Excel.Abstractions.Annotations; 4 | 5 | /// 6 | /// Excel导出中忽略该属性 7 | /// 8 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] 9 | public class IgnoreOnExcelExportAttribute : Attribute 10 | { 11 | } -------------------------------------------------------------------------------- /test/02_Data/Data.Common.Test/Infrastructure/Repositories/ArticleRepository.cs: -------------------------------------------------------------------------------- 1 | using Data.Common.Test.Domain.Article; 2 | using Mkh.Data.Core.Repository; 3 | 4 | namespace Data.Common.Test.Infrastructure.Repositories 5 | { 6 | public class ArticleRepository : RepositoryAbstract, IArticleRepository 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Infrastructure/Repositories/RolePermissionRepository.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Core.Repository; 2 | using Mkh.Mod.Admin.Core.Domain.RolePermission; 3 | 4 | namespace Mkh.Mod.Admin.Core.Infrastructure.Repositories; 5 | 6 | public class RolePermissionRepository : RepositoryAbstract, IRolePermissionRepository 7 | { 8 | } -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Annotations/EnableEntitySoftDeleteEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mkh.Data.Abstractions.Annotations 4 | { 5 | /// 6 | /// 启用实体软删除事件 7 | /// 8 | [AttributeUsage(AttributeTargets.Class)] 9 | public class EnableEntitySoftDeleteEvent : Attribute 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Logging/Logging.Abstractions/Logging.Abstractions.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17MKH 日志抽象库 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/types/menu.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 菜单树节点 3 | */ 4 | export interface MenuTreeNode { 5 | id: number 6 | label: string 7 | children: MenuTreeNode[] 8 | path: string[] 9 | item: { 10 | id: number 11 | icon: string 12 | type: number 13 | locales: { 14 | 'zh-cn': string 15 | en: string 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /nuget_publish.ps1: -------------------------------------------------------------------------------- 1 | Write-Host '请输入Key:' 2 | 3 | $key = Read-Host 4 | $dir = './_packages' 5 | 6 | if(Test-Path -Path $dir){ 7 | Remove-Item $dir -Recurse 8 | } 9 | 10 | dotnet build -c Release 11 | 12 | Get-ChildItem -Path $dir | ForEach-Object -Process{ 13 | dotnet nuget push $_.fullname -s https://api.nuget.org/v3/index.json -k $key 14 | } 15 | 16 | pause -------------------------------------------------------------------------------- /src/Auth/Auth.Abstractions/Annotations/AllowWhenAuthenticatedAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mkh.Auth.Abstractions.Annotations; 4 | 5 | /// 6 | /// 只要认证就能访问,无需授权 7 | /// 8 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)] 9 | public class AllowWhenAuthenticatedAttribute : Attribute 10 | { 11 | } -------------------------------------------------------------------------------- /src/Idenity/Identity.Abstractions/Identity.Abstractions.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17MKH Identity Abstractions 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/02_Data/Data.Common.Test/Infrastructure/Repositories/CategoryRepository.cs: -------------------------------------------------------------------------------- 1 | using Data.Common.Test.Domain.Category; 2 | using Mkh.Data.Core; 3 | using Mkh.Data.Core.Repository; 4 | 5 | namespace Data.Common.Test.Infrastructure.Repositories 6 | { 7 | public class CategoryRepository : RepositoryAbstract, ICategoryRepository 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /test/02_Data/Data.Adapter.PostgreSQL.Test/Domain/Json/IJsonRepository.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Data.Adapter.PostgreSQL.Test.Domain.Json; 9 | 10 | public interface IJsonRepository : IRepository 11 | { 12 | } 13 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/views/module/index/page.ts: -------------------------------------------------------------------------------- 1 | import type { PageDefinition } from 'mkh-ui' 2 | import component from './index.vue' 3 | 4 | const page: PageDefinition = { 5 | name: 'admin_module', 6 | icon: 'module', 7 | path: '/admin/module', 8 | permissions: ['admin_Module_Permissions_get'], 9 | buttons: {}, 10 | component, 11 | } 12 | 13 | export default page 14 | -------------------------------------------------------------------------------- /src/Auth/Auth.Abstractions/Annotations/DisableAuditAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mkh.Auth.Abstractions.Annotations 4 | { 5 | /// 6 | /// 禁用审计功能 7 | /// 8 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property)] 9 | public class DisableAuditAttribute : Attribute 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Infrastructure/AdminConfig.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Config.Abstractions; 2 | 3 | namespace Mkh.Mod.Admin.Core.Infrastructure; 4 | 5 | /// 6 | /// 权限管理配置信息 7 | /// 8 | public class AdminConfig : IConfig 9 | { 10 | /// 11 | /// 账户默认密码(新增账户或者重置密码时使用) 12 | /// 13 | public string DefaultPassword { get; set; } = "123456"; 14 | } -------------------------------------------------------------------------------- /src/Utils/Utils/Enums/Whether.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Mkh.Utils.Enums; 4 | 5 | /// 6 | /// 是否 7 | /// 8 | public enum Whether 9 | { 10 | /// 11 | /// 是 12 | /// 13 | [Description("是")] 14 | True = 1, 15 | /// 16 | /// 否 17 | /// 18 | [Description("否")] 19 | False = 0 20 | } -------------------------------------------------------------------------------- /src/Config/Config.Abstractions/IConfigProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Mkh.Config.Abstractions; 2 | 3 | /// 4 | /// 配置提供器 5 | /// 6 | public interface IConfigProvider 7 | { 8 | /// 9 | /// 获取指定的配置实例 10 | /// 11 | /// 12 | /// 13 | TConfig Get() where TConfig : IConfig, new(); 14 | } -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Logger/IDbLoggerProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Mkh.Data.Abstractions.Logger; 2 | 3 | /// 4 | /// 数据库日志提供器 5 | /// 6 | public interface IDbLoggerProvider 7 | { 8 | /// 9 | /// 日志记录 10 | /// 11 | /// 操作类型 12 | /// SQL语句 13 | void Write(string action, string sql); 14 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/api/common/index.ts: -------------------------------------------------------------------------------- 1 | import http from '../http'; 2 | 3 | const urls = { 4 | //查询枚举选项列表 5 | ENUM_OPTIONS: 'Common/EnumOptions', 6 | //查询平台选项列表 7 | PLATFORM_OPTIONS: 'Common/PlatformOptions', 8 | } 9 | 10 | export default { 11 | queryEnumOptions: params => http.get(urls.ENUM_OPTIONS, params), 12 | queryPlatformOptions: () => http.get(urls.PLATFORM_OPTIONS), 13 | } 14 | -------------------------------------------------------------------------------- /modules/WebHost/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "WebHost": { 4 | "commandName": "Project", 5 | "dotnetRunMessages": "true", 6 | "launchBrowser": true, 7 | "launchUrl": "swagger", 8 | "applicationUrl": "http://localhost:6220", 9 | "environmentVariables": { 10 | "ASPNETCORE_ENVIRONMENT": "Development" 11 | } 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Excel/Excel.Abstractions/ExcelOptions.cs: -------------------------------------------------------------------------------- 1 | namespace Mkh.Excel.Abstractions; 2 | 3 | /// 4 | /// Excel操作配置项 5 | /// 6 | public class ExcelOptions 7 | { 8 | /// 9 | /// 提供程序 10 | /// 11 | public string Provider { get; set; } 12 | 13 | /// 14 | /// Excel操作时产生的临时文件存储根路径 15 | /// 16 | public string TempDir { get; set; } 17 | } -------------------------------------------------------------------------------- /src/MessageQueue/MessageQueue.RabbitMQ/DefaultExchange.cs: -------------------------------------------------------------------------------- 1 | namespace Mkh.MessageQueue.RabbitMQ; 2 | 3 | /// 4 | /// 默认交换器 5 | /// 6 | internal static class DefaultExchange 7 | { 8 | public const string Direct = "nm.direct"; 9 | 10 | public const string Fanout = "nm.fanout"; 11 | 12 | public const string Topic = "nm.topic"; 13 | 14 | public const string Headers = "nm.headers"; 15 | } -------------------------------------------------------------------------------- /test/02_Data/Data.Adapter.PostgreSQL.Test/Domain/MoreDataType/IMoreDataTypeRepository.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Data.Adapter.PostgreSQL.Test.Domain.MoreDataType; 9 | 10 | public interface IMoreDataTypeRepository : IRepository 11 | { 12 | } 13 | -------------------------------------------------------------------------------- /src/Excel/Providers/Excel.EPPlus/Excel.EPPlus.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17MKH Excel EPPlus实现库 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Entities/Entity.cs: -------------------------------------------------------------------------------- 1 | namespace Mkh.Data.Abstractions.Entities; 2 | 3 | /// 4 | /// 包含指定类型主键的实体 5 | /// 6 | public abstract class Entity : IEntity 7 | { 8 | /// 9 | /// 主键 10 | /// 11 | public virtual TKey Id { get; set; } 12 | } 13 | 14 | /// 15 | /// 含有自增主键的实体 16 | /// 17 | public class Entity : Entity 18 | { 19 | 20 | } -------------------------------------------------------------------------------- /src/TaskScheduler/TaskScheduler.Abstractions/ITask.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Quartz; 3 | 4 | namespace Mkh.TaskScheduler.Abstractions 5 | { 6 | public interface ITask : IJob 7 | { 8 | /// 9 | /// 执行 10 | /// 11 | /// 12 | /// 13 | Task Execute(TaskExecutionContext context); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/build/app.config.ts: -------------------------------------------------------------------------------- 1 | /** 应用模式 */ 2 | 3 | import { defineConfig } from 'vite' 4 | import useBaseConfig from './base.config' 5 | 6 | export default defineConfig(({ mode, command }) => { 7 | const config = useBaseConfig({ target: 'app', mode, command }) 8 | 9 | if (mode == 'production') { 10 | config.build = { 11 | outDir: '../../WebHost/wwwroot/web', 12 | } 13 | } 14 | return config 15 | }) 16 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/components/platform-select/index.vue: -------------------------------------------------------------------------------- 1 | 4 | 17 | -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Annotations/TransactionAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data; 3 | 4 | namespace Mkh.Data.Abstractions.Annotations; 5 | 6 | /// 7 | /// 特性事务 8 | /// 9 | [AttributeUsage(AttributeTargets.Method)] 10 | public class TransactionAttribute : Attribute 11 | { 12 | /// 13 | /// 事务隔离级别 14 | /// 15 | public IsolationLevel? IsolationLevel { get; set; } 16 | } -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Entities/ITenant.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mkh.Data.Abstractions.Entities; 4 | 5 | /// 6 | /// 实体租户扩展 7 | /// 8 | public interface ITenant 9 | { 10 | /// 11 | /// 租户编号 12 | /// 13 | TKey TenantId { get; set; } 14 | } 15 | 16 | /// 17 | /// 实体租户扩展 18 | /// 19 | public interface ITenant : ITenant 20 | { 21 | 22 | } -------------------------------------------------------------------------------- /test/02_Data/Data.Web.Test/Data.Web.Test.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Query/QuerySortDto.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions.Pagination; 2 | 3 | namespace Mkh.Data.Abstractions.Query; 4 | 5 | /// 6 | /// 查询排序 7 | /// 8 | public class QuerySortDto 9 | { 10 | /// 11 | /// 字段 12 | /// 13 | public string Field { get; set; } 14 | 15 | /// 16 | /// 排序类型 17 | /// 18 | public SortType Type { get; set; } 19 | } -------------------------------------------------------------------------------- /test/01_Utils/Utils.Tests/Product.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Utils.Tests 5 | { 6 | public class Product 7 | { 8 | public int Id { get; set; } 9 | 10 | public string Title { get; set; } 11 | 12 | public decimal Price { get; set; } 13 | 14 | public IList Tags { get; set; } 15 | 16 | public DateTime PublishDate { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Cache/Cache.Core/Cache.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17MKH 缓存内存中缓存实现库 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Schema/TableSchema.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Mkh.Data.Abstractions.Schema; 4 | 5 | /// 6 | /// 表结构 7 | /// 8 | public class TableSchema 9 | { 10 | /// 11 | /// 表名称 12 | /// 13 | public string Name { get; set; } 14 | 15 | /// 16 | /// 列集合 17 | /// 18 | public List Columns { get; set; } 19 | } -------------------------------------------------------------------------------- /src/MessageQueue/MessageQueue.RabbitMQ/MessageQueue.RabbitMQ.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17MKH RabbitMQ库 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/Module/Module.Web/IModuleMvcOptionsConfigurator.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | 3 | namespace Mkh.Module.Web; 4 | 5 | /// 6 | /// 模块MVC配置项配置器接口 7 | /// 当模块中有需要配置MVC功能时,可通过实现该接口来配置 8 | /// 9 | public interface IModuleMvcOptionsConfigurator 10 | { 11 | /// 12 | /// 配置MVC 13 | /// 14 | /// 15 | void Configure(MvcOptions mvcOptions); 16 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Infrastructure/AdminException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mkh.Utils.Exceptions; 3 | 4 | namespace Mkh.Mod.Admin.Core.Infrastructure; 5 | 6 | public class AdminException : MkhBusinessException 7 | { 8 | public AdminException(Enum errorCode) : base("Admin", errorCode) 9 | { 10 | } 11 | 12 | public static void Throw(AdminErrorCode errorCode) 13 | { 14 | throw new AdminException(errorCode); 15 | } 16 | } -------------------------------------------------------------------------------- /src/Auth/Auth.Abstractions/Auth.Abstractions.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17MKH认证与授权抽象库 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/Auth/Auth.Abstractions/IPermissionResolver.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Mkh.Auth.Abstractions; 4 | 5 | /// 6 | /// 权限解析器 7 | /// 8 | public interface IPermissionResolver 9 | { 10 | /// 11 | /// 获取指定模块的权限列表 12 | /// 13 | /// 模块编码 14 | /// 15 | List GetPermissions(string moduleCode); 16 | } -------------------------------------------------------------------------------- /src/Cache/Cache.Abstractions/Cache.Abstractions.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17MKH 缓存抽象库 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/api/dict/index.ts: -------------------------------------------------------------------------------- 1 | import { crud } from 'mkh-ui' 2 | import http from '../http' 3 | 4 | const urls = { 5 | SELECT: 'Dict/Select', 6 | TREE: 'Dict/Tree', 7 | CASCADER: 'Dict/Cascader', 8 | } 9 | 10 | export default { 11 | ...crud(http, 'Dict'), 12 | select: (params) => http.get(urls.SELECT, params), 13 | tree: (params) => http.get(urls.TREE, params), 14 | cascader: (params) => http.get(urls.CASCADER, params), 15 | } 16 | -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Schema/DatabaseSchema.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Mkh.Data.Abstractions.Schema; 4 | 5 | /// 6 | /// 数据库结构 7 | /// 8 | public class DatabaseSchema 9 | { 10 | /// 11 | /// 数据库名称 12 | /// 13 | public string Name { get; set; } 14 | 15 | /// 16 | /// 表集合 17 | /// 18 | public List Tables { get; set; } 19 | } -------------------------------------------------------------------------------- /src/Utils/Utils/Exceptions/MkhSystemException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mkh.Utils.Exceptions; 4 | 5 | /// 6 | /// 由MKH系统抛出的系统异常 7 | /// 8 | public abstract class MkhSystemException : Exception 9 | { 10 | public string Module { get; } 11 | 12 | public string Code { get; } 13 | 14 | protected MkhSystemException(string module, string code) 15 | { 16 | Module = module; 17 | Code = code; 18 | } 19 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "env": { 4 | "browser": true, 5 | "es2021": true, 6 | "node": true 7 | }, 8 | "extends": [ 9 | "plugin:vue/vue3-recommended", 10 | "eslint:recommended", 11 | "@vue/typescript/recommended", 12 | "@vue/prettier", 13 | "@vue/prettier/@typescript-eslint" 14 | ], 15 | "parserOptions": { 16 | "ecmaVersion": 2021 17 | }, 18 | "plugins": [], 19 | "rules": {} 20 | } -------------------------------------------------------------------------------- /src/Module/Module.Core/Module.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17mkh模块化核心库 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /test/01_Utils/Utils.Tests/Models/ResultModelTests.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json; 2 | using Mkh; 3 | using Xunit; 4 | 5 | namespace Utils.Tests.Models 6 | { 7 | public class ResultModelTests 8 | { 9 | [Fact] 10 | public void SuccessTest() 11 | { 12 | var result = ResultModel.Success(); 13 | var json = JsonSerializer.Serialize(result); 14 | 15 | Assert.NotNull(json); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Auth/Auth.Abstractions/IPermissionValidateHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | 4 | namespace Mkh.Auth.Abstractions; 5 | 6 | /// 7 | /// 权限验证处理接口 8 | /// 9 | public interface IPermissionValidateHandler 10 | { 11 | /// 12 | /// 验证 13 | /// 14 | /// 15 | Task Validate(IDictionary routeValues, HttpMethod httpMethod); 16 | } -------------------------------------------------------------------------------- /src/Utils/Utils/Models/OptionCollectionResultModel.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Utils.Abstracts; 2 | 3 | // ReSharper disable once CheckNamespace 4 | namespace Mkh; 5 | 6 | /// 7 | /// 选项集合模型 8 | /// 9 | public class OptionCollectionResultModel : CollectionAbstract> 10 | { 11 | } 12 | 13 | /// 14 | /// 选项集合模型 15 | /// 16 | public class OptionCollectionResultModel : OptionCollectionResultModel 17 | { 18 | 19 | } -------------------------------------------------------------------------------- /modules/01_Blog/Blog.UI/src/main.js: -------------------------------------------------------------------------------- 1 | import { configure } from 'mkh-ui' 2 | import 'mkh-ui/lib/style.css' 3 | import zhCN from '@mkh-locale/zh-cn' 4 | import en from '@mkh-locale/en' 5 | import 'mkh-mod-admin' 6 | import 'mkh-mod-admin/lib/style.css' 7 | import './index' 8 | 9 | configure({ locale: { messages: [zhCN, en] } }) 10 | 11 | mkh.config.component.login = 'k' 12 | mkh.config.site.title = '通用统一认证平台' 13 | mkh.config.http.global.baseURL = 'http://localhost:6220/api/' 14 | -------------------------------------------------------------------------------- /src/Data/Data.Core/Internal/DefaultOperatorResolver.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mkh.Data.Abstractions; 3 | 4 | namespace Mkh.Data.Core.Internal; 5 | 6 | /// 7 | /// 默认账户解析器 8 | /// 9 | internal class DefaultOperatorResolver : IOperatorResolver 10 | { 11 | public Guid? TenantId => null; 12 | 13 | public string TenantName => string.Empty; 14 | 15 | public Guid? AccountId => null; 16 | 17 | public string AccountName => string.Empty; 18 | } -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/ICodeFirstProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Mkh.Data.Abstractions; 2 | 3 | /// 4 | /// 代码优先提供器 5 | /// 6 | public interface ICodeFirstProvider 7 | { 8 | /// 9 | /// 创建库 10 | /// 11 | void CreateDatabase(); 12 | 13 | /// 14 | /// 创建表 15 | /// 16 | void CreateTable(); 17 | 18 | /// 19 | /// 创建表 20 | /// 21 | void CreateNextTable(); 22 | } -------------------------------------------------------------------------------- /test/02_Data/Data.Core.Test/EntityDescriptorTests.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | namespace Data.Core.Test 4 | { 5 | public class EntityDescriptorTests : DbContextTests 6 | { 7 | //表名称测试 8 | [Fact] 9 | public void TableNameTest() 10 | { 11 | Assert.Equal("Article", _articleRepository.EntityDescriptor.TableName); 12 | Assert.Equal("MyCategory", _categoryRepository.EntityDescriptor.TableName); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Application/MenuGroup/Dto/MenuGroupAddDto.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using Mkh.Mod.Admin.Core.Domain.MenuGroup; 3 | using Mkh.Utils.Annotations; 4 | 5 | namespace Mkh.Mod.Admin.Core.Application.MenuGroup.Dto; 6 | 7 | [ObjectMap(typeof(MenuGroupEntity))] 8 | public class MenuGroupAddDto 9 | { 10 | [Required(ErrorMessage = "请输入分组名称")] 11 | public string Name { get; set; } 12 | 13 | public string Remarks { get; set; } 14 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/api/account/index.ts: -------------------------------------------------------------------------------- 1 | import type { UpdateSkinDto } from 'mkh-ui' 2 | import { crud } from 'mkh-ui' 3 | import http from '../http' 4 | 5 | export default { 6 | /**增删改查 */ 7 | ...crud(http, 'Account'), 8 | /** 9 | * 获取账户默认密码 10 | */ 11 | getDefaultPassword: () => http.get('Account/DefaultPassword'), 12 | /** 13 | * 更新皮肤 14 | */ 15 | updateSkin: (params: UpdateSkinDto) => http.post('Account/UpdateSkin', params), 16 | } 17 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/api/menu/index.ts: -------------------------------------------------------------------------------- 1 | import { crud } from 'mkh-ui' 2 | import http from '../http' 3 | 4 | const urls = { 5 | GROUP_SELECT: 'Menu/GroupSelect', 6 | TREE: 'Menu/Tree', 7 | UPDATE_SORT: 'Menu/UpdateSort', 8 | } 9 | 10 | export default { 11 | ...crud(http, 'Menu'), 12 | getGroupSelect: () => http.get(urls.GROUP_SELECT), 13 | getTree: (params) => http.get(urls.TREE, params), 14 | updateSort: (sorts) => http.post(urls.UPDATE_SORT, sorts), 15 | } 16 | -------------------------------------------------------------------------------- /src/Auth/Auth.Core/DefaultPermissionValidateHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | using Mkh.Auth.Abstractions; 4 | 5 | namespace Mkh.Auth.Core 6 | { 7 | internal class DefaultPermissionValidateHandler : IPermissionValidateHandler 8 | { 9 | public Task Validate(IDictionary routeValues, HttpMethod httpMethod) 10 | { 11 | return Task.FromResult(true); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Utils/Utils.Web/ActionDescriptor.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Mkh.Utils.Web; 5 | 6 | /// 7 | /// 操作描述符 8 | /// 9 | public class ActionDescriptor 10 | { 11 | /// 12 | /// 名称 13 | /// 14 | public string Name { get; set; } 15 | 16 | /// 17 | /// 方法信息 18 | /// 19 | [JsonIgnore] 20 | public MethodInfo MethodInfo { get; set; } 21 | } -------------------------------------------------------------------------------- /test/02_Data/Data.Adapter.PostgreSQL.Test/Infrastructure/Repositories/JsonRepository.cs: -------------------------------------------------------------------------------- 1 | using Data.Adapter.PostgreSQL.Test.Domain.Json; 2 | using Mkh.Data.Core.Repository; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Data.Adapter.PostgreSQL.Test.Infrastructure.Repositories; 10 | 11 | internal class JsonRepository : RepositoryAbstract, IJsonRepository 12 | { 13 | } 14 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Application/Dict/Dto/DictUpdateDto.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using Mkh.Mod.Admin.Core.Domain.Dict; 3 | using Mkh.Utils.Annotations; 4 | 5 | namespace Mkh.Mod.Admin.Core.Application.Dict.Dto; 6 | 7 | [ObjectMap(typeof(DictEntity), true)] 8 | public class DictUpdateDto : DictAddDto 9 | { 10 | [Required(ErrorMessage = "请选择要修改的字典")] 11 | [Range(1, int.MaxValue, ErrorMessage = "请选择要修改的字典")] 12 | public int Id { get; set; } 13 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Application/Menu/Dto/MenuUpdateDto.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using Mkh.Mod.Admin.Core.Domain.Menu; 3 | using Mkh.Utils.Annotations; 4 | 5 | namespace Mkh.Mod.Admin.Core.Application.Menu.Dto; 6 | 7 | [ObjectMap(typeof(MenuEntity), true)] 8 | public class MenuUpdateDto : MenuAddDto 9 | { 10 | [Required(ErrorMessage = "请选择要修改的菜单")] 11 | [Range(1, int.MaxValue, ErrorMessage = "请选择要修改的菜单")] 12 | public int Id { get; set; } 13 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Domain/Account/AccountEntity.Extend.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions.Annotations; 2 | 3 | namespace Mkh.Mod.Admin.Core.Domain.Account; 4 | 5 | public partial class AccountEntity 6 | { 7 | /// 8 | /// 租户名称 9 | /// 10 | [NotMappingColumn] 11 | public string TenantName { get; set; } 12 | 13 | /// 14 | /// 角色名称 15 | /// 16 | [NotMappingColumn] 17 | public string RoleName { get; set; } 18 | } -------------------------------------------------------------------------------- /src/Auth/Auth.Abstractions/ICredentialBuilder.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Security.Claims; 3 | using System.Threading.Tasks; 4 | 5 | namespace Mkh.Auth.Abstractions; 6 | 7 | /// 8 | /// 认证凭证构造器 9 | /// 10 | public interface ICredentialBuilder 11 | { 12 | /// 13 | /// 生成凭证 14 | /// 15 | /// 账户声明 16 | /// 17 | Task Build(List claims); 18 | } -------------------------------------------------------------------------------- /src/Config/Config.Core/Config.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17MKH 配置核心库 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/Data/Adapters/Data.Adapter.Sqlite/GuidTypeHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Dapper; 3 | 4 | namespace Mkh.Data.Adapter.Sqlite; 5 | 6 | public class GuidTypeHandler : SqlMapper.TypeHandler 7 | { 8 | public override Guid Parse(object value) 9 | { 10 | return Guid.Parse(value.ToString()); 11 | } 12 | 13 | public override void SetValue(System.Data.IDbDataParameter parameter, Guid value) 14 | { 15 | parameter.Value = value.ToString(); 16 | } 17 | } -------------------------------------------------------------------------------- /src/Mapper/Mapper/Mapper.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17MKH 对象映射库 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/TaskScheduler/TaskScheduler.Abstractions/TaskExecutionContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Quartz; 3 | 4 | namespace Mkh.TaskScheduler.Abstractions 5 | { 6 | /// 7 | /// 任务执行上下文 8 | /// 9 | public class TaskExecutionContext 10 | { 11 | /// 12 | /// 任务编号 13 | /// 14 | public Guid TaskId { get; set; } 15 | 16 | public IJobExecutionContext JobExecutionContext { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/locales/index.ts: -------------------------------------------------------------------------------- 1 | import { useI18n as usei18n } from 'vue-i18n' 2 | import { Locale, MkhMessagesSchema } from 'mkh-ui' 3 | import { AdminMessagesSchema } from '@/locales/lang/zh-cn/index' 4 | 5 | const useI18n = () => { 6 | return usei18n< 7 | { 8 | message: { 9 | mkh: MkhMessagesSchema 10 | mod: { 11 | admin: AdminMessagesSchema 12 | } 13 | } 14 | }, 15 | Locale 16 | >() 17 | } 18 | 19 | export { useI18n } 20 | -------------------------------------------------------------------------------- /src/Cache/Cache.Abstractions/ICacheBuilder.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | 3 | namespace Mkh.Cache.Abstractions 4 | { 5 | /// 6 | /// 缓存构造器 7 | /// 8 | public interface ICacheBuilder 9 | { 10 | /// 11 | /// 服务 12 | /// 13 | IServiceCollection Services { get; } 14 | 15 | /// 16 | /// 构造 17 | /// 18 | void Build(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Idenity/Identity.Core/Identity.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17MKH Identity Core 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Infrastructure/ModuleServicesConfigurator.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Module.Abstractions; 2 | 3 | namespace Mkh.Mod.Admin.Core.Infrastructure; 4 | 5 | public class ModuleServicesConfigurator : IModuleServicesConfigurator 6 | { 7 | public void PreConfigure(ModuleConfigureContext context) 8 | { 9 | } 10 | 11 | public void Configure(ModuleConfigureContext context) 12 | { 13 | } 14 | 15 | public void PostConfigure(ModuleConfigureContext context) 16 | { 17 | } 18 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/components/module-select/index.vue: -------------------------------------------------------------------------------- 1 | 4 | 21 | -------------------------------------------------------------------------------- /src/Utils/Utils.Web/Utils.Web.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17mkh基础Web通用库 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /test/02_Data/Data.Web.Test/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "profiles": { 4 | "Data.Web.Test": { 5 | "commandName": "Project", 6 | "dotnetRunMessages": "true", 7 | "launchBrowser": true, 8 | "launchUrl": "TransactionAttribute", 9 | "applicationUrl": "http://localhost:5000", 10 | "environmentVariables": { 11 | "ASPNETCORE_ENVIRONMENT": "Development" 12 | } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Excel/Excel.Abstractions/ExcelModel.cs: -------------------------------------------------------------------------------- 1 | namespace Mkh.Excel.Abstractions; 2 | 3 | /// 4 | /// Excel模型 5 | /// 6 | public class ExcelModel 7 | { 8 | /// 9 | /// 文件名 10 | /// 11 | public string FileName { get; set; } 12 | 13 | /// 14 | /// 存储名称 15 | /// 16 | public string StorageName { get; set; } 17 | 18 | /// 19 | /// 存储路径 20 | /// 21 | public string StoragePath { get; set; } 22 | } -------------------------------------------------------------------------------- /src/Utils/Utils/Models/FileDownloadModel.cs: -------------------------------------------------------------------------------- 1 | namespace Mkh.Utils.Models; 2 | 3 | /// 4 | /// 文件下载模型 5 | /// 6 | public class FileDownloadModel 7 | { 8 | /// 9 | /// 文件完整路径 10 | /// 11 | public string FilePath { get; set; } 12 | 13 | /// 14 | /// 文件名 15 | /// 16 | public string FileName { get; set; } 17 | 18 | /// 19 | /// 文件内容类型 20 | /// 21 | public string ContentType { get; set; } 22 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Application/DictItem/Dto/DictItemUpdateDto.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using Mkh.Mod.Admin.Core.Domain.DictItem; 3 | using Mkh.Utils.Annotations; 4 | 5 | namespace Mkh.Mod.Admin.Core.Application.DictItem.Dto; 6 | 7 | [ObjectMap(typeof(DictItemEntity), true)] 8 | public class DictItemUpdateDto : DictItemAddDto 9 | { 10 | [Required(ErrorMessage = "请选择要修改的字典项")] 11 | [Range(1, int.MaxValue, ErrorMessage = "请选择要修改的字典项")] 12 | public int Id { get; set; } 13 | } -------------------------------------------------------------------------------- /src/Data/Data.Core/Internal/DbConstants.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mkh.Data.Abstractions.Entities; 3 | 4 | namespace Mkh.Data.Core.Internal; 5 | 6 | /// 7 | /// 数据库相关常量 8 | /// 9 | internal static class DbConstants 10 | { 11 | /// 12 | /// 租户列名称 13 | /// 14 | public const string TENANT_COLUMN_NAME = "TenantId"; 15 | 16 | /// 17 | /// 18 | /// 19 | public static readonly Type ENTITY_INTERFACE_TYPE = typeof(IEntity); 20 | 21 | } -------------------------------------------------------------------------------- /src/TaskScheduler/TaskScheduler.Core/TaskScheduler.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17MKH 任务调度核心库 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/02_Data/Data.Common.Test/Domain/Category/CategoryEntity.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions.Annotations; 2 | using Mkh.Data.Abstractions.Entities; 3 | 4 | namespace Data.Common.Test.Domain.Category 5 | { 6 | /// 7 | /// 文章分类 8 | /// 9 | [Table("MyCategory")] 10 | public class CategoryEntity : EntityBase 11 | { 12 | /// 13 | /// 名称 14 | /// 15 | [Length(100)] 16 | public string Name { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Application/DictGroup/Dto/DictGroupUpdateDto.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using Mkh.Mod.Admin.Core.Domain.DictGroup; 3 | using Mkh.Utils.Annotations; 4 | 5 | namespace Mkh.Mod.Admin.Core.Application.DictGroup.Dto; 6 | 7 | [ObjectMap(typeof(DictGroupEntity), true)] 8 | public class DictGroupUpdateDto : DictGroupAddDto 9 | { 10 | [Required(ErrorMessage = "请选择要修改的分组")] 11 | [Range(1, int.MaxValue, ErrorMessage = "请选择要修改的分组")] 12 | public int Id { get; set; } 13 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Application/MenuGroup/Dto/MenuGroupUpdateDto.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using Mkh.Mod.Admin.Core.Domain.MenuGroup; 3 | using Mkh.Utils.Annotations; 4 | 5 | namespace Mkh.Mod.Admin.Core.Application.MenuGroup.Dto; 6 | 7 | [ObjectMap(typeof(MenuGroupEntity), true)] 8 | public class MenuGroupUpdateDto : MenuGroupAddDto 9 | { 10 | [Required(ErrorMessage = "请选择要修改的分组")] 11 | [Range(1, int.MaxValue, ErrorMessage = "请选择要修改的分组")] 12 | public int Id { get; set; } 13 | } -------------------------------------------------------------------------------- /src/Auth/Auth.Core/DefaultTenantResolver.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Mkh.Auth.Abstractions; 4 | 5 | namespace Mkh.Auth.Core 6 | { 7 | public class DefaultTenantResolver : ITenantResolver 8 | { 9 | public Task ResolveId() 10 | { 11 | return Task.FromResult(null); 12 | } 13 | 14 | public Task GetTenantName(Guid? id) 15 | { 16 | return Task.FromResult(string.Empty); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Cache/Cache.Core/CacheBuilder.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | using Mkh.Cache.Abstractions; 3 | 4 | namespace Mkh.Cache.Core 5 | { 6 | internal class CacheBuilder : ICacheBuilder 7 | { 8 | public CacheBuilder(IServiceCollection services) 9 | { 10 | Services = services; 11 | } 12 | 13 | public IServiceCollection Services { get; } 14 | 15 | public void Build() 16 | { 17 | //暂时没什么可以构造的 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Cache/Cache.Redis/RedisOptions.cs: -------------------------------------------------------------------------------- 1 | namespace Mkh.Cache.Redis; 2 | 3 | /// 4 | /// Redis配置项 5 | /// 6 | public class RedisOptions 7 | { 8 | /// 9 | /// 默认数据库 10 | /// 11 | public int DefaultDb { get; set; } 12 | 13 | /// 14 | /// 缓存键前缀 15 | /// 16 | public string KeyPrefix { get; set; } 17 | 18 | /// 19 | /// 连接字符串 20 | /// 21 | public string ConnectionString { get; set; } = "127.0.0.1"; 22 | } -------------------------------------------------------------------------------- /modules/01_Blog/Blog.Core/Domain/Article/ArticleEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mkh.Data.Abstractions.Annotations; 3 | using Mkh.Data.Abstractions.Entities; 4 | 5 | namespace Blog.Core.Domain.Article 6 | { 7 | [Table("Article")] 8 | public class ArticleEntity : EntityBaseSoftDelete, ITenant 9 | { 10 | public Guid? TenantId { get; set; } 11 | 12 | /// 13 | /// 标题 14 | /// 15 | [Length(300)] 16 | public string Title { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/IRepositoryManager.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Mkh.Data.Abstractions; 4 | 5 | /// 6 | /// 仓储管理器,用于管理当前请求中(Scoped模式注入)的仓储实例 7 | /// 8 | public interface IRepositoryManager 9 | { 10 | /// 11 | /// 仓储实例列表 12 | /// 13 | List Repositories { get; } 14 | 15 | /// 16 | /// 添加仓储实例 17 | /// 18 | /// 19 | void Add(IRepository repository); 20 | } -------------------------------------------------------------------------------- /src/Excel/Excel.Abstractions/Export/IExcelExportQuery.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions.Entities; 2 | 3 | namespace Mkh.Excel.Abstractions.Export; 4 | 5 | /// 6 | /// 为查询Dto添加Excel导出功能 7 | /// 8 | public interface IExcelExportQuery where TEntity : IEntity 9 | { 10 | /// 11 | /// 是否是导出请求 12 | /// 13 | bool IsExport { get; set; } 14 | 15 | /// 16 | /// 导出模型 17 | /// 18 | ExcelExportEntityModel ExportModel { get; set; } 19 | } -------------------------------------------------------------------------------- /test/01_Utils/Utils.Tests/BaseTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.Extensions.DependencyInjection; 3 | using Mkh.Utils; 4 | 5 | namespace Utils.Tests 6 | { 7 | public class BaseTest 8 | { 9 | protected readonly IServiceProvider ServiceProvider; 10 | 11 | public BaseTest() 12 | { 13 | var services = new ServiceCollection(); 14 | services.AddServicesFromAttribute(); 15 | ServiceProvider = services.BuildServiceProvider(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Infrastructure/AdminLocalizer.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Localization; 2 | using Mkh.Module.Core; 3 | using Mkh.Utils.Annotations; 4 | 5 | namespace Mkh.Mod.Admin.Core.Infrastructure 6 | { 7 | /// 8 | /// Admin 多语言 9 | /// 10 | [SingletonInject(true)] 11 | public class AdminLocalizer : ModuleLocalizerAbstract 12 | { 13 | public AdminLocalizer(IStringLocalizer localizer) : base(localizer) 14 | { 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Infrastructure/Defaults/DefaultCredentialClaimExtender.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Security.Claims; 4 | using System.Threading.Tasks; 5 | using Mkh.Utils.Annotations; 6 | 7 | namespace Mkh.Mod.Admin.Core.Infrastructure.Defaults; 8 | 9 | [ScopedInject] 10 | internal class DefaultCredentialClaimExtender : ICredentialClaimExtender 11 | { 12 | public Task Extend(List claims, Guid accountId) 13 | { 14 | return Task.CompletedTask; 15 | } 16 | } -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/IUnitOfWork.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data; 3 | 4 | namespace Mkh.Data.Abstractions; 5 | 6 | /// 7 | /// 工作单元接口 8 | /// 9 | public interface IUnitOfWork : IDisposable 10 | { 11 | /// 12 | /// 事务 13 | /// 14 | IDbTransaction Transaction { get; } 15 | 16 | /// 17 | /// 保存变更 18 | /// 19 | void SaveChanges(); 20 | 21 | /// 22 | /// 回滚 23 | /// 24 | void Rollback(); 25 | } -------------------------------------------------------------------------------- /src/Excel/Excel.Abstractions/Excel.Abstractions.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17MKH Excel抽象库 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/02_Data/Data.Adapter.PostgreSQL.Test/Domain/Json/JsonEntity.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions.Annotations; 2 | using Mkh.Data.Abstractions.Entities; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Data.Adapter.PostgreSQL.Test.Domain.Json; 10 | 11 | [Table("json_test")] 12 | public class JsonEntity : EntityBaseSoftDelete 13 | { 14 | [Column("body", Type = "jsonb")] 15 | public string Body { get; set; } 16 | } 17 | -------------------------------------------------------------------------------- /test/02_Data/Data.Common.Test/CustomAccountResolver.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mkh.Data.Abstractions; 3 | 4 | namespace Data.Common.Test 5 | { 6 | /// 7 | /// 自定义账户信息解析器 8 | /// 9 | public class CustomAccountResolver : IOperatorResolver 10 | { 11 | public Guid? TenantId => Guid.Parse("39f08cfd-8e0d-771b-a2f3-2639a62ca2fa"); 12 | public Guid? AccountId => Guid.Parse("49f08cfd-8e0d-771b-a2f3-2639a62ca2fa"); 13 | public string AccountName => "OLDLI"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Application/Dict/Dto/DictQueryDto.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions.Query; 2 | 3 | namespace Mkh.Mod.Admin.Core.Application.Dict.Dto; 4 | 5 | public class DictQueryDto : QueryDto 6 | { 7 | /// 8 | /// 分组编码 9 | /// 10 | public string GroupCode { get; set; } 11 | 12 | /// 13 | /// 名称 14 | /// 15 | public string Name { get; set; } 16 | 17 | /// 18 | /// 编码 19 | /// 20 | public string Code { get; set; } 21 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Application/Menu/Dto/MenuQueryDto.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions.Query; 2 | 3 | namespace Mkh.Mod.Admin.Core.Application.Menu.Dto; 4 | 5 | public class MenuQueryDto : QueryDto 6 | { 7 | /// 8 | /// 分组编号 9 | /// 10 | public int GroupId { get; set; } 11 | 12 | /// 13 | /// 父节点 14 | /// 15 | public int ParentId { get; set; } 16 | 17 | /// 18 | /// 菜单名称 19 | /// 20 | public string Name { get; set; } 21 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Application/Role/Dto/RoleUpdateDto.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using Mkh.Mod.Admin.Core.Domain.Role; 3 | using Mkh.Utils.Annotations; 4 | 5 | namespace Mkh.Mod.Admin.Core.Application.Role.Dto; 6 | 7 | /// 8 | /// 角色更新 9 | /// 10 | [ObjectMap(typeof(RoleEntity), true)] 11 | public class RoleUpdateDto : RoleAddDto 12 | { 13 | [Required(ErrorMessage = "请选择要修改的角色")] 14 | [Range(1, int.MaxValue, ErrorMessage = "请选择要修改的角色")] 15 | public int Id { get; set; } 16 | } -------------------------------------------------------------------------------- /src/Cache/Cache.Redis/Cache.Redis.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17MKH 缓存Redis实现库 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/IOperatorResolver.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mkh.Data.Abstractions; 4 | 5 | /// 6 | /// 操作员信息解析器 7 | /// 8 | public interface IOperatorResolver 9 | { 10 | /// 11 | /// 租户编号 12 | /// 13 | public Guid? TenantId { get; } 14 | 15 | /// 16 | /// 账户编号 17 | /// 18 | public Guid? AccountId { get; } 19 | 20 | /// 21 | /// 账户名称 22 | /// 23 | public string AccountName { get; } 24 | } -------------------------------------------------------------------------------- /src/Utils/Utils/Exceptions/MkhBusinessException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mkh.Utils.Exceptions; 4 | 5 | /// 6 | /// 由MKH系统抛出的业务异常 7 | /// 8 | public abstract class MkhBusinessException : Exception 9 | { 10 | public string ModuleCode { get; } 11 | 12 | public Enum ErrorCode { get; } 13 | 14 | protected MkhBusinessException(string moduleCode, Enum errorCode, string message = null) : base(message) 15 | { 16 | ModuleCode = moduleCode; 17 | ErrorCode = errorCode; 18 | } 19 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/options/locale.en.ts: -------------------------------------------------------------------------------- 1 | import type { MkhLocaleMessages } from 'mkh-ui' 2 | import el from 'element-plus/lib/locale/lang/en' 3 | import mkh from 'mkh-ui/lib/locales/en' 4 | import mod_admin from '@/locales/lang/en' 5 | import mod_admin_routes from '@/locales/lang/en/routes' 6 | 7 | const options: MkhLocaleMessages = { 8 | name: 'en', 9 | el: el, 10 | mkh: mkh, 11 | routes: { ...mod_admin_routes }, 12 | mod: { 13 | admin: mod_admin, 14 | }, 15 | skin: {}, 16 | } 17 | 18 | export default options 19 | -------------------------------------------------------------------------------- /src/Data/Data.Core/Internal/QueryStructure/QueryGroupBy.cs: -------------------------------------------------------------------------------- 1 | namespace Mkh.Data.Core.Internal.QueryStructure; 2 | 3 | /// 4 | /// 分组查询信息 5 | /// 6 | public class QueryGroupBy 7 | { 8 | /// 9 | /// 分组字段名称 10 | /// 11 | public string Field { get; set; } 12 | 13 | /// 14 | /// 分组字段表别名 15 | /// 16 | public string Alias { get; set; } 17 | 18 | /// 19 | /// 连接信息 20 | /// 21 | public QueryJoin Join { get; set; } 22 | 23 | } -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Query/IShardingByMonthQuery.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mkh.Data.Abstractions.Query 4 | { 5 | /// 6 | /// 按月分表查询 7 | /// 8 | public interface IShardingByMonthQuery 9 | { 10 | /// 11 | /// 开始日期 12 | /// 13 | [ShardingQueryValidation] 14 | DateTime StartDate { get; set; } 15 | 16 | /// 17 | /// 结束日期 18 | /// 19 | DateTime EndDate { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Application/Account/Dto/AccountQueryDto.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions.Query; 2 | 3 | namespace Mkh.Mod.Admin.Core.Application.Account.Dto; 4 | 5 | public class AccountQueryDto : QueryDto 6 | { 7 | /// 8 | /// 用户名 9 | /// 10 | public string Username { get; set; } 11 | 12 | /// 13 | /// 姓名 14 | /// 15 | public string Name { get; set; } 16 | 17 | /// 18 | /// 手机号 19 | /// 20 | public string Phone { get; set; } 21 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Application/Account/Dto/AccountUpdateDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using Mkh.Mod.Admin.Core.Domain.Account; 4 | using Mkh.Utils.Annotations; 5 | using Mkh.Utils.Validations; 6 | 7 | namespace Mkh.Mod.Admin.Core.Application.Account.Dto; 8 | 9 | [ObjectMap(typeof(AccountEntity), true)] 10 | public class AccountUpdateDto : AccountAddDto 11 | { 12 | [Required(ErrorMessage = "请选择账户")] 13 | [GuidNotEmptyValidation(ErrorMessage = "请选择账户")] 14 | public Guid Id { get; set; } 15 | } -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Descriptors/IRepositoryDescriptor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mkh.Data.Abstractions.Descriptors; 4 | 5 | /// 6 | /// 仓储描述符 7 | /// 8 | public interface IRepositoryDescriptor 9 | { 10 | /// 11 | /// 实体类型 12 | /// 13 | Type EntityType { get; } 14 | 15 | /// 16 | /// 仓储接口类型 17 | /// 18 | Type InterfaceType { get; } 19 | 20 | /// 21 | /// 仓储实现类型 22 | /// 23 | Type ImplementType { get; } 24 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/options/locale.zh-cn.ts: -------------------------------------------------------------------------------- 1 | import type { MkhLocaleMessages } from 'mkh-ui' 2 | import el from 'element-plus/lib/locale/lang/zh-cn' 3 | import mkh from 'mkh-ui/lib/locales/zh-cn' 4 | import mod_admin from '@/locales/lang/zh-cn' 5 | import mod_admin_routes from '@/locales/lang/zh-cn/routes' 6 | 7 | const options: MkhLocaleMessages = { 8 | name: 'zh-cn', 9 | el: el, 10 | mkh: mkh, 11 | routes: { ...mod_admin_routes }, 12 | mod: { 13 | admin: mod_admin, 14 | }, 15 | skin: {}, 16 | } 17 | 18 | export default options 19 | -------------------------------------------------------------------------------- /src/Auth/Auth.Abstractions/ITenantResolver.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | 4 | namespace Mkh.Auth.Abstractions; 5 | 6 | /// 7 | /// 租户解析器接口 8 | /// 9 | public interface ITenantResolver 10 | { 11 | /// 12 | /// 解析租户编号 13 | /// 14 | /// 15 | Task ResolveId(); 16 | 17 | /// 18 | /// 获取租户名称 19 | /// 20 | /// 21 | /// 22 | Task GetTenantName(Guid? id); 23 | } -------------------------------------------------------------------------------- /src/Mapper/Mapper/DefaultMapper.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Utils.Map; 2 | 3 | namespace Mkh.Mapper; 4 | 5 | public class DefaultMapper : IMapper 6 | { 7 | private readonly AutoMapper.IMapper _mapper; 8 | 9 | public DefaultMapper(AutoMapper.IMapper mapper) 10 | { 11 | _mapper = mapper; 12 | } 13 | 14 | public T Map(object source) 15 | { 16 | return _mapper.Map(source); 17 | } 18 | 19 | public void Map(TSource source, TTarget target) 20 | { 21 | _mapper.Map(source, target); 22 | } 23 | } -------------------------------------------------------------------------------- /src/Excel/Excel.Abstractions/ExcelOptionsBuilder.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | 3 | namespace Mkh.Excel.Abstractions 4 | { 5 | /// 6 | /// 用于给Provider提供配置 7 | /// 8 | public class ExcelOptionsBuilder 9 | { 10 | /// 11 | /// 配置项 12 | /// 13 | public ExcelOptions Options { get; set; } 14 | 15 | /// 16 | /// 服务集合 17 | /// 18 | public IServiceCollection Services { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Domain/MenuGroup/MenuGroupEntity.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions.Annotations; 2 | using Mkh.Data.Abstractions.Entities; 3 | 4 | namespace Mkh.Mod.Admin.Core.Domain.MenuGroup; 5 | 6 | /// 7 | /// 菜单组 8 | /// 9 | public class MenuGroupEntity : EntityBase 10 | { 11 | /// 12 | /// 分组名称 13 | /// 14 | public string Name { get; set; } 15 | 16 | /// 17 | /// 备注 18 | /// 19 | [Length(300)] 20 | [Nullable] 21 | public string Remarks { get; set; } 22 | } -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Data.Abstractions.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17MKH数据访问抽象库 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Extensions/EnumerableExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Mkh.Data.Abstractions.Extensions; 4 | 5 | public static class EnumerableExtensions 6 | { 7 | /// 8 | /// 不包含,对应数据库中的Not In 9 | /// 此方法仅用于Mkh.Data中构造查询条件使用 10 | /// 11 | /// 12 | /// 13 | /// 14 | public static bool NotContains(this IEnumerable list, T value) 15 | { 16 | return true; 17 | } 18 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/components/enum-radio/index.vue: -------------------------------------------------------------------------------- 1 | 4 | 22 | -------------------------------------------------------------------------------- /src/Auth/Auth.Abstractions/IPlatformProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Mkh.Auth.Abstractions; 4 | 5 | /// 6 | /// 平台提供器 7 | /// 8 | public interface IPlatformProvider 9 | { 10 | /// 11 | /// 将平台值转换为说明 12 | /// 13 | /// 14 | /// 15 | string ToDescription(int platform); 16 | 17 | /// 18 | /// 获取平台下拉列表 19 | /// 20 | /// 21 | List SelectOptions(); 22 | } -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Query/QueryPagingDto.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Mkh.Data.Abstractions.Query; 4 | 5 | /// 6 | /// 查询分页 7 | /// 8 | public class QueryPagingDto 9 | { 10 | /// 11 | /// 当前页 12 | /// 13 | public int Index { get; set; } = 1; 14 | 15 | /// 16 | /// 页大小 17 | /// 18 | public int Size { get; set; } = 15; 19 | 20 | /// 21 | /// 排序字段 22 | /// 23 | public List Sort { get; set; } 24 | } -------------------------------------------------------------------------------- /src/Data/Data.Core/DbLoggerProvider.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | using Mkh.Data.Abstractions.Logger; 3 | 4 | namespace Mkh.Data.Core; 5 | 6 | /// 7 | /// 默认日志记录器 8 | /// 9 | internal class DbLoggerProvider : IDbLoggerProvider 10 | { 11 | private readonly ILogger _logger; 12 | 13 | public DbLoggerProvider(ILogger logger) 14 | { 15 | _logger = logger; 16 | } 17 | 18 | public void Write(string action, string sql) 19 | { 20 | _logger.LogInformation($"{action}:{sql}"); 21 | } 22 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/api/index.ts: -------------------------------------------------------------------------------- 1 | import account from './account' 2 | import authorize from './authorize' 3 | import common from './common' 4 | import dict from './dict' 5 | import dictGroup from './dictGroup' 6 | import dictItem from './dictItem' 7 | import menu from './menu' 8 | import menuGroup from './menuGroup' 9 | import module from './module' 10 | import role from './role' 11 | 12 | export default { 13 | account, 14 | authorize, 15 | common, 16 | dict, 17 | dictGroup, 18 | dictItem, 19 | menu, 20 | menuGroup, 21 | module, 22 | role, 23 | } 24 | -------------------------------------------------------------------------------- /src/Logging/Logging.Core/Logging.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17MKH 日志核心库 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /test/02_Data/Data.Adapter.PostgreSQL.Test/Infrastructure/Repositories/MoreDataTypeRepository.cs: -------------------------------------------------------------------------------- 1 | using Data.Adapter.PostgreSQL.Test.Domain.Json; 2 | using Data.Adapter.PostgreSQL.Test.Domain.MoreDataType; 3 | using Mkh.Data.Core.Repository; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace Data.Adapter.PostgreSQL.Test.Infrastructure.Repositories; 11 | 12 | internal class MoreDataTypeRepository : RepositoryAbstract, IMoreDataTypeRepository 13 | { 14 | } 15 | -------------------------------------------------------------------------------- /test/01_Utils/Utils.Tests/Extensions/ArrayExtensionsTests.cs: -------------------------------------------------------------------------------- 1 | using Mkh; 2 | using Xunit; 3 | 4 | namespace Utils.Tests.Extensions 5 | { 6 | public class ArrayExtensionsTests 7 | { 8 | [Fact] 9 | public void RandomGetTest() 10 | { 11 | var arr = new string[5]; 12 | arr[0] = "1"; 13 | arr[1] = "2"; 14 | arr[2] = "3"; 15 | arr[3] = "4"; 16 | arr[4] = "5"; 17 | 18 | var item = arr.RandomGet(); 19 | 20 | Assert.NotNull(item); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Infrastructure/IAccountPermissionResolver.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Threading.Tasks; 4 | 5 | namespace Mkh.Mod.Admin.Core.Infrastructure; 6 | 7 | /// 8 | /// 账户权限解析器接口 9 | /// 10 | public interface IAccountPermissionResolver 11 | { 12 | /// 13 | /// 解析 14 | /// 15 | /// 账户编号 16 | /// 平台 17 | /// 18 | Task> Resolve(Guid accountId, int platform); 19 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/api/role/index.ts: -------------------------------------------------------------------------------- 1 | import { crud } from 'mkh-ui' 2 | import http from '../http' 3 | 4 | const urls = { 5 | /** 查询角色绑定的菜单信息 */ 6 | QUERY_BIND_MENUS: 'Role/QueryBindMenus', 7 | /** 更新角色绑定的菜单信息 */ 8 | UPDATE_BIND_MENUS: 'Role/UpdateBindMenus', 9 | /** 下拉列表 */ 10 | SELECT: 'Role/Select', 11 | } 12 | export default { 13 | ...crud(http, 'Role'), 14 | queryBindMenus: (params) => http.get(urls.QUERY_BIND_MENUS, params), 15 | updateBindMenus: (params) => http.post(urls.UPDATE_BIND_MENUS, params), 16 | select: () => http.get(urls.SELECT), 17 | } 18 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/components/enum-checkbox/index.vue: -------------------------------------------------------------------------------- 1 | 4 | 23 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/options/locale.th.ts: -------------------------------------------------------------------------------- 1 | import type { MkhLocaleMessages } from 'mkh-ui' 2 | import el from 'element-plus/lib/locale/lang/th' 3 | import mkh from 'mkh-ui/lib/locales/th' 4 | // import mkh from 'mkh-ui/lib/locales/en' 5 | import mod_admin from '@/locales/lang/th' 6 | import mod_admin_routes from '@/locales/lang/th/routes' 7 | 8 | const options: MkhLocaleMessages = { 9 | name: 'th', 10 | el: el, 11 | mkh: mkh, 12 | routes: { ...mod_admin_routes }, 13 | mod: { 14 | admin: mod_admin, 15 | }, 16 | skin: {}, 17 | } 18 | 19 | export default options 20 | -------------------------------------------------------------------------------- /src/Auth/Auth.Core/MkhAuthBuilder.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Configuration; 2 | using Microsoft.Extensions.DependencyInjection; 3 | 4 | namespace Mkh.Auth.Core; 5 | 6 | public class MkhAuthBuilder 7 | { 8 | public IServiceCollection Services { get; set; } 9 | 10 | /// 11 | /// 配置属性 12 | /// 13 | public IConfiguration Configuration { get; set; } 14 | 15 | public MkhAuthBuilder(IServiceCollection services, IConfiguration configuration) 16 | { 17 | Services = services; 18 | Configuration = configuration; 19 | } 20 | } -------------------------------------------------------------------------------- /src/Excel/Excel.Abstractions/Export/ExcelExportTemplateModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Mkh.Excel.Abstractions.Export 4 | { 5 | /// 6 | /// Excel导出模板模型 7 | /// 8 | public class ExcelExportTemplateModel 9 | { 10 | /// 11 | /// 模板属性列表 12 | /// 13 | public IList> Properties { get; set; } 14 | 15 | /// 16 | /// 模板路径 17 | /// 18 | public string TemplatePath { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/components/dict-select/index.vue: -------------------------------------------------------------------------------- 1 | 4 | 24 | -------------------------------------------------------------------------------- /src/Utils/Utils/Validations/PhoneValidationAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace Mkh.Utils.Validations 5 | { 6 | /// 7 | /// 手机号验证 8 | /// 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)] 10 | public class PhoneValidationAttribute : RegularExpressionAttribute 11 | { 12 | public PhoneValidationAttribute() : base("^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\\d{8}$") 13 | { 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Infrastructure/IPasswordHandler.cs: -------------------------------------------------------------------------------- 1 | namespace Mkh.Mod.Admin.Core.Infrastructure; 2 | 3 | /// 4 | /// 密码处理器接口 5 | /// 6 | public interface IPasswordHandler 7 | { 8 | /// 9 | /// 加密 10 | /// 11 | /// 明文密码 12 | /// 13 | string Encrypt(string password); 14 | 15 | /// 16 | /// 解密 17 | /// 18 | /// 密文密码 19 | /// 20 | string Decrypt(string encryptPassword); 21 | } -------------------------------------------------------------------------------- /src/Data/Data.Core/Internal/RepositoryManager.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Mkh.Data.Abstractions; 3 | 4 | namespace Mkh.Data.Core.Internal; 5 | 6 | /// 7 | /// 仓储管理器,用于管理当前请求中(Scoped模式注入)的仓储实例 8 | /// 9 | internal class RepositoryManager : IRepositoryManager 10 | { 11 | public List Repositories { get; } 12 | 13 | public RepositoryManager() 14 | { 15 | Repositories = new List(); 16 | } 17 | 18 | public void Add(IRepository repository) 19 | { 20 | Repositories.Add(repository); 21 | } 22 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Domain/Dict/IDictRepository.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Mkh.Data.Abstractions; 3 | using Mkh.Data.Abstractions.Query; 4 | using Mkh.Mod.Admin.Core.Application.Dict.Dto; 5 | 6 | namespace Mkh.Mod.Admin.Core.Domain.Dict; 7 | 8 | /// 9 | /// 数据字典仓储 10 | /// 11 | public interface IDictRepository : IRepository 12 | { 13 | /// 14 | /// 分页查询 15 | /// 16 | /// 17 | /// 18 | Task> Query(DictQueryDto dto); 19 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/index.ts: -------------------------------------------------------------------------------- 1 | import { useAppCreatedService } from 'mkh-ui' 2 | import useStore from './store' 3 | import mod from 'virtual:mkh-mod-admin' 4 | import api from './api' 5 | 6 | //注册服务 7 | useAppCreatedService(({ config }) => { 8 | const { updateSkin } = api.account 9 | const { login, getVerifyCode, getProfile, refreshToken } = api.authorize 10 | 11 | config.systemActions = { 12 | login, 13 | getVerifyCode, 14 | getProfile, 15 | toggleSkin: updateSkin, 16 | refreshToken, 17 | } 18 | }) 19 | 20 | export default mod 21 | 22 | export { api, useStore } 23 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/main.ts: -------------------------------------------------------------------------------- 1 | import { bootstrap, useAppCreatedService, useModule } from 'mkh-ui' 2 | import './options' 3 | import mod_admin from './index' 4 | 5 | useModule(mod_admin) 6 | 7 | useAppCreatedService(({ config }) => { 8 | config.site.title = { 9 | 'zh-cn': '通用统一认证平台', 10 | en: 'Common Authentication Platform', 11 | } 12 | 13 | // config.site.title = { 14 | // 'zh-cn': '17MKH', 15 | // en: '17MKH English', 16 | // } 17 | 18 | /** 配置登录组件 */ 19 | config.component.login = 'k' 20 | config.auth.enableVerifyCode = false 21 | }) 22 | 23 | bootstrap() 24 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Web/Admin.Web.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Annotations/LengthAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mkh.Data.Abstractions.Annotations; 4 | 5 | /// 6 | /// 属性长度 7 | /// 8 | [AttributeUsage(AttributeTargets.Property)] 9 | public class LengthAttribute : Attribute 10 | { 11 | /// 12 | /// 长度 13 | /// 14 | public int Length { get; set; } 15 | 16 | /// 17 | /// 属性长度,0标识最大长度 18 | /// 19 | /// 20 | public LengthAttribute(int length = 50) 21 | { 22 | Length = length; 23 | } 24 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/components/dict-cascader/index.vue: -------------------------------------------------------------------------------- 1 | 4 | 25 | -------------------------------------------------------------------------------- /src/Utils/Utils/File/FileSizeUnit.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Mkh.Utils.File; 4 | 5 | /// 6 | /// 文件大小单位 7 | /// 8 | public enum FileSizeUnit 9 | { 10 | /// 11 | /// 字节 12 | /// 13 | [Description("B")] 14 | Byte, 15 | /// 16 | /// K字节 17 | /// 18 | [Description("KB")] 19 | K, 20 | /// 21 | /// M字节 22 | /// 23 | [Description("MB")] 24 | M, 25 | /// 26 | /// G字节 27 | /// 28 | [Description("GB")] 29 | G 30 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Infrastructure/IAccountProfileResolver.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Mkh.Mod.Admin.Core.Application.Authorize.Vo; 3 | using Mkh.Mod.Admin.Core.Domain.Account; 4 | 5 | namespace Mkh.Mod.Admin.Core.Infrastructure; 6 | 7 | /// 8 | /// 账户资料解析器 9 | /// 10 | public interface IAccountProfileResolver 11 | { 12 | /// 13 | /// 解析 14 | /// 15 | /// 账户信息 16 | /// 登录平台 17 | /// 18 | Task Resolve(AccountEntity account, int platform); 19 | } -------------------------------------------------------------------------------- /src/Data/Data.Core/Descriptors/RepositoryDescriptor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mkh.Data.Abstractions.Descriptors; 3 | 4 | namespace Mkh.Data.Core.Descriptors; 5 | 6 | public class RepositoryDescriptor : IRepositoryDescriptor 7 | { 8 | public Type EntityType { get; } 9 | 10 | public Type InterfaceType { get; } 11 | 12 | public Type ImplementType { get; } 13 | 14 | public RepositoryDescriptor(Type entityType, Type interfaceType, Type implementType) 15 | { 16 | EntityType = entityType; 17 | InterfaceType = interfaceType; 18 | ImplementType = implementType; 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Infrastructure/ICredentialClaimExtender.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Security.Claims; 4 | using System.Threading.Tasks; 5 | 6 | namespace Mkh.Mod.Admin.Core.Infrastructure; 7 | 8 | /// 9 | /// 认证凭证中的声明扩展器,当用户需要添加自定义的声明时,可以实现该接口并注入 10 | /// 11 | public interface ICredentialClaimExtender 12 | { 13 | /// 14 | /// 扩展 15 | /// 16 | /// 声明集合 17 | /// 账户编号 18 | /// 19 | Task Extend(List claims, Guid accountId); 20 | } -------------------------------------------------------------------------------- /src/Excel/Providers/Excel.EPPlus/EPPlusExcelProvider.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Excel.Abstractions; 2 | using Mkh.Module.Abstractions.Options; 3 | using Microsoft.Extensions.Options; 4 | using Mkh.Excel.Abstractions.Export; 5 | using Mkh.Excel.Core; 6 | using Mkh.Identity.Abstractions; 7 | 8 | namespace Mkh.Excel.EPPlus; 9 | 10 | internal class EPPlusExcelProvider : ExcelProviderAbstract 11 | { 12 | public EPPlusExcelProvider(ICurrentAccount loginInfo, IExcelExportBuilder exportBuilder, IOptionsMonitor options, IOptionsMonitor commonOptions) : base(options, commonOptions, exportBuilder) 13 | { 14 | } 15 | } -------------------------------------------------------------------------------- /modules/WebHost/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | //Serilog日志配置 3 | "Serilog": { 4 | "MinimumLevel": { 5 | "Default": "Debug", 6 | "Override": { 7 | "Microsoft": "Debug", 8 | "System": "Debug" 9 | } 10 | }, 11 | "WriteTo": [ 12 | //输入到控制台 13 | { 14 | "Name": "Console", 15 | "Args": { 16 | "theme": "Serilog.Sinks.SystemConsole.Themes.AnsiConsoleTheme::Code, Serilog.Sinks.Console", 17 | "outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj} {NewLine}{Exception}" 18 | } 19 | } 20 | ] 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Cache/Cache.Core/ServiceCollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Cache.Abstractions; 2 | using Mkh.Cache.Core; 3 | 4 | // ReSharper disable once CheckNamespace 5 | namespace Microsoft.Extensions.DependencyInjection; 6 | 7 | public static class ServiceCollectionExtensions 8 | { 9 | /// 10 | /// 添加缓存 11 | /// 12 | /// 13 | /// 14 | public static ICacheBuilder AddCache(this IServiceCollection services) 15 | { 16 | services.AddSingleton(); 17 | 18 | return new CacheBuilder(services); 19 | } 20 | } -------------------------------------------------------------------------------- /src/Module/Module.Abstractions/Options/ModuleOptions.cs: -------------------------------------------------------------------------------- 1 | namespace Mkh.Module.Abstractions.Options; 2 | 3 | /// 4 | /// 模块配置项 5 | /// 6 | public class ModuleOptions 7 | { 8 | /// 9 | /// 编码 10 | /// 11 | public string Code { get; set; } 12 | 13 | /// 14 | /// 加载顺序 15 | /// 16 | public int Sort { get; set; } 17 | 18 | /// 19 | /// 模块配置文件所在目录 20 | /// 21 | public string Dir { get; set; } 22 | 23 | /// 24 | /// 数据库配置项 25 | /// 26 | public ModuleDbOptions Db { get; set; } 27 | } -------------------------------------------------------------------------------- /src/Excel/Excel.Abstractions/Export/IExcelExportBuilder.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Threading.Tasks; 3 | using Mkh.Data.Abstractions.Entities; 4 | 5 | namespace Mkh.Excel.Abstractions.Export; 6 | 7 | /// 8 | /// Excel导出提供器接口 9 | /// 10 | public interface IExcelExportBuilder 11 | { 12 | /// 13 | /// 生成导出的Excel文件 14 | /// 15 | /// 16 | /// 17 | /// 保存的流 18 | /// 19 | Task Build(ExcelExportEntityModel model, Stream stream) where T : IEntity; 20 | } 21 | -------------------------------------------------------------------------------- /src/Module/Module.Abstractions/Module.Abstractions.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17mkh模块化抽象库 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/Utils/Utils.Web/Extensions/HttpRequestExtensions.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Http; 2 | 3 | namespace Mkh.Utils.Web.Extensions 4 | { 5 | public static class HttpRequestExtensions 6 | { 7 | /// 8 | /// 获取指定路径的完整URL 9 | /// 10 | /// 11 | /// 子路径 12 | /// 13 | public static string GetUrl(this HttpRequest request, string path = null) 14 | { 15 | return $"{request.Scheme}://{request.Host}{request.PathBase}{path ?? string.Empty}"; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Application/Authorize/Vo/ProfileSkinVo.cs: -------------------------------------------------------------------------------- 1 | namespace Mkh.Mod.Admin.Core.Application.Authorize.Vo; 2 | 3 | /// 4 | /// 个人信息皮肤 5 | /// 6 | public class ProfileSkinVo 7 | { 8 | /// 9 | /// 名称 10 | /// 11 | public string Name { get; set; } 12 | 13 | /// 14 | /// 编码 15 | /// 16 | public string Code { get; set; } 17 | 18 | /// 19 | /// 主题 20 | /// 21 | public string Theme { get; set; } 22 | 23 | /// 24 | /// 尺寸 25 | /// 26 | public string Size { get; set; } 27 | } -------------------------------------------------------------------------------- /src/Data/Adapters/Data.Adapter.PostgreSQL/Data.Adapter.PostgreSQL.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17mkh数据访问PostgreSQL数据库适配器 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/MessageQueue/MessageQueue.RabbitMQ/Consumer.cs: -------------------------------------------------------------------------------- 1 | using RabbitMQ.Client; 2 | 3 | namespace Mkh.MessageQueue.RabbitMQ; 4 | 5 | /// 6 | /// 消费者 7 | /// 8 | public class Consumer 9 | { 10 | /// 11 | /// 消费者标签 12 | /// 13 | public string Tag { get; set; } 14 | 15 | /// 16 | /// 关联通道 17 | /// 18 | public IModel Channel { get; set; } 19 | 20 | /// 21 | /// 取消消费 22 | /// 23 | public void Cancel() 24 | { 25 | if (Tag.NotNull()) 26 | { 27 | Channel.BasicCancel(Tag); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/Module/Module.Core/Constants.cs: -------------------------------------------------------------------------------- 1 | namespace Mkh.Module.Core; 2 | 3 | /// 4 | /// 常量 5 | /// 6 | internal class Constants 7 | { 8 | /// 9 | /// 项目前缀 10 | /// 11 | public const string PREFIX = "Mkh"; 12 | 13 | /// 14 | /// 根目录 15 | /// 16 | public const string ROOT_DIR = "_modules"; 17 | 18 | /// 19 | /// 模块的json文件名称 20 | /// 21 | public const string JSON_FILE_NAME = "_module.json"; 22 | 23 | /// 24 | /// 模块数据库初始化数据文件名称 25 | /// 26 | public const string DB_INIT_FILE_NAME = "_initData.json"; 27 | } -------------------------------------------------------------------------------- /src/Utils/Utils/Extensions/ServiceCollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using Microsoft.Extensions.DependencyInjection; 3 | 4 | // ReSharper disable once CheckNamespace 5 | namespace Mkh; 6 | 7 | public static class ServiceCollectionExtensions 8 | { 9 | /// 10 | /// 从服务集合中获取服务实例,需确保服务一定存在 11 | /// 12 | /// 13 | /// 14 | /// 15 | public static T GetService(this IServiceCollection services) 16 | { 17 | return (T)services.LastOrDefault(m => m.ServiceType == typeof(T))!.ImplementationInstance; 18 | } 19 | } -------------------------------------------------------------------------------- /src/Auth/Auth.Jwt/Auth.Jwt.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17MKH认证与授权JWT实现库 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Data/Adapters/Data.Adapter.MySql/Data.Adapter.MySql.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17mkh数据访问MySql数据库适配器 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/Module/Module.Abstractions/IModuleCollection.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Mkh.Module.Abstractions; 4 | 5 | /// 6 | /// 模块集合 7 | /// 8 | public interface IModuleCollection : IList 9 | { 10 | /// 11 | /// 根据模块编号获取模块信息 12 | /// 13 | /// 14 | /// 15 | ModuleDescriptor Get(int id); 16 | 17 | /// 18 | /// 根据模块编码获取模块信息 19 | /// 不区分大小写 20 | /// 21 | /// 22 | /// 23 | ModuleDescriptor Get(string code); 24 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/options/index.ts: -------------------------------------------------------------------------------- 1 | import type { BootstrapOptions } from 'mkh-ui' 2 | import { useBootstrapOptions } from 'mkh-ui' 3 | import messages_zh_cn from './locale.zh-cn' 4 | import messages_en from './locale.en' 5 | import messages_th from './locale.th' 6 | 7 | const options: BootstrapOptions = { 8 | locale: { 9 | messages: { 10 | 'zh-cn': messages_zh_cn, 11 | en: messages_en, 12 | th: messages_th, 13 | }, 14 | }, 15 | http: { 16 | global: { 17 | baseURL: import.meta.env.MKH_API_URL, 18 | }, 19 | }, 20 | } 21 | 22 | useBootstrapOptions(options) 23 | 24 | export type MessageSchema = typeof messages_zh_cn 25 | -------------------------------------------------------------------------------- /src/Data/Adapters/Data.Adapter.Sqlite/Data.Adapter.Sqlite.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17mkh数据访问SQLite数据库适配器 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/Utils/Utils/Extensions/GuidExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | // ReSharper disable once CheckNamespace 4 | namespace Mkh; 5 | 6 | public static class GuidExtensions 7 | { 8 | /// 9 | /// 判断Guid是否为空 10 | /// 11 | /// 12 | /// 13 | public static bool IsEmpty(this Guid s) 14 | { 15 | return s == Guid.Empty; 16 | } 17 | 18 | /// 19 | /// 判断Guid是否不为空 20 | /// 21 | /// 22 | /// 23 | public static bool NotEmpty(this Guid s) 24 | { 25 | return s != Guid.Empty; 26 | } 27 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Domain/Dict/DictEntity.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions.Annotations; 2 | using Mkh.Data.Abstractions.Entities; 3 | 4 | namespace Mkh.Mod.Admin.Core.Domain.Dict; 5 | 6 | /// 7 | /// 数据字典 8 | /// 9 | public partial class DictEntity : EntityBaseSoftDelete 10 | { 11 | /// 12 | /// 分组编码 13 | /// 14 | public string GroupCode { get; set; } 15 | 16 | /// 17 | /// 名称 18 | /// 19 | [Length(100)] 20 | public string Name { get; set; } 21 | 22 | /// 23 | /// 编码 24 | /// 25 | [Length(100)] 26 | public string Code { get; set; } 27 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/components/enum-select/index.vue: -------------------------------------------------------------------------------- 1 | 4 | 26 | -------------------------------------------------------------------------------- /src/Auth/Auth.Core/DefaultPlatformProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Mkh.Auth.Abstractions; 3 | 4 | namespace Mkh.Auth.Core; 5 | 6 | internal class DefaultPlatformProvider : IPlatformProvider 7 | { 8 | public string ToDescription(int platform) 9 | { 10 | switch (platform) 11 | { 12 | case 0: 13 | return "Web"; 14 | default: 15 | return "Other"; 16 | } 17 | } 18 | 19 | public List SelectOptions() 20 | { 21 | return new List 22 | { 23 | new() {Label = "Web", Value = 0}, 24 | }; 25 | } 26 | } -------------------------------------------------------------------------------- /src/Data/Adapters/Data.Adapter.SqlServer/Data.Adapter.SqlServer.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17mkh数据访问SqlServer数据库适配器 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/Logging/Logging.Core/ServiceCollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | using Mkh.Logging.Abstractions.Providers; 3 | using Mkh.Logging.Core.DefaultProviders; 4 | 5 | namespace Mkh.Logging.Core; 6 | 7 | public static class ServiceCollectionExtensions 8 | { 9 | /// 10 | /// 添加日志功能 11 | /// 12 | /// 13 | public static void AddMkhLogging(this IServiceCollection services) 14 | { 15 | //登录日志处理器 16 | services.AddScoped(); 17 | //审计日志处理器 18 | services.AddScoped(); 19 | } 20 | } -------------------------------------------------------------------------------- /src/Utils/Utils/Extensions/ArrayExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | // ReSharper disable once CheckNamespace 5 | namespace Mkh; 6 | 7 | /// 8 | /// 数组扩展 9 | /// 10 | public static class ArrayExtensions 11 | { 12 | /// 13 | /// 随机获取数组中的一个 14 | /// 15 | /// 16 | /// 17 | /// 18 | public static T RandomGet(this T[] arr) 19 | { 20 | if (arr == null || !arr.Any()) 21 | return default(T); 22 | 23 | var r = new Random(); 24 | 25 | return arr[r.Next(arr.Length)]; 26 | } 27 | } -------------------------------------------------------------------------------- /test/01_Utils/Utils.Tests/Encrypt/Md5EncryptTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | using Mkh.Utils.Encrypt; 3 | using Xunit; 4 | 5 | namespace Utils.Tests.Encrypt 6 | { 7 | public class Md5EncryptTests : BaseTest 8 | { 9 | private readonly Md5Encrypt _encrypt; 10 | 11 | public Md5EncryptTests() 12 | { 13 | _encrypt = ServiceProvider.GetService(); 14 | } 15 | 16 | [Fact] 17 | public void EncryptTest() 18 | { 19 | var str = _encrypt.Encrypt("iamoldli"); 20 | 21 | Assert.Equal("5108C4039CD470FD89B626E03EC0ABEE", str); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test/01_Utils/Utils.Tests/Extensions/EnumerableExtensionsTests.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using DistinctBy = Mkh; 3 | using Xunit; 4 | 5 | namespace Utils.Tests.Extensions 6 | { 7 | public class EnumerableExtensionsTests 8 | { 9 | [Fact] 10 | public void DistinctByTest() 11 | { 12 | var arr = new string[5]; 13 | arr[0] = "1"; 14 | arr[1] = "2"; 15 | arr[2] = "2"; 16 | arr[3] = "3"; 17 | arr[4] = "4"; 18 | var m = arr.DistinctBy(m => m); 19 | 20 | Assert.Equal(4, m.Count()); 21 | Assert.Equal(1, m.Count(m => m == "2")); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Application/Authorize/Dto/RefreshTokenDto.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Mkh.Mod.Admin.Core.Application.Authorize.Dto; 5 | 6 | /// 7 | /// 刷新令牌 8 | /// 9 | public class RefreshTokenDto 10 | { 11 | /// 12 | /// 平台 13 | /// 14 | public int Platform { get; set; } 15 | 16 | /// 17 | /// 刷新令牌 18 | /// 19 | [Required] 20 | public string RefreshToken { get; set; } 21 | 22 | /// 23 | /// 客户IP地址 24 | /// 25 | [JsonIgnore] 26 | public string IP { get; set; } 27 | } -------------------------------------------------------------------------------- /src/Module/Module.Abstractions/ModuleLayerAssemblies.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | namespace Mkh.Module.Abstractions; 4 | 5 | /// 6 | /// 模块分层程序集 7 | /// 8 | public class ModuleLayerAssemblies 9 | { 10 | /// 11 | /// 任务层程序集 12 | /// 13 | public Assembly Core { get; set; } 14 | 15 | /// 16 | /// 管理端接口分层程序集 17 | /// 18 | public Assembly Web { get; set; } 19 | 20 | /// 21 | /// 应用端接口分层程序集 22 | /// 23 | public Assembly Api { get; set; } 24 | 25 | /// 26 | /// 客户端分层程序集 27 | /// 28 | public Assembly Client { get; set; } 29 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/api/authorize/index.ts: -------------------------------------------------------------------------------- 1 | import type { LoginDto, JwtCredential, VerifyCode, Profile } from 'mkh-ui' 2 | import { encode } from 'js-base64' 3 | import http from '../http' 4 | 5 | export default { 6 | login(params: LoginDto) { 7 | let data = Object.assign({}, params) 8 | data.username = encode(data.username) 9 | data.password = encode(data.password) 10 | return http.post('Authorize/Login', data) 11 | }, 12 | refreshToken: (params) => http.post('Authorize/RefreshToken', params), 13 | getVerifyCode: () => http.get('Authorize/VerifyCode'), 14 | getProfile: () => http.get('Authorize/Profile'), 15 | } 16 | -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Sharding/IShardingPolicyProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mkh.Data.Abstractions.Descriptors; 3 | 4 | namespace Mkh.Data.Abstractions.Sharding 5 | { 6 | /// 7 | /// 分表策略提供器 8 | /// 9 | public interface IShardingPolicyProvider 10 | { 11 | /// 12 | /// 根据指定日期解析表名称 13 | /// 14 | /// 实体描述符 15 | /// 时间 16 | /// 解析下一张表 17 | /// 18 | string ResolveTableName(IEntityDescriptor descriptor, DateTime dateTime, bool next = false); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Utils/Utils/Map/IMapper.cs: -------------------------------------------------------------------------------- 1 | namespace Mkh.Utils.Map; 2 | 3 | /// 4 | /// 对象映射器 5 | /// 6 | public interface IMapper 7 | { 8 | /// 9 | /// 将对象映射为指定类型 10 | /// 11 | /// 12 | /// 13 | /// 14 | T Map(object source); 15 | 16 | /// 17 | /// 将对象映射为指定类型 18 | /// 19 | /// 20 | /// 21 | /// 22 | /// 23 | void Map(TSource source, TTarget target); 24 | } -------------------------------------------------------------------------------- /test/02_Data/Data.Web.Test/Controllers/TransactionAttributeController.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Data.Common.Test.Service; 3 | using Microsoft.AspNetCore.Mvc; 4 | 5 | namespace Data.Web.Test.Controllers 6 | { 7 | [ApiController] 8 | [Route("[controller]")] 9 | public class TransactionAttributeController : ControllerBase 10 | { 11 | 12 | private readonly IArticleService _service; 13 | 14 | public TransactionAttributeController(IArticleService service) 15 | { 16 | _service = service; 17 | } 18 | 19 | public Task Index() 20 | { 21 | return _service.Add(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Sharding/ShardingPolicy.cs: -------------------------------------------------------------------------------- 1 | namespace Mkh.Data.Abstractions.Sharding 2 | { 3 | /// 4 | /// 分表策略 5 | /// 6 | public enum ShardingPolicy 7 | { 8 | /// 9 | /// 自定义 10 | /// 11 | Custom, 12 | /// 13 | /// 按年度分表 14 | /// 15 | Year, 16 | /// 17 | /// 按季度分表 18 | /// 19 | Quarter, 20 | /// 21 | /// 按月份分表 22 | /// 23 | Month, 24 | /// 25 | /// 按天分表 26 | /// 27 | Day, 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Annotations/PrecisionAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mkh.Data.Abstractions.Annotations; 4 | 5 | /// 6 | /// 小数精度 7 | /// 8 | [AttributeUsage(AttributeTargets.Property)] 9 | public class PrecisionAttribute : Attribute 10 | { 11 | /// 12 | /// 长度 13 | /// 14 | public int M { get; set; } 15 | 16 | /// 17 | /// 小数位长度 18 | /// 19 | public int D { get; set; } 20 | 21 | public PrecisionAttribute(int m, int d) 22 | { 23 | M = m; 24 | D = d; 25 | } 26 | 27 | public PrecisionAttribute() 28 | { 29 | M = 18; 30 | D = 4; 31 | } 32 | } -------------------------------------------------------------------------------- /src/Data/Data.Core/Data.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17mkh数据访问核心实现库 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Domain/RoleButton/RoleButtonEntity.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions.Entities; 2 | 3 | namespace Mkh.Mod.Admin.Core.Domain.RoleButton; 4 | 5 | /// 6 | /// 角色按钮绑定关系 7 | /// 8 | public class RoleButtonEntity : Entity 9 | { 10 | /// 11 | /// 角色编号 12 | /// 13 | public int RoleId { get; set; } 14 | 15 | /// 16 | /// 菜单组编号 17 | /// 18 | public int MenuGroupId { get; set; } 19 | 20 | /// 21 | /// 菜单编号 22 | /// 23 | public int MenuId { get; set; } 24 | 25 | /// 26 | /// 按钮编码 27 | /// 28 | public string ButtonCode { get; set; } 29 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/build/lib.config.ts: -------------------------------------------------------------------------------- 1 | /** 打包库模式 */ 2 | import { resolve } from 'path' 3 | import { defineConfig } from 'vite' 4 | import useBaseConfig from './base.config' 5 | 6 | export default defineConfig(({ mode, command }) => { 7 | let config = useBaseConfig({ target: 'lib', mode, command }) 8 | 9 | //需要取消复制静态资源目录 10 | config.publicDir = false 11 | config.build = { 12 | outDir: 'lib', 13 | lib: { 14 | entry: resolve(__dirname, '../src/index.ts'), 15 | formats: ['es'], 16 | fileName: 'index', 17 | }, 18 | rollupOptions: { 19 | /** 排除无需打包进去的依赖库 */ 20 | external: ['vue', 'vue-router', 'pinia', 'mkh-ui'], 21 | }, 22 | } 23 | 24 | return config 25 | }) 26 | -------------------------------------------------------------------------------- /src/Data/Data.Core/Sharding/Providers/DayShardingPolicyProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mkh.Data.Abstractions.Descriptors; 3 | using Mkh.Data.Abstractions.Sharding; 4 | 5 | namespace Mkh.Data.Core.Sharding.Providers 6 | { 7 | /// 8 | /// 按天分表提供器 9 | /// 10 | internal class DayShardingPolicyProvider : IShardingPolicyProvider 11 | { 12 | public string ResolveTableName(IEntityDescriptor descriptor, DateTime dateTime, bool next = false) 13 | { 14 | if (next) 15 | { 16 | dateTime = dateTime.AddDays(1); 17 | } 18 | 19 | return $"{descriptor.TableName}_{dateTime:yyyyMMdd}"; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Logging/Logging.Core/DefaultProviders/LoginLogHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Microsoft.Extensions.Logging; 3 | using Mkh.Logging.Abstractions.Providers; 4 | 5 | namespace Mkh.Logging.Core.DefaultProviders; 6 | 7 | /// 8 | /// 默认登录日志处理器 9 | /// 10 | internal class LoginLogHandler : ILoginLogHandler 11 | { 12 | private readonly ILogger _logger; 13 | 14 | public LoginLogHandler(ILogger logger) 15 | { 16 | _logger = logger; 17 | } 18 | 19 | public Task Write(LoginLogModel model) 20 | { 21 | _logger.LogInformation("Login Log:{@model}", model); 22 | 23 | return Task.FromResult(true); 24 | } 25 | } -------------------------------------------------------------------------------- /src/Module/Module.Abstractions/ModuleEnumDescriptor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text.Json.Serialization; 4 | 5 | namespace Mkh.Module.Abstractions; 6 | 7 | /// 8 | /// 模块中的枚举描述符 9 | /// 方便使用通用接口获取枚举信息,这里的枚举只限领域Domain中的枚举 10 | /// 11 | public class ModuleEnumDescriptor 12 | { 13 | /// 14 | /// 枚举名称 15 | /// 16 | public string Name { get; set; } 17 | 18 | /// 19 | /// 枚举类型 20 | /// 21 | [JsonIgnore] 22 | public Type Type { get; set; } 23 | 24 | /// 25 | /// 枚举项下拉列表 26 | /// 27 | public IList Options { get; set; } 28 | } -------------------------------------------------------------------------------- /src/Data/Data.Core/Sharding/Providers/MonthShardingPolicyProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mkh.Data.Abstractions.Descriptors; 3 | using Mkh.Data.Abstractions.Sharding; 4 | 5 | namespace Mkh.Data.Core.Sharding.Providers 6 | { 7 | /// 8 | /// 月份分表提供器 9 | /// 10 | internal class MonthShardingPolicyProvider : IShardingPolicyProvider 11 | { 12 | public string ResolveTableName(IEntityDescriptor descriptor, DateTime dateTime, bool next = false) 13 | { 14 | if (next) 15 | { 16 | dateTime = dateTime.AddMonths(1); 17 | } 18 | 19 | return $"{descriptor.TableName}_{dateTime:yyyyMM}"; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Domain/RolePermission/RolePermissionEntity.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions.Entities; 2 | 3 | namespace Mkh.Mod.Admin.Core.Domain.RolePermission; 4 | 5 | /// 6 | /// 角色权限绑定关系 7 | /// 8 | public class RolePermissionEntity : Entity 9 | { 10 | /// 11 | /// 角色编号 12 | /// 13 | public int RoleId { get; set; } 14 | 15 | /// 16 | /// 菜单组编号 17 | /// 18 | public int MenuGroupId { get; set; } 19 | 20 | /// 21 | /// 菜单编号 22 | /// 23 | public int MenuId { get; set; } 24 | 25 | /// 26 | /// 权限编码 27 | /// 28 | public string PermissionCode { get; set; } 29 | } -------------------------------------------------------------------------------- /src/Logging/Logging.Core/DefaultProviders/AuditLogHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Microsoft.Extensions.Logging; 3 | using Mkh.Logging.Abstractions.Providers; 4 | 5 | namespace Mkh.Logging.Core.DefaultProviders 6 | { 7 | internal class AuditLogHandler : IAuditLogHandler 8 | { 9 | private readonly ILogger _logger; 10 | 11 | public AuditLogHandler(ILogger logger) 12 | { 13 | _logger = logger; 14 | } 15 | 16 | public Task Write(AuditLogModel model) 17 | { 18 | _logger.LogInformation("Audit Log:{@model}", model); 19 | 20 | return Task.FromResult(true); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Data/Data.Core/Sharding/Providers/YearShardingPolicyProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mkh.Data.Abstractions.Descriptors; 3 | using Mkh.Data.Abstractions.Sharding; 4 | 5 | namespace Mkh.Data.Core.Sharding.Providers 6 | { 7 | /// 8 | /// 按年度分表提供器 9 | /// 10 | internal class YearShardingPolicyProvider : IShardingPolicyProvider 11 | { 12 | public string ResolveTableName(IEntityDescriptor descriptor, DateTime dateTime, bool next = false) 13 | { 14 | var year = dateTime.Year; 15 | 16 | if (next) 17 | { 18 | year++; 19 | } 20 | 21 | return $"{descriptor.TableName}_{year}"; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Domain/RoleMenu/RoleMenuEntity.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions.Entities; 2 | using Mkh.Mod.Admin.Core.Domain.Menu; 3 | 4 | namespace Mkh.Mod.Admin.Core.Domain.RoleMenu; 5 | 6 | /// 7 | /// 角色菜单绑定信息 8 | /// 9 | public class RoleMenuEntity : Entity 10 | { 11 | /// 12 | /// 角色编号 13 | /// 14 | public int RoleId { get; set; } 15 | 16 | /// 17 | /// 菜单分组编号 18 | /// 19 | public int MenuGroupId { get; set; } 20 | 21 | /// 22 | /// 菜单编号 23 | /// 24 | public int MenuId { get; set; } 25 | 26 | /// 27 | /// 菜单类型 28 | /// 29 | public MenuType MenuType { get; set; } 30 | } -------------------------------------------------------------------------------- /src/Logging/Logging.Abstractions/BaseLogModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mkh.Logging.Abstractions 4 | { 5 | /// 6 | /// 基础日志模型 7 | /// 8 | public class BaseLogModel 9 | { 10 | /// 11 | /// 租户编号 12 | /// 13 | public Guid? TenantId { get; set; } 14 | 15 | /// 16 | /// 账户编号 17 | /// 18 | public Guid? AccountId { get; set; } 19 | 20 | /// 21 | /// 平台 22 | /// 23 | public int Platform { get; set; } 24 | 25 | /// 26 | /// 账户名 27 | /// 28 | public string AccountName { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Utils/Utils/Extensions/ConfigurationExtensions.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Configuration; 2 | 3 | namespace Mkh.Utils.Extensions; 4 | 5 | public static class ConfigurationExtensions 6 | { 7 | /// 8 | /// 获取指定类型的实例 9 | /// 10 | /// 11 | /// 12 | /// 13 | /// 14 | public static T Get(this IConfiguration cfg, string key) where T : class, new() 15 | { 16 | if (cfg == null || key.IsNull()) 17 | return new T(); 18 | 19 | var t = cfg.GetSection(key).Get(); 20 | if (t == null) 21 | return new T(); 22 | 23 | return t; 24 | } 25 | } -------------------------------------------------------------------------------- /src/TaskScheduler/TaskScheduler.Abstractions/ITaskDescriptor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mkh.TaskScheduler.Abstractions 4 | { 5 | /// 6 | /// 任务描述 7 | /// 8 | public interface ITaskDescriptor 9 | { 10 | /// 11 | /// 唯一编号,该编号动态生成 12 | /// 13 | Guid Id { get; } 14 | 15 | /// 16 | /// 模块编码 17 | /// 18 | string ModuleCode { get; set; } 19 | 20 | /// 21 | /// 显示名称 22 | /// 23 | string DisplayName { get; set; } 24 | 25 | /// 26 | /// 类完整名称 27 | /// 28 | string ClassFullName { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Utils/Utils/Annotations/ScopedInjectAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mkh.Utils.Annotations; 4 | 5 | /// 6 | /// Scoped注入(使用该特性的服务系统会自动注入) 7 | /// 8 | [AttributeUsage(AttributeTargets.Class)] 9 | public class ScopedInjectAttribute : Attribute 10 | { 11 | /// 12 | /// 是否使用自身的类型进行注入 13 | /// 14 | public bool Itself { get; set; } 15 | 16 | /// 17 | /// 18 | /// 19 | public ScopedInjectAttribute() 20 | { 21 | } 22 | 23 | /// 24 | /// 是否使用自身的类型进行注入 25 | /// 26 | /// 27 | public ScopedInjectAttribute(bool itself = false) 28 | { 29 | Itself = itself; 30 | } 31 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Application/DictGroup/Dto/DictGroupAddDto.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using Mkh.Mod.Admin.Core.Domain.DictGroup; 3 | using Mkh.Utils.Annotations; 4 | 5 | namespace Mkh.Mod.Admin.Core.Application.DictGroup.Dto; 6 | 7 | [ObjectMap(typeof(DictGroupEntity))] 8 | public class DictGroupAddDto 9 | { 10 | /// 11 | /// 分组名称 12 | /// 13 | [Required(ErrorMessage = "请输入字典分组名称")] 14 | public string Name { get; set; } 15 | 16 | /// 17 | /// 编码 18 | /// 19 | [Required(ErrorMessage = "请输入字典分组唯一编码")] 20 | public string Code { get; set; } 21 | 22 | /// 23 | /// 图标 24 | /// 25 | public string Icon { get; set; } 26 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Domain/Menu/MenuType.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Mkh.Mod.Admin.Core.Domain.Menu; 4 | 5 | /// 6 | /// 菜单类型 7 | /// 8 | public enum MenuType 9 | { 10 | /// 11 | /// 未知 12 | /// 13 | [Description("未知")] 14 | UnKnown = -1, 15 | /// 16 | /// 节点 17 | /// 18 | [Description("节点")] 19 | Node, 20 | /// 21 | /// 路由菜单 22 | /// 23 | [Description("路由")] 24 | Route, 25 | /// 26 | /// 链接菜单 27 | /// 28 | [Description("链接")] 29 | Link, 30 | /// 31 | /// 自定义脚本 32 | /// 33 | [Description("自定义脚本")] 34 | CustomJs 35 | } -------------------------------------------------------------------------------- /src/Utils/Utils/Annotations/TransientInjectAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mkh.Utils.Annotations; 4 | 5 | /// 6 | /// 瞬时注入(使用该特性的服务系统会自动注入) 7 | /// 8 | [AttributeUsage(AttributeTargets.Class)] 9 | public class TransientInjectAttribute : Attribute 10 | { 11 | /// 12 | /// 是否使用自身的类型进行注入 13 | /// 14 | public bool Itself { get; set; } 15 | 16 | /// 17 | /// 18 | /// 19 | public TransientInjectAttribute() 20 | { 21 | } 22 | 23 | /// 24 | /// 是否使用自身的类型进行注入 25 | /// 26 | /// 27 | public TransientInjectAttribute(bool itself = false) 28 | { 29 | Itself = itself; 30 | } 31 | } -------------------------------------------------------------------------------- /src/Module/Module.Abstractions/IModuleServicesConfigurator.cs: -------------------------------------------------------------------------------- 1 | namespace Mkh.Module.Abstractions; 2 | 3 | /// 4 | /// 模块服务配置器接口 5 | /// 如果模块中有自己独有的服务需要注入,可以通过实现该接口来注入 6 | /// 7 | public interface IModuleServicesConfigurator 8 | { 9 | /// 10 | /// 前置服务注入 11 | /// 12 | /// 13 | void PreConfigure(ModuleConfigureContext context); 14 | 15 | /// 16 | /// 服务注入 17 | /// 18 | /// 19 | void Configure(ModuleConfigureContext context); 20 | 21 | /// 22 | /// 后置服务注入 23 | /// 24 | /// 25 | void PostConfigure(ModuleConfigureContext context); 26 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Application/Dict/Dto/DictAddDto.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using Mkh.Mod.Admin.Core.Domain.Dict; 3 | using Mkh.Utils.Annotations; 4 | 5 | namespace Mkh.Mod.Admin.Core.Application.Dict.Dto; 6 | 7 | [ObjectMap(typeof(DictEntity))] 8 | public class DictAddDto 9 | { 10 | /// 11 | /// 分组编码 12 | /// 13 | [Required(ErrorMessage = "请选择分组")] 14 | public string GroupCode { get; set; } 15 | 16 | /// 17 | /// 名称 18 | /// 19 | [Required(ErrorMessage = "请输入分组名称")] 20 | public string Name { get; set; } 21 | 22 | /// 23 | /// 编码 24 | /// 25 | [Required(ErrorMessage = "请输入分组编码")] 26 | public string Code { get; set; } 27 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Application/DictItem/Dto/DictItemQueryDto.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions.Query; 2 | 3 | namespace Mkh.Mod.Admin.Core.Application.DictItem.Dto; 4 | 5 | public class DictItemQueryDto : QueryDto 6 | { 7 | /// 8 | /// 分组编码 9 | /// 10 | public string GroupCode { get; set; } 11 | 12 | /// 13 | /// 字典编码 14 | /// 15 | public string DictCode { get; set; } 16 | 17 | /// 18 | /// 父级 19 | /// 20 | public int ParentId { get; set; } 21 | 22 | /// 23 | /// 名称 24 | /// 25 | public string Name { get; set; } 26 | 27 | /// 28 | /// 值 29 | /// 30 | public string Value { get; set; } 31 | } -------------------------------------------------------------------------------- /src/Config/Config.Core/ModuleConfigureContextExtensions.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | using Mkh.Config.Abstractions; 3 | using Mkh.Module.Abstractions; 4 | 5 | namespace Mkh.Config.Core 6 | { 7 | public static class ModuleConfigureContextExtensions 8 | { 9 | /// 10 | /// 获取配置实例 11 | /// 12 | /// 13 | /// 14 | /// 15 | public static TConfig GetConfig(this ModuleConfigureContext context) where TConfig : IConfig, new() 16 | { 17 | return context.Services.BuildServiceProvider().GetService()!.Get(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/build/patch-types.ts: -------------------------------------------------------------------------------- 1 | import path from 'path' 2 | import fse from 'fs-extra' 3 | 4 | // 递归将d.ts文件中的@/types替换成相对路径 5 | const patch = (rootDir: string, relativePath: string) => { 6 | fse.readdir(rootDir, (err, dirs) => { 7 | dirs.forEach((m) => { 8 | const filePath = path.resolve(rootDir, m) 9 | fse.stat(filePath, (err, stat) => { 10 | if (stat.isFile()) { 11 | fse.readFile(filePath, (err, data) => { 12 | fse.writeFile(filePath, data.toString().replace('@/types', (relativePath || './') + 'types')) 13 | }) 14 | } else if (stat.isDirectory()) { 15 | patch(filePath, relativePath + '../') 16 | } 17 | }) 18 | }) 19 | }) 20 | } 21 | 22 | patch(path.resolve('./.temp'), '') 23 | -------------------------------------------------------------------------------- /test/01_Utils/Utils.Web.Test/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:21684/", 7 | "sslPort": 44391 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "Utils.Web.Test": { 19 | "commandName": "Project", 20 | "launchBrowser": true, 21 | "environmentVariables": { 22 | "ASPNETCORE_ENVIRONMENT": "Development" 23 | }, 24 | "applicationUrl": "http://localhost:5000" 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Auth/Auth.Core/Auth.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17MKH认证与授权核心库 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /test/02_Data/Data.Adapter.MySql.Test/DbContextTests.cs: -------------------------------------------------------------------------------- 1 | using System.Data; 2 | using Xunit; 3 | using Xunit.Abstractions; 4 | 5 | namespace Data.Adapter.MySql.Test 6 | { 7 | public class DbContextTests : BaseTest 8 | { 9 | public DbContextTests(ITestOutputHelper output) : base(output) 10 | { 11 | } 12 | 13 | /// 14 | /// 数据库上下文状态测试 15 | /// 16 | [Fact] 17 | public void NewConnectionTest() 18 | { 19 | using var con = _dbContext.NewConnection(); 20 | 21 | Assert.NotNull(con); 22 | Assert.Equal(ConnectionState.Closed, con.State); 23 | 24 | con.Open(); 25 | 26 | Assert.Equal(ConnectionState.Open, con.State); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Utils/Utils/Annotations/SingletonInjectAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mkh.Utils.Annotations; 4 | 5 | /// 6 | /// 单例注入(使用该特性的服务系统会自动注入) 7 | /// 8 | [AttributeUsage(AttributeTargets.Class)] 9 | public class SingletonInjectAttribute : Attribute 10 | { 11 | /// 12 | /// 是否使用自身的类型进行注入,而不是继承的接口 13 | /// 14 | public bool Itself { get; set; } 15 | 16 | /// 17 | /// 18 | /// 19 | public SingletonInjectAttribute() 20 | { 21 | Itself = false; 22 | } 23 | 24 | /// 25 | /// 是否使用自身的类型进行注入,而不是继承的接口 26 | /// 27 | /// 28 | public SingletonInjectAttribute(bool itself) 29 | { 30 | Itself = itself; 31 | } 32 | } -------------------------------------------------------------------------------- /test/02_Data/Data.Adapter.Sqlite.Test/DbContextTests.cs: -------------------------------------------------------------------------------- 1 | using System.Data; 2 | using Xunit; 3 | using Xunit.Abstractions; 4 | 5 | namespace Data.Adapter.Sqlite.Test 6 | { 7 | public class DbContextTests : BaseTest 8 | { 9 | public DbContextTests(ITestOutputHelper output) : base(output) 10 | { 11 | } 12 | 13 | /// 14 | /// 数据库上下文状态测试 15 | /// 16 | [Fact] 17 | public void NewConnectionTest() 18 | { 19 | using var con = _dbContext.NewConnection(); 20 | 21 | Assert.NotNull(con); 22 | Assert.Equal(ConnectionState.Closed, con.State); 23 | 24 | con.Open(); 25 | 26 | Assert.Equal(ConnectionState.Open, con.State); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Module/Module.Web/Module.Web.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17mkh模块化Web库 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Entities/ISoftDelete.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mkh.Data.Abstractions.Annotations; 3 | 4 | namespace Mkh.Data.Abstractions.Entities; 5 | 6 | /// 7 | /// 实体软删除扩展 8 | /// 9 | public interface ISoftDelete 10 | { 11 | /// 12 | /// 已删除的 13 | /// 14 | [IgnoreOnEntityEvent] 15 | bool Deleted { get; set; } 16 | 17 | /// 18 | /// 删除人账户编号 19 | /// 20 | [IgnoreOnEntityEvent] 21 | Guid? DeletedBy { get; set; } 22 | 23 | /// 24 | /// 删除人名称 25 | /// 26 | [IgnoreOnEntityEvent] 27 | string Deleter { get; set; } 28 | 29 | /// 30 | /// 删除时间 31 | /// 32 | [IgnoreOnEntityEvent] 33 | DateTime? DeletedTime { get; set; } 34 | } -------------------------------------------------------------------------------- /src/Auth/Auth.Jwt/JwtOptions.cs: -------------------------------------------------------------------------------- 1 | namespace Mkh.Auth.Jwt; 2 | 3 | /// 4 | /// Jwt配置项 5 | /// 6 | public class JwtOptions 7 | { 8 | /// 9 | /// 加密密钥 10 | /// 11 | public string Key { get; set; } = "twAJ$j5##pVc5*y&"; 12 | 13 | /// 14 | /// 发行人 15 | /// 16 | public string Issuer { get; set; } = "http://www.17mkh.com"; 17 | 18 | /// 19 | /// 消费者 20 | /// 21 | public string Audience { get; set; } = "http://www.17mkh.com"; 22 | 23 | /// 24 | /// 令牌有效期(分钟,默认120) 25 | /// 26 | public int Expires { get; set; } = 120; 27 | 28 | /// 29 | /// 刷新令牌有效期(单位:天,默认7) 30 | /// 31 | public int RefreshTokenExpires { get; set; } = 7; 32 | } -------------------------------------------------------------------------------- /src/Excel/Providers/Excel.EPPlus/ExcelOptionsBuilderExtensions.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | using Mkh.Excel.Abstractions; 3 | using Mkh.Excel.Abstractions.Export; 4 | 5 | namespace Mkh.Excel.EPPlus 6 | { 7 | public static class ExcelOptionsBuilderExtensions 8 | { 9 | /// 10 | /// 使用EPPlus 11 | /// 12 | /// 13 | /// 14 | public static ExcelOptionsBuilder UseEPPlus(this ExcelOptionsBuilder builder) 15 | { 16 | builder.Services.AddSingleton(); 17 | builder.Services.AddSingleton(); 18 | 19 | return builder; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Auth/Auth.Jwt/JwtCredential.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mkh.Auth.Abstractions; 3 | 4 | namespace Mkh.Auth.Jwt; 5 | 6 | /// 7 | /// JWT返回模型 8 | /// 9 | [Serializable] 10 | public class JwtCredential : ICredential 11 | { 12 | /// 13 | /// 账户编号 14 | /// 15 | public Guid AccountId { get; set; } 16 | 17 | /// 18 | /// 访问令牌 19 | /// 20 | public string AccessToken { get; set; } 21 | 22 | /// 23 | /// 刷新令牌 24 | /// 25 | public string RefreshToken { get; set; } 26 | 27 | /// 28 | /// 访问令牌有效期 29 | /// 30 | public int ExpiresIn { get; set; } 31 | 32 | /// 33 | /// 登录时间戳 34 | /// 35 | public long LoginTime { get; set; } 36 | } -------------------------------------------------------------------------------- /src/Utils/Utils/Annotations/ObjectMapAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mkh.Utils.Annotations; 4 | 5 | /// 6 | /// 映射 7 | /// 8 | [AttributeUsage(AttributeTargets.Class)] 9 | public class ObjectMapAttribute : Attribute 10 | { 11 | /// 12 | /// 要映射的类型 13 | /// 14 | public Type TargetType { get; set; } 15 | 16 | /// 17 | /// 双向映射 18 | /// 19 | public bool TwoWay { get; set; } 20 | 21 | /// 22 | /// 创建AutoMapper的映射管理 23 | /// 24 | /// 映射目标类型 25 | /// 是否双向映射 26 | public ObjectMapAttribute(Type targetType, bool twoWay = false) 27 | { 28 | TargetType = targetType; 29 | TwoWay = twoWay; 30 | } 31 | } -------------------------------------------------------------------------------- /src/Data/Data.Abstractions/Logger/DbLogger.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions.Options; 2 | 3 | namespace Mkh.Data.Abstractions.Logger; 4 | 5 | /// 6 | /// 数据库日志记录器 7 | /// 8 | public class DbLogger 9 | { 10 | private readonly DbOptions _options; 11 | private readonly IDbLoggerProvider _provider; 12 | 13 | public DbLogger(DbOptions options, IDbLoggerProvider provider) 14 | { 15 | _options = options; 16 | _provider = provider; 17 | } 18 | 19 | /// 20 | /// 日志记录 21 | /// 22 | /// 操作类型 23 | /// SQL语句 24 | public void Write(string action, string sql) 25 | { 26 | if (_options.Log) 27 | { 28 | _provider.Write(action, sql); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /test/02_Data/Data.Adapter.SqlServer.Test/DbContextTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data; 3 | using Xunit; 4 | using Xunit.Abstractions; 5 | 6 | namespace Data.Adapter.SqlServer.Test 7 | { 8 | public class DbContextTests : BaseTest 9 | { 10 | public DbContextTests(ITestOutputHelper output) : base(output) 11 | { 12 | } 13 | 14 | /// 15 | /// 数据库上下文状态测试 16 | /// 17 | [Fact] 18 | public void NewConnectionTest() 19 | { 20 | using var con = _dbContext.NewConnection(); 21 | 22 | Assert.NotNull(con); 23 | Assert.Equal(ConnectionState.Closed, con.State); 24 | 25 | con.Open(); 26 | 27 | Assert.Equal(ConnectionState.Open, con.State); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Infrastructure/IVerifyCodeProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace Mkh.Mod.Admin.Core.Infrastructure; 4 | 5 | /// 6 | /// 验证码提供器 7 | /// 8 | public interface IVerifyCodeProvider 9 | { 10 | /// 11 | /// 创建验证码 12 | /// 13 | /// 14 | Task Create(); 15 | 16 | /// 17 | /// 校验验证码 18 | /// 19 | /// 编号 20 | /// 验证码 21 | /// 22 | Task Verify(string id, string code); 23 | } 24 | 25 | /// 26 | /// 验证码模型 27 | /// 28 | public class VerifyCodeModel 29 | { 30 | public string Id { get; set; } 31 | 32 | public string Base64 { get; set; } 33 | } -------------------------------------------------------------------------------- /src/Excel/Excel.Core/ServiceCollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.Extensions.DependencyInjection; 3 | using Mkh.Excel.Abstractions; 4 | 5 | namespace Mkh.Excel.Core; 6 | 7 | public static class ServiceCollectionExtensions 8 | { 9 | /// 10 | /// 添加Excel功能 11 | /// 12 | /// 13 | /// 14 | /// 15 | public static IServiceCollection AddExcel(this IServiceCollection services, Action action) 16 | { 17 | var options = new ExcelOptionsBuilder 18 | { 19 | Services = services 20 | }; 21 | if (action != null) 22 | { 23 | action.Invoke(options); 24 | } 25 | 26 | return services; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /test/02_Data/Data.Web.Test/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Hosting; 2 | using Microsoft.Extensions.Configuration; 3 | using Microsoft.Extensions.Hosting; 4 | using Microsoft.Extensions.Logging; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | 10 | namespace Data.Web.Test 11 | { 12 | public class Program 13 | { 14 | public static void Main(string[] args) 15 | { 16 | CreateHostBuilder(args).Build().Run(); 17 | } 18 | 19 | public static IHostBuilder CreateHostBuilder(string[] args) => 20 | Host.CreateDefaultBuilder(args) 21 | .ConfigureWebHostDefaults(webBuilder => 22 | { 23 | webBuilder.UseStartup(); 24 | }); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Domain/DictGroup/DictGroupEntity.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions.Annotations; 2 | using Mkh.Data.Abstractions.Entities; 3 | 4 | namespace Mkh.Mod.Admin.Core.Domain.DictGroup; 5 | 6 | /// 7 | /// 数据字典分组 8 | /// 9 | public class DictGroupEntity : EntityBaseSoftDelete 10 | { 11 | /// 12 | /// 分组名称 13 | /// 14 | [Length(100)] 15 | public string Name { get; set; } 16 | 17 | /// 18 | /// 编号 19 | /// 20 | public string Code { get; set; } 21 | 22 | /// 23 | /// 图标 24 | /// 25 | [Nullable] 26 | public string Icon { get; set; } 27 | 28 | /// 29 | /// 备注 30 | /// 31 | [Length(500)] 32 | [Nullable] 33 | public string Remarks { get; set; } 34 | } -------------------------------------------------------------------------------- /test/01_Utils/Utils.Web.Test/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Hosting; 6 | using Microsoft.Extensions.Configuration; 7 | using Microsoft.Extensions.Hosting; 8 | using Microsoft.Extensions.Logging; 9 | 10 | namespace Utils.Web.Test 11 | { 12 | public class Program 13 | { 14 | public static void Main(string[] args) 15 | { 16 | CreateHostBuilder(args).Build().Run(); 17 | } 18 | 19 | public static IHostBuilder CreateHostBuilder(string[] args) => 20 | Host.CreateDefaultBuilder(args) 21 | .ConfigureWebHostDefaults(webBuilder => 22 | { 23 | webBuilder.UseStartup(); 24 | }); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Module/Module.Abstractions/ModuleConfigureContext.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Configuration; 2 | using Microsoft.Extensions.DependencyInjection; 3 | using Microsoft.Extensions.Hosting; 4 | 5 | namespace Mkh.Module.Abstractions; 6 | 7 | /// 8 | /// 用于模块中添加特有服务的上下文 9 | /// 10 | public class ModuleConfigureContext 11 | { 12 | /// 13 | /// 服务集合 14 | /// 15 | public IServiceCollection Services { get; set; } 16 | 17 | /// 18 | /// 环境变量 19 | /// 20 | public IHostEnvironment Environment { get; set; } 21 | 22 | /// 23 | /// 配置对象 24 | /// 25 | public IConfiguration Configuration { get; set; } 26 | 27 | /// 28 | /// 模块集合 29 | /// 30 | public IModuleCollection Modules { get; set; } 31 | } -------------------------------------------------------------------------------- /src/Data/Data.Core/Internal/QueryStructure/QueryUpdate.cs: -------------------------------------------------------------------------------- 1 | using System.Linq.Expressions; 2 | 3 | namespace Mkh.Data.Core.Internal.QueryStructure; 4 | 5 | /// 6 | /// 查询更新信息 7 | /// 8 | public class QueryUpdate 9 | { 10 | /// 11 | /// 模式 12 | /// 13 | public QueryUpdateMode Mode { get; set; } 14 | 15 | /// 16 | /// Lambda 17 | /// 18 | public LambdaExpression Lambda { get; set; } 19 | 20 | /// 21 | /// SQL语句 22 | /// 23 | public string Sql { get; set; } 24 | } 25 | 26 | /// 27 | /// 查询更新模式 28 | /// 29 | public enum QueryUpdateMode 30 | { 31 | /// 32 | /// Lambda 33 | /// 34 | Lambda, 35 | /// 36 | /// SQL语句 37 | /// 38 | Sql 39 | } -------------------------------------------------------------------------------- /src/Idenity/Identity.Core/ServiceCollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | using Microsoft.Extensions.DependencyInjection.Extensions; 3 | using Mkh.Identity.Abstractions; 4 | 5 | namespace Mkh.Identity.Core 6 | { 7 | public static class ServiceCollectionExtensions 8 | { 9 | /// 10 | /// 添加身份服务 11 | /// 12 | /// 13 | /// 14 | public static IServiceCollection AddIdentity(this IServiceCollection services) 15 | { 16 | //添加http上下文访问器,用于获取认证信息 17 | services.AddHttpContextAccessor(); 18 | 19 | //尝试添加账户信息 20 | services.TryAddSingleton(); 21 | 22 | return services; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Module/Module.Abstractions/Options/CommonOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Mkh.Module.Abstractions.Options 5 | { 6 | /// 7 | /// 通用配置 8 | /// 9 | public class CommonOptions 10 | { 11 | /// 12 | /// 默认临时文件 13 | /// 14 | public string DefaultTempDir => Path.Combine(AppContext.BaseDirectory, "Temp"); 15 | 16 | /// 17 | /// 临时目录,默认是应用程序根目录下的Temp目录 18 | /// 19 | public string TempDir { get; set; } 20 | 21 | /// 22 | /// 默认语言 23 | /// 24 | public string Lang { get; set; } 25 | 26 | /// 27 | /// 数据库配置 28 | /// 29 | public ModuleDbOptions Db { get; set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Utils/Utils/Validations/GuidNotEmptyValidationAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace Mkh.Utils.Validations; 5 | 6 | /// 7 | /// GUID不能为空的验证 8 | /// 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)] 10 | public class GuidNotEmptyValidationAttribute : ValidationAttribute 11 | { 12 | public GuidNotEmptyValidationAttribute() : base("属性 {0} 不能为空") { } 13 | 14 | public override bool IsValid(object value) 15 | { 16 | if (value is null) 17 | { 18 | return true; 19 | } 20 | 21 | switch (value) 22 | { 23 | case Guid guid: 24 | return guid != Guid.Empty; 25 | default: 26 | return true; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Application/Account/Dto/AccountSkinUpdateDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mkh.Utils.Annotations; 3 | 4 | namespace Mkh.Mod.Admin.Core.Application.Account.Dto; 5 | 6 | /// 7 | /// 账户皮肤更新 8 | /// 9 | public class AccountSkinUpdateDto 10 | { 11 | /// 12 | /// 账户编号 13 | /// 14 | [Ignore] 15 | public Guid AccountId { get; set; } 16 | 17 | /// 18 | /// 皮肤名称 19 | /// 20 | public string Name { get; set; } 21 | 22 | /// 23 | /// 皮肤编码 24 | /// 25 | public string Code { get; set; } 26 | 27 | /// 28 | /// 皮肤主题 29 | /// 30 | public string Theme { get; set; } 31 | 32 | /// 33 | /// 皮肤尺寸 34 | /// 35 | public string Size { get; set; } 36 | } -------------------------------------------------------------------------------- /src/Data/Adapters/Data.Adapter.MySql/MySqlExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mkh.Data.Abstractions; 3 | using Mkh.Data.Abstractions.Adapter; 4 | using Mkh.Data.Abstractions.Options; 5 | 6 | // ReSharper disable once CheckNamespace 7 | namespace Microsoft.Extensions.DependencyInjection; 8 | 9 | public static class ServiceCollectionExtensions 10 | { 11 | /// 12 | /// 使用MySql数据库 13 | /// 14 | /// 15 | /// 连接字符串 16 | /// 自定义配置 17 | /// 18 | public static IDbBuilder UseMySql(this IDbBuilder builder, string connectionString, Action configure = null) 19 | { 20 | builder.UseDb(connectionString, DbProvider.MySql, configure); 21 | 22 | return builder; 23 | } 24 | } -------------------------------------------------------------------------------- /src/MessageQueue/MessageQueue.RabbitMQ/ServiceCollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Configuration; 2 | using Microsoft.Extensions.DependencyInjection; 3 | 4 | namespace Mkh.MessageQueue.RabbitMQ; 5 | 6 | public static class ServiceCollectionExtensions 7 | { 8 | /// 9 | /// 添加RabbitMQ功能 10 | /// 11 | /// 12 | /// 13 | /// 14 | public static IServiceCollection AddRabbitMQ(this IServiceCollection services, IConfiguration cfg) 15 | { 16 | var config = new RabbitMQConfig(); 17 | var section = cfg.GetSection("RabbitMQ"); 18 | section?.Bind(config); 19 | 20 | services.AddSingleton(config); 21 | services.AddSingleton(); 22 | 23 | return services; 24 | } 25 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/tsconfig.base.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "esnext", 4 | "useDefineForClassFields": true, 5 | "module": "esnext", 6 | "moduleResolution": "node", 7 | "strict": true, 8 | "jsx": "preserve", 9 | "sourceMap": true, 10 | "resolveJsonModule": true, 11 | "isolatedModules": true, 12 | "esModuleInterop": true, 13 | "declaration": false, 14 | "noImplicitAny": false, 15 | "lib": [ 16 | "esnext", 17 | "dom" 18 | ], 19 | "skipLibCheck": true, 20 | "baseUrl": ".", 21 | "paths": { 22 | "@/*": [ 23 | "src/*" 24 | ] 25 | }, 26 | "types": [ 27 | "vite/client", 28 | "node" 29 | ] 30 | } 31 | } -------------------------------------------------------------------------------- /src/Data/Adapters/Data.Adapter.Sqlite/SqliteExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mkh.Data.Abstractions; 3 | using Mkh.Data.Abstractions.Adapter; 4 | using Mkh.Data.Abstractions.Options; 5 | 6 | // ReSharper disable once CheckNamespace 7 | namespace Microsoft.Extensions.DependencyInjection; 8 | 9 | public static class ServiceCollectionExtensions 10 | { 11 | /// 12 | /// 使用Sqlite数据库 13 | /// 14 | /// 15 | /// 连接字符串 16 | /// 自定义配置 17 | /// 18 | public static IDbBuilder UseSqlite(this IDbBuilder builder, string connectionString, Action configure = null) 19 | { 20 | builder.UseDb(connectionString, DbProvider.Sqlite, configure); 21 | 22 | return builder; 23 | } 24 | } -------------------------------------------------------------------------------- /src/TaskScheduler/TaskScheduler.Core/TaskDescriptor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mkh.TaskScheduler.Abstractions; 3 | 4 | namespace Mkh.TaskScheduler.Core 5 | { 6 | internal class TaskDescriptor : ITaskDescriptor 7 | { 8 | /// 9 | /// 唯一编号,该编号动态生成 10 | /// 11 | public Guid Id { get; } 12 | 13 | /// 14 | /// 模块编码 15 | /// 16 | public string ModuleCode { get; set; } 17 | 18 | /// 19 | /// 显示名称 20 | /// 21 | public string DisplayName { get; set; } 22 | 23 | /// 24 | /// 类完整名称 25 | /// 26 | public string ClassFullName { get; set; } 27 | 28 | public TaskDescriptor() 29 | { 30 | Id = Guid.NewGuid(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /test/02_Data/Data.Adapter.PostgreSQL.Test/DbContextTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using Xunit; 8 | using Xunit.Abstractions; 9 | 10 | namespace Data.Adapter.PostgreSQL.Test; 11 | 12 | public class DbContextTests : BaseTest 13 | { 14 | public DbContextTests(ITestOutputHelper output) : base(output) 15 | { 16 | } 17 | 18 | /// 19 | /// 数据库上下文状态测试 20 | /// 21 | [Fact] 22 | public void NewConnectionTest() 23 | { 24 | using var con = _dbContext.NewConnection(); 25 | 26 | Assert.NotNull(con); 27 | Assert.Equal(ConnectionState.Closed, con.State); 28 | 29 | con.Open(); 30 | 31 | Assert.Equal(ConnectionState.Open, con.State); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Utils/Utils/File/FileExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Mkh.Utils.File; 2 | 3 | /// 4 | /// 常见文件扩展名 5 | /// 6 | public static class FileExtensions 7 | { 8 | public const string JPG = "JPG"; 9 | 10 | public const string JPEG = "JPEG"; 11 | 12 | public const string PNG = "PNG"; 13 | 14 | public const string GIF = "GIF"; 15 | 16 | public const string TXT = "TXT"; 17 | 18 | public const string PDF = "PDF"; 19 | 20 | public const string ZIP = "ZIP"; 21 | 22 | public const string DOC = "DOC"; 23 | 24 | public const string DOCX = "DOCX"; 25 | 26 | public const string XLS = "XLS"; 27 | 28 | public const string XLSX = "XLSX"; 29 | 30 | public const string APK = "APK"; 31 | 32 | public const string MP3 = "MP3"; 33 | 34 | public const string MP4 = "MP4"; 35 | 36 | public const string FLV = "FLV"; 37 | } -------------------------------------------------------------------------------- /test/02_Data/Data.Common.Test/Domain/Article/ArticleEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mkh.Data.Abstractions.Annotations; 3 | using Mkh.Data.Abstractions.Entities; 4 | 5 | namespace Data.Common.Test.Domain.Article 6 | { 7 | public class ArticleEntity : EntityBaseSoftDelete 8 | { 9 | [Column("分类编号")] 10 | public int CategoryId { get; set; } 11 | 12 | [Length(300)] 13 | [Column("标题")] 14 | public string Title { get; set; } 15 | 16 | [Length(0)] 17 | [Column("内容")] 18 | public string Content { get; set; } 19 | 20 | [Column("是否发布", null, null, "IsPublished")] 21 | public bool Published { get; set; } 22 | 23 | [Column("发布日期")] 24 | public DateTime? PublishedTime { get; set; } 25 | 26 | [Column("价格")] 27 | public decimal Price { get; set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Data/Adapters/Data.Adapter.SqlServer/SqlServerExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mkh.Data.Abstractions; 3 | using Mkh.Data.Abstractions.Adapter; 4 | using Mkh.Data.Abstractions.Options; 5 | 6 | // ReSharper disable once CheckNamespace 7 | namespace Microsoft.Extensions.DependencyInjection; 8 | 9 | public static class ServiceCollectionExtensions 10 | { 11 | // 12 | /// 使用SqlServer数据库 13 | /// 14 | /// 15 | /// 连接字符串 16 | /// 自定义配置 17 | /// 18 | public static IDbBuilder UseSqlServer(this IDbBuilder builder, string connectionString, Action configure = null) 19 | { 20 | builder.UseDb(connectionString, DbProvider.SqlServer, configure); 21 | 22 | return builder; 23 | } 24 | } -------------------------------------------------------------------------------- /src/Utils/Utils.Web/ControllerDescriptor.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Reflection; 3 | using System.Text.Json.Serialization; 4 | 5 | namespace Mkh.Utils.Web; 6 | 7 | /// 8 | /// 控制器描述符 9 | /// 10 | public class ControllerDescriptor 11 | { 12 | /// 13 | /// 区域 14 | /// 15 | public string Area { get; set; } 16 | 17 | /// 18 | /// 名称 19 | /// 20 | public string Name { get; set; } 21 | 22 | /// 23 | /// 说明 24 | /// 25 | public string Description { get; set; } 26 | 27 | /// 28 | /// 操作列表 29 | /// 30 | public List Actions { get; set; } 31 | 32 | /// 33 | /// 类型信息 34 | /// 35 | [JsonIgnore] 36 | public TypeInfo TypeInfo { get; set; } 37 | } -------------------------------------------------------------------------------- /src/Utils/Utils/Json/Converters/DateTimeConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Text.Json; 4 | using System.Text.Json.Serialization; 5 | 6 | namespace Mkh.Utils.Json.Converters; 7 | 8 | /// 9 | /// Json日期类型转换器 10 | /// 11 | public class DateTimeConverter : JsonConverter 12 | { 13 | public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 14 | { 15 | var json = reader.GetString(); 16 | if (json.IsNull()) 17 | return DateTime.MinValue; 18 | 19 | return json.ToDateTime(); 20 | } 21 | 22 | public override void Write(Utf8JsonWriter writer, DateTime value, JsonSerializerOptions options) 23 | { 24 | writer.WriteStringValue(value.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture)); 25 | } 26 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Domain/Role/RoleEntity.cs: -------------------------------------------------------------------------------- 1 | using Mkh.Data.Abstractions.Annotations; 2 | using Mkh.Data.Abstractions.Entities; 3 | 4 | namespace Mkh.Mod.Admin.Core.Domain.Role; 5 | 6 | /// 7 | /// 角色 8 | /// 9 | public partial class RoleEntity : EntityBaseSoftDelete 10 | { 11 | /// 12 | /// 名称 13 | /// 14 | public string Name { get; set; } 15 | 16 | /// 17 | /// 编码 18 | /// 19 | public string Code { get; set; } 20 | 21 | /// 22 | /// 备注 23 | /// 24 | [Length(300)] 25 | public string Remarks { get; set; } 26 | 27 | /// 28 | /// 锁定的,不允许修改 29 | /// 30 | public bool Locked { get; set; } 31 | 32 | /// 33 | /// 绑定的菜单分组编号 34 | /// 35 | public int MenuGroupId { get; set; } 36 | } -------------------------------------------------------------------------------- /src/Utils/Utils/Utils.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17mkh基础通用库 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /modules/01_Blog/Blog.Web/Blog.Web.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | true 17 | true 18 | Always 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Domain/Menu/MenuOpenTarget.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Mkh.Mod.Admin.Core.Domain.Menu; 4 | 5 | /// 6 | /// 菜单打开方式(只针对链接菜单) 7 | /// 8 | public enum MenuOpenTarget 9 | { 10 | /// 11 | /// 未知 12 | /// 13 | [Description("未知")] 14 | UnKnown = -1, 15 | /// 16 | /// 新窗口 17 | /// 18 | [Description("新窗口")] 19 | Blank, 20 | /// 21 | /// 当前窗口 22 | /// 23 | [Description("当前窗口")] 24 | Self, 25 | /// 26 | /// 对话框 27 | /// 28 | [Description("对话框")] 29 | Dialog, 30 | /// 31 | /// 容器内 32 | /// 33 | [Description("容器内")] 34 | Container, 35 | /// 36 | /// 内容区 37 | /// 38 | [Description("内容区")] 39 | Content 40 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/src/views/account/index/page.ts: -------------------------------------------------------------------------------- 1 | import type { PageDefinition } from 'mkh-ui' 2 | import component from './index.vue' 3 | 4 | const page: PageDefinition = { 5 | name: 'admin_account', 6 | icon: 'user', 7 | path: '/admin/account', 8 | permissions: ['admin_account_query_get', 'admin_account_DefaultPassword_get'], 9 | buttons: { 10 | add: { 11 | text: 'mkh.add', 12 | code: 'admin_account_add', 13 | permissions: ['admin_account_add_post'], 14 | }, 15 | edit: { 16 | text: 'mkh.edit', 17 | code: 'admin_account_edit', 18 | permissions: ['admin_account_edit_get', 'admin_account_update_post'], 19 | }, 20 | remove: { 21 | text: 'mkh.delete', 22 | code: 'admin_account_delete', 23 | permissions: ['admin_account_delete_delete'], 24 | }, 25 | }, 26 | component, 27 | } 28 | 29 | export default page 30 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Application/Role/Dto/RoleAddDto.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using Mkh.Mod.Admin.Core.Domain.Role; 3 | using Mkh.Utils.Annotations; 4 | 5 | namespace Mkh.Mod.Admin.Core.Application.Role.Dto; 6 | 7 | /// 8 | /// 角色添加 9 | /// 10 | [ObjectMap(typeof(RoleEntity))] 11 | public class RoleAddDto 12 | { 13 | /// 14 | /// 名称 15 | /// 16 | [Required(ErrorMessage = "请输入角色名称")] 17 | public string Name { get; set; } 18 | 19 | [Required(ErrorMessage = "请输入角色编码")] 20 | public string Code { get; set; } 21 | 22 | /// 23 | /// 备注 24 | /// 25 | public string Remarks { get; set; } 26 | 27 | /// 28 | /// 绑定的菜单分组编号 29 | /// 30 | [Range(1, int.MaxValue, ErrorMessage = "请选择绑定的菜单分组")] 31 | public int MenuGroupId { get; set; } 32 | } -------------------------------------------------------------------------------- /src/Excel/Excel.Abstractions/IExcelProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | using Mkh.Data.Abstractions.Entities; 4 | using Mkh.Excel.Abstractions.Export; 5 | 6 | namespace Mkh.Excel.Abstractions; 7 | 8 | /// 9 | /// Excel提供器接口 10 | /// 11 | public interface IExcelProvider 12 | { 13 | /// 14 | /// 导出实体数据 15 | /// 16 | /// 17 | /// 18 | Task> Export(ExcelExportEntityModel model) where T : IEntity; 19 | 20 | /// 21 | /// 根据模板导出 22 | /// 23 | /// 24 | /// 25 | /// 26 | Task> ExportByTemplate(string templatePath, IList> properties); 27 | } -------------------------------------------------------------------------------- /src/Module/Module.Core/ModuleLocalizerAbstract.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.Extensions.Localization; 3 | using Mkh.Module.Abstractions; 4 | 5 | namespace Mkh.Module.Core 6 | { 7 | public abstract class ModuleLocalizerAbstract : IModuleLocalizer 8 | { 9 | private readonly IStringLocalizer _localizer; 10 | 11 | protected ModuleLocalizerAbstract(IStringLocalizer localizer) 12 | { 13 | _localizer = localizer; 14 | } 15 | 16 | public IEnumerable GetAllStrings(bool includeParentCultures) 17 | { 18 | return _localizer.GetAllStrings(includeParentCultures); 19 | } 20 | 21 | public LocalizedString this[string name] => _localizer[name]; 22 | 23 | public LocalizedString this[string name, params object[] arguments] => _localizer[name, arguments]; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Cache/Cache.Redis/IRedisSerializer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using StackExchange.Redis; 3 | 4 | namespace Mkh.Cache.Redis; 5 | 6 | /// 7 | /// Redis序列化器 8 | /// 9 | public interface IRedisSerializer 10 | { 11 | /// 12 | /// 序列化 13 | /// 14 | /// 15 | /// 16 | /// 17 | string Serialize(T value); 18 | 19 | /// 20 | /// 反序列化 21 | /// 22 | /// 23 | /// 24 | /// 25 | T Deserialize(RedisValue value); 26 | 27 | /// 28 | /// 反序列化 29 | /// 30 | /// 31 | /// 32 | /// 33 | object Deserialize(RedisValue value, Type type); 34 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Infrastructure/Defaults/DefaultPasswordHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mkh.Utils.Annotations; 3 | using Mkh.Utils.Encrypt; 4 | 5 | namespace Mkh.Mod.Admin.Core.Infrastructure.Defaults; 6 | 7 | [SingletonInject] 8 | internal class DefaultPasswordHandler : IPasswordHandler 9 | { 10 | private readonly Md5Encrypt _encrypt; 11 | private const string KEY = "mkh_"; 12 | 13 | public DefaultPasswordHandler(Md5Encrypt encrypt) 14 | { 15 | _encrypt = encrypt; 16 | } 17 | 18 | /// 19 | /// 加密 20 | /// 21 | /// 22 | /// 23 | public string Encrypt(string password) 24 | { 25 | return _encrypt.Encrypt(KEY + password); 26 | } 27 | 28 | public string Decrypt(string encryptPassword) 29 | { 30 | throw new NotSupportedException("MD5加密无法解密~"); 31 | } 32 | } -------------------------------------------------------------------------------- /test/01_Utils/Utils.Tests/Encrypt/TripleDesEncryptTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | using Mkh.Utils.Encrypt; 3 | using Xunit; 4 | 5 | namespace Utils.Tests.Encrypt 6 | { 7 | public class TripleDesEncryptTests : BaseTest 8 | { 9 | private readonly TripleDesEncrypt _desEncrypt; 10 | 11 | public TripleDesEncryptTests() 12 | { 13 | _desEncrypt = ServiceProvider.GetService(); 14 | } 15 | 16 | [Fact] 17 | public void EncryptTest() 18 | { 19 | var str = _desEncrypt.Encrypt("17mkh"); 20 | 21 | Assert.Equal("gxo1ddAu6qQ=", str); 22 | } 23 | 24 | [Fact] 25 | public void Encrypt4HexTest() 26 | { 27 | var str = _desEncrypt.Encrypt4Hex("17mkh", lowerCase: true); 28 | 29 | Assert.Equal("831a3575d02eeaa4", str); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Core/Domain/AccountSkin/AccountSkinEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mkh.Data.Abstractions.Annotations; 3 | using Mkh.Data.Abstractions.Entities; 4 | 5 | namespace Mkh.Mod.Admin.Core.Domain.AccountSkin; 6 | 7 | /// 8 | /// 账户配置 9 | /// 10 | public class AccountSkinEntity : Entity 11 | { 12 | /// 13 | /// 账户编号 14 | /// 15 | public Guid AccountId { get; set; } 16 | 17 | /// 18 | /// 皮肤名称 19 | /// 20 | [Nullable] 21 | public string Name { get; set; } 22 | 23 | /// 24 | /// 皮肤编码 25 | /// 26 | [Nullable] 27 | public string Code { get; set; } 28 | 29 | /// 30 | /// 皮肤主题 31 | /// 32 | [Nullable] 33 | public string Theme { get; set; } 34 | 35 | /// 36 | /// 皮肤尺寸 37 | /// 38 | public string Size { get; set; } 39 | } -------------------------------------------------------------------------------- /modules/00_Admin/Admin.UI/api-extractor.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", 3 | 4 | "mainEntryPointFilePath": "/.temp/index.d.ts", 5 | 6 | "projectFolder": "./", 7 | 8 | "dtsRollup": { 9 | "enabled": true, 10 | "untrimmedFilePath": "/lib/index.d.ts", 11 | "publicTrimmedFilePath": "" 12 | }, 13 | 14 | "apiReport": { 15 | "enabled": false 16 | }, 17 | 18 | "docModel": { 19 | "enabled": false 20 | }, 21 | 22 | "tsdocMetadata": { 23 | "enabled": false 24 | }, 25 | "messages": { 26 | "extractorMessageReporting": { 27 | "ae-wrong-input-file-type": { 28 | "logLevel": "none" 29 | }, 30 | "ae-missing-release-tag": { 31 | "logLevel": "none" 32 | }, 33 | "ae-forgotten-export": { 34 | "logLevel": "none" 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /modules/00_Admin/Admin.Web/Controllers/ModuleController.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.AspNetCore.Http; 3 | using Microsoft.AspNetCore.Mvc; 4 | using Microsoft.AspNetCore.Mvc.ModelBinding; 5 | using Mkh.Auth.Abstractions; 6 | 7 | namespace Mkh.Mod.Admin.Web.Controllers; 8 | 9 | [Tags("模块管理")] 10 | public class ModuleController : Web.ModuleController 11 | { 12 | private readonly IPermissionResolver _permissionResolver; 13 | 14 | public ModuleController(IPermissionResolver permissionResolver) 15 | { 16 | _permissionResolver = permissionResolver; 17 | } 18 | 19 | /// 20 | /// 获取指定模块的权限列表 21 | /// 22 | /// 23 | [HttpGet] 24 | public IResultModel> Permissions([BindRequired] string moduleCode) 25 | { 26 | return ResultModel.Success(_permissionResolver.GetPermissions(moduleCode)); 27 | } 28 | } -------------------------------------------------------------------------------- /src/Data/Data.Core/Repository/RepositoryAbstract.Exists.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Mkh.Data.Abstractions; 4 | 5 | namespace Mkh.Data.Core.Repository; 6 | 7 | /// 8 | /// 是否存在 9 | /// 10 | public abstract partial class RepositoryAbstract 11 | { 12 | public async Task Exists(dynamic id, string tableName, IUnitOfWork uow = null) 13 | { 14 | //没有主键的表无法使用Exists方法 15 | if (EntityDescriptor.PrimaryKey.IsNo) 16 | throw new ArgumentException("该实体没有主键,无法使用Exists方法~"); 17 | 18 | var dynParams = GetIdParameter(id); 19 | var sql = _sql.GetExists(tableName); 20 | 21 | _logger.Write("Exists", sql); 22 | return await QuerySingleOrDefault(sql, dynParams, uow) > 0; 23 | } 24 | 25 | public Task Exists(dynamic id, IUnitOfWork uow = null) 26 | { 27 | return Exists(id, null, uow); 28 | } 29 | } -------------------------------------------------------------------------------- /src/Utils/Utils/Enums/Week.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Mkh.Utils.Enums; 4 | 5 | /// 6 | /// 星期 7 | /// 8 | public enum Week 9 | { 10 | /// 11 | /// 星期一 12 | /// 13 | [Description("星期一")] 14 | Monday, 15 | /// 16 | /// 星期二 17 | /// 18 | [Description("星期二")] 19 | Tuesday, 20 | /// 21 | /// 星期三 22 | /// 23 | [Description("星期三")] 24 | Wednesday, 25 | /// 26 | /// 星期四 27 | /// 28 | [Description("星期四")] 29 | Thursday, 30 | /// 31 | /// 星期五 32 | /// 33 | [Description("星期五")] 34 | Friday, 35 | /// 36 | /// 星期六 37 | /// 38 | [Description("星期六")] 39 | Saturday, 40 | /// 41 | /// 星期日 42 | /// 43 | [Description("星期日")] 44 | Sunday 45 | } -------------------------------------------------------------------------------- /src/MessageQueue/MessageQueue.RabbitMQ/RabbitMQConfig.cs: -------------------------------------------------------------------------------- 1 | namespace Mkh.MessageQueue.RabbitMQ; 2 | 3 | // ReSharper disable once InconsistentNaming 4 | /// 5 | /// 配置项 6 | /// 7 | public class RabbitMQConfig 8 | { 9 | /// 10 | /// 主机名 11 | /// 12 | public string HostName { get; set; } = "localhost"; 13 | 14 | /// 15 | /// 端口号 16 | /// 17 | public int Port { get; set; } = 5672; 18 | 19 | /// 20 | /// 用户名 21 | /// 22 | public string UserName { get; set; } = "guest"; 23 | 24 | /// 25 | /// 密码 26 | /// 27 | public string Password { get; set; } = "guest"; 28 | 29 | /// 30 | /// 虚拟目录 31 | /// 32 | public string VirtualHost { get; set; } 33 | 34 | /// 35 | /// 队列名称前缀 36 | /// 37 | public string Prefix { get; set; } 38 | } --------------------------------------------------------------------------------