├── .docs
├── intro
│ ├── application-config-example.md
│ ├── create-service-example.md
│ └── some-code-specification.md
└── sql
│ ├── common
│ ├── mysql
│ │ └── common-plugin.sql
│ └── oracle
│ │ └── common-plugin.oracle.sql
│ ├── framework
│ ├── mysql
│ │ ├── data.sql
│ │ └── schema.sql
│ └── oracle
│ │ ├── data.oracle.sql
│ │ └── schema.orace.sql
│ └── other
│ ├── nacos_v1.4.6.sql
│ └── xxl-job_v2.4.0.sql
├── .github
└── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
├── .gitignore
├── .gitmodules
├── CHANGELOG.md
├── LICENSE
├── README.md
├── ci
└── git-hooks
│ └── commit-msg
├── common
├── core
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── com
│ │ └── github
│ │ └── cadecode
│ │ └── uniboot
│ │ └── common
│ │ └── core
│ │ ├── annotation
│ │ └── ExcelField.java
│ │ ├── enums
│ │ ├── ApiErrorCode.java
│ │ └── ExtTypeCode.java
│ │ ├── exception
│ │ ├── ApiException.java
│ │ ├── BaseException.java
│ │ ├── ExtException.java
│ │ └── UtilException.java
│ │ ├── extension
│ │ ├── pipeline
│ │ │ ├── AbstractPipelineContext.java
│ │ │ ├── DefaultPipelineFilterChain.java
│ │ │ ├── PipelineContext.java
│ │ │ ├── PipelineFilterChain.java
│ │ │ ├── PipelineGenerator.java
│ │ │ ├── filter
│ │ │ │ ├── AbstractPipelineFilter.java
│ │ │ │ └── PipelineFilter.java
│ │ │ └── selector
│ │ │ │ ├── FilterSelector.java
│ │ │ │ └── LocalListFilterSelector.java
│ │ └── strategy
│ │ │ ├── AbstractStrategyExecutor.java
│ │ │ ├── StrategyContext.java
│ │ │ ├── StrategyExecutor.java
│ │ │ ├── StrategySelectorExecutor.java
│ │ │ └── StrategyService.java
│ │ ├── util
│ │ ├── AssertUtil.java
│ │ ├── JacksonUtil.java
│ │ ├── OfficeUtil.java
│ │ ├── SpringUtil.java
│ │ ├── TokenUtil.java
│ │ └── TreeUtil.java
│ │ └── web
│ │ ├── convertor
│ │ ├── ParamEnumConvertor.java
│ │ └── ParamEnumConvertorFactory.java
│ │ └── response
│ │ ├── ApiResult.java
│ │ ├── ApiStatus.java
│ │ ├── PageParams.java
│ │ └── PageResult.java
├── plugin
│ ├── actuator
│ │ └── pom.xml
│ ├── cache
│ │ ├── pom.xml
│ │ └── src
│ │ │ └── main
│ │ │ └── java
│ │ │ └── com
│ │ │ └── github
│ │ │ └── cadecode
│ │ │ └── uniboot
│ │ │ └── common
│ │ │ └── plugin
│ │ │ └── cache
│ │ │ ├── config
│ │ │ ├── CacheConfig.java
│ │ │ └── RedisConfig.java
│ │ │ ├── consts
│ │ │ └── CacheConst.java
│ │ │ ├── exception
│ │ │ ├── DLCacheException.java
│ │ │ ├── RedisLockException.java
│ │ │ └── RedisMessageException.java
│ │ │ ├── l2cache
│ │ │ ├── DLCacheProperties.java
│ │ │ ├── cache
│ │ │ │ ├── DLCache.java
│ │ │ │ └── DLCacheManager.java
│ │ │ └── sync
│ │ │ │ ├── DLCacheRefreshListener.java
│ │ │ │ └── DLCacheRefreshMsg.java
│ │ │ ├── listener
│ │ │ ├── RedisExpiredHandler.java
│ │ │ ├── RedisExpiredListener.java
│ │ │ └── RedisMessageListener.java
│ │ │ └── util
│ │ │ ├── KeyGeneUtil.java
│ │ │ ├── RedisLockKit.java
│ │ │ └── RedisUtil.java
│ ├── concurrent
│ │ ├── pom.xml
│ │ └── src
│ │ │ └── main
│ │ │ └── java
│ │ │ └── com
│ │ │ └── github
│ │ │ └── cadecode
│ │ │ └── uniboot
│ │ │ └── common
│ │ │ └── plugin
│ │ │ └── concurrent
│ │ │ ├── annotation
│ │ │ └── RateLimit.java
│ │ │ ├── aspect
│ │ │ └── RateLimitAspect.java
│ │ │ ├── config
│ │ │ └── DynamicTpConfig.java
│ │ │ ├── exception
│ │ │ └── RateLimitException.java
│ │ │ └── util
│ │ │ └── TransmitUtil.java
│ ├── datasource
│ │ ├── pom.xml
│ │ └── src
│ │ │ └── main
│ │ │ └── java
│ │ │ └── com
│ │ │ └── github
│ │ │ └── cadecode
│ │ │ └── uniboot
│ │ │ └── common
│ │ │ └── plugin
│ │ │ └── datasource
│ │ │ ├── annotation
│ │ │ └── DynamicDs.java
│ │ │ ├── aspect
│ │ │ └── DynamicDsAspect.java
│ │ │ ├── config
│ │ │ ├── DruidConfig.java
│ │ │ ├── DynamicDsAutoConfig.java
│ │ │ └── DynamicDsProperties.java
│ │ │ ├── dynamic
│ │ │ ├── DynamicDs.java
│ │ │ └── DynamicDsHolder.java
│ │ │ ├── exception
│ │ │ └── DynamicDsException.java
│ │ │ └── util
│ │ │ └── TransactionUtil.java
│ ├── job
│ │ ├── pom.xml
│ │ └── src
│ │ │ └── main
│ │ │ └── java
│ │ │ └── com
│ │ │ └── github
│ │ │ └── cadecode
│ │ │ └── uniboot
│ │ │ └── common
│ │ │ └── plugin
│ │ │ └── job
│ │ │ └── config
│ │ │ ├── XxlJobAutoConfig.java
│ │ │ └── XxlJobProperties.java
│ ├── log
│ │ ├── pom.xml
│ │ └── src
│ │ │ └── main
│ │ │ └── java
│ │ │ └── com
│ │ │ └── github
│ │ │ └── cadecode
│ │ │ └── uniboot
│ │ │ └── common
│ │ │ └── plugin
│ │ │ └── log
│ │ │ ├── annotation
│ │ │ └── ApiLogger.java
│ │ │ ├── aspect
│ │ │ └── ApiLoggerAspect.java
│ │ │ ├── handler
│ │ │ └── AbstractApiLogHandler.java
│ │ │ └── model
│ │ │ ├── BaseLogInfo.java
│ │ │ └── LogInfo.java
│ ├── mq
│ │ ├── pom.xml
│ │ └── src
│ │ │ └── main
│ │ │ └── java
│ │ │ └── com
│ │ │ └── github
│ │ │ └── cadecode
│ │ │ └── uniboot
│ │ │ └── common
│ │ │ └── plugin
│ │ │ └── mq
│ │ │ ├── config
│ │ │ ├── RabbitAutoConfig.java
│ │ │ ├── RabbitProperties.java
│ │ │ ├── TxMsgAutoConfig.java
│ │ │ └── TxMsgProperties.java
│ │ │ ├── consts
│ │ │ └── RabbitConst.java
│ │ │ ├── exception
│ │ │ └── TxMsgException.java
│ │ │ ├── handler
│ │ │ └── AbstractTxMsgHandler.java
│ │ │ ├── job
│ │ │ └── TxMsgJobRegister.java
│ │ │ ├── model
│ │ │ ├── BaseTxMsg.java
│ │ │ └── TxMsg.java
│ │ │ ├── rabbit
│ │ │ ├── RabbitCallback.java
│ │ │ └── RabbitConverter.java
│ │ │ └── util
│ │ │ ├── RabbitUtil.java
│ │ │ └── TxMsgKit.java
│ ├── mybatis
│ │ ├── pom.xml
│ │ └── src
│ │ │ └── main
│ │ │ └── java
│ │ │ └── com
│ │ │ └── github
│ │ │ └── cadecode
│ │ │ └── uniboot
│ │ │ └── common
│ │ │ └── plugin
│ │ │ └── mybatis
│ │ │ ├── annotation
│ │ │ └── UseDataScope.java
│ │ │ ├── aspect
│ │ │ └── DataScopeAspect.java
│ │ │ ├── config
│ │ │ └── MybatisConfig.java
│ │ │ ├── converter
│ │ │ ├── BoolToIntTypeHandler.java
│ │ │ ├── DefaultEnumTypeHandler.java
│ │ │ ├── EnumDbConvertor.java
│ │ │ └── ObjToStrTypeHandler.java
│ │ │ └── handler
│ │ │ ├── AbstractObjectFillHandler.java
│ │ │ ├── DataScopePermissionHandler.java
│ │ │ └── DataScopeResolver.java
│ ├── pom.xml
│ ├── storage
│ │ ├── pom.xml
│ │ └── src
│ │ │ └── main
│ │ │ └── java
│ │ │ └── com
│ │ │ └── github
│ │ │ └── cadecode
│ │ │ └── uniboot
│ │ │ └── common
│ │ │ └── plugin
│ │ │ └── storage
│ │ │ ├── config
│ │ │ └── XFileStorageConfig.java
│ │ │ ├── handler
│ │ │ └── AbstractStorageHandler.java
│ │ │ └── util
│ │ │ └── FtpPoolUtil.java
│ └── swagger
│ │ ├── pom.xml
│ │ └── src
│ │ └── main
│ │ └── java
│ │ └── com
│ │ └── github
│ │ └── cadecode
│ │ └── uniboot
│ │ └── common
│ │ └── plugin
│ │ └── swagger
│ │ ├── config
│ │ ├── SwaggerAutoConfig.java
│ │ └── SwaggerProperties.java
│ │ └── util
│ │ └── SwaggerRegisterKit.java
└── pom.xml
├── dependencies
└── pom.xml
├── example
├── example_api
│ └── pom.xml
├── example_svc
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── github
│ │ │ │ └── cadecode
│ │ │ │ └── uniboot
│ │ │ │ └── example
│ │ │ │ └── svc
│ │ │ │ ├── UniExampleApplication.java
│ │ │ │ ├── bean
│ │ │ │ └── data
│ │ │ │ │ └── ExampleMsgDo.java
│ │ │ │ ├── consumer
│ │ │ │ └── RabbitExampleConsumer.java
│ │ │ │ ├── controller
│ │ │ │ ├── DLCacheController.java
│ │ │ │ ├── DynamicDsController.java
│ │ │ │ ├── DynamicTpController.java
│ │ │ │ ├── LogExampleController.java
│ │ │ │ ├── MqExampleController.java
│ │ │ │ ├── RpcExampleController.java
│ │ │ │ ├── SpringRetryController.java
│ │ │ │ ├── TtlExecutorController.java
│ │ │ │ └── XFileStorageController.java
│ │ │ │ └── job
│ │ │ │ └── XxJobDemoJob.java
│ │ └── resources
│ │ │ ├── banner.txt
│ │ │ ├── bootstrap.yml
│ │ │ ├── logback-spring.xml
│ │ │ └── spy.properties
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── github
│ │ └── cadecode
│ │ └── uniboot
│ │ └── example
│ │ └── svc
│ │ └── UniExampleApplicationTests.java
└── pom.xml
├── framework
├── framework_api
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── com
│ │ └── github
│ │ └── cadecode
│ │ └── uniboot
│ │ └── framework
│ │ └── api
│ │ ├── bean
│ │ └── dto
│ │ │ ├── SysApiDto.java
│ │ │ └── SysUserDto.java
│ │ ├── consts
│ │ ├── HttpConst.java
│ │ ├── KeyPrefixConst.java
│ │ ├── LogTypeConst.java
│ │ └── SvcNameConst.java
│ │ ├── enums
│ │ ├── AuthErrorEnum.java
│ │ ├── AuthModelEnum.java
│ │ └── FrameErrorEnum.java
│ │ └── feignclient
│ │ ├── ExampleClient.java
│ │ ├── SysApiClient.java
│ │ └── SysUserClient.java
├── framework_base
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── com
│ │ └── github
│ │ └── cadecode
│ │ └── uniboot
│ │ └── framework
│ │ └── base
│ │ ├── advisor
│ │ ├── ApiExceptionAdvisor.java
│ │ ├── ApiResultAdvisor.java
│ │ └── FrameExceptionAdvisor.java
│ │ ├── annotation
│ │ ├── ApiFormat.java
│ │ └── ApiInner.java
│ │ ├── aspect
│ │ └── ApiInnerAspect.java
│ │ ├── config
│ │ ├── FeignConfig.java
│ │ ├── JacksonConfig.java
│ │ ├── PluginConfig.java
│ │ ├── RetryConfig.java
│ │ ├── SecurityConfig.java
│ │ ├── ThreadPoolConfig.java
│ │ └── WebMvcConfig.java
│ │ ├── enums
│ │ └── RoleTypeEnum.java
│ │ ├── exception
│ │ └── RetryableException.java
│ │ ├── feign
│ │ ├── FeignClientDecorator.java
│ │ └── FeignErrorDecoder.java
│ │ ├── plugin
│ │ ├── bean
│ │ │ ├── po
│ │ │ │ ├── PlgFile.java
│ │ │ │ ├── PlgLog.java
│ │ │ │ └── PlgMqMsg.java
│ │ │ └── vo
│ │ │ │ ├── PlgFileVo.java
│ │ │ │ ├── PlgLogVo.java
│ │ │ │ ├── PlgMqMsgVo.java
│ │ │ │ └── PlgSwaggerVo.java
│ │ ├── controller
│ │ │ ├── PlgFileController.java
│ │ │ ├── PlgLogController.java
│ │ │ ├── PlgMqMsgController.java
│ │ │ └── PlgSwaggerController.java
│ │ ├── convert
│ │ │ ├── PlgFileConvert.java
│ │ │ ├── PlgLogConvert.java
│ │ │ └── PlgMqMsgConvert.java
│ │ ├── enums
│ │ │ ├── ConsumeStateEnum.java
│ │ │ └── SendStateEnum.java
│ │ ├── handler
│ │ │ ├── LogSaveHandler.java
│ │ │ ├── MqTxMsgHandler.java
│ │ │ ├── MybatisFillHandler.java
│ │ │ ├── StorageRecordHandler.java
│ │ │ └── UserRoleDataScopeResolver.java
│ │ ├── mapper
│ │ │ ├── PlgFileMapper.java
│ │ │ ├── PlgLogMapper.java
│ │ │ └── PlgMqMsgMapper.java
│ │ ├── service
│ │ │ ├── PlgFileService.java
│ │ │ ├── PlgLogService.java
│ │ │ └── PlgMqMsgService.java
│ │ └── serviceimpl
│ │ │ ├── PlgFileServiceImpl.java
│ │ │ ├── PlgLogServiceImpl.java
│ │ │ └── PlgMqMsgServiceImpl.java
│ │ ├── security
│ │ ├── filter
│ │ │ ├── CorsAllowAnyFilter.java
│ │ │ ├── TokenAuthFilter.java
│ │ │ └── TraceInfoFilter.java
│ │ ├── handler
│ │ │ ├── NoAuthenticationHandler.java
│ │ │ └── NoAuthorityHandler.java
│ │ ├── model
│ │ │ └── SysUserDetails.java
│ │ ├── strategy
│ │ │ ├── JwtTokenAuthStrategyImpl.java
│ │ │ ├── RedisTokenAuthStrategyImpl.java
│ │ │ └── TokenAuthStrategy.java
│ │ └── voter
│ │ │ └── DataBaseRoleVoter.java
│ │ └── util
│ │ ├── RequestUtil.java
│ │ └── SecurityUtil.java
├── framework_svc
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── github
│ │ │ │ └── cadecode
│ │ │ │ └── uniboot
│ │ │ │ └── framework
│ │ │ │ └── svc
│ │ │ │ ├── UniFrameworkApplication.java
│ │ │ │ ├── bean
│ │ │ │ ├── po
│ │ │ │ │ ├── SysApi.java
│ │ │ │ │ ├── SysDept.java
│ │ │ │ │ ├── SysDict.java
│ │ │ │ │ ├── SysMenu.java
│ │ │ │ │ ├── SysRole.java
│ │ │ │ │ └── SysUser.java
│ │ │ │ └── vo
│ │ │ │ │ ├── SysApiVo.java
│ │ │ │ │ ├── SysDeptVo.java
│ │ │ │ │ ├── SysDictVo.java
│ │ │ │ │ ├── SysMenuVo.java
│ │ │ │ │ ├── SysRoleVo.java
│ │ │ │ │ └── SysUserVo.java
│ │ │ │ ├── config
│ │ │ │ ├── FrameSecurityConfig.java
│ │ │ │ └── UniFrameworkConfig.java
│ │ │ │ ├── controller
│ │ │ │ ├── AuthController.java
│ │ │ │ ├── CommonController.java
│ │ │ │ ├── ExampleControllerR.java
│ │ │ │ ├── SysApiController.java
│ │ │ │ ├── SysApiControllerR.java
│ │ │ │ ├── SysDeptController.java
│ │ │ │ ├── SysDictController.java
│ │ │ │ ├── SysMenuController.java
│ │ │ │ ├── SysRoleController.java
│ │ │ │ ├── SysUserController.java
│ │ │ │ └── SysUserControllerR.java
│ │ │ │ ├── convert
│ │ │ │ ├── SysApiConvert.java
│ │ │ │ ├── SysDeptConvert.java
│ │ │ │ ├── SysDictConvert.java
│ │ │ │ ├── SysMenuConvert.java
│ │ │ │ ├── SysRoleConvert.java
│ │ │ │ └── SysUserConvert.java
│ │ │ │ ├── mapper
│ │ │ │ ├── SysApiMapper.java
│ │ │ │ ├── SysDeptMapper.java
│ │ │ │ ├── SysDictMapper.java
│ │ │ │ ├── SysMenuMapper.java
│ │ │ │ ├── SysRoleMapper.java
│ │ │ │ └── SysUserMapper.java
│ │ │ │ ├── security
│ │ │ │ ├── JwtLoginSuccessHandleService.java
│ │ │ │ ├── LoginFailureHandler.java
│ │ │ │ ├── LoginSuccessHandleService.java
│ │ │ │ ├── LoginSuccessHandler.java
│ │ │ │ ├── RedisLoginSuccessHandleService.java
│ │ │ │ └── SignOutSuccessHandler.java
│ │ │ │ ├── service
│ │ │ │ ├── SysApiService.java
│ │ │ │ ├── SysDeptService.java
│ │ │ │ ├── SysDictService.java
│ │ │ │ ├── SysMenuService.java
│ │ │ │ ├── SysRoleService.java
│ │ │ │ └── SysUserService.java
│ │ │ │ ├── serviceimpl
│ │ │ │ ├── SysApiServiceImpl.java
│ │ │ │ ├── SysDeptServiceImpl.java
│ │ │ │ ├── SysDictServiceImpl.java
│ │ │ │ ├── SysMenuServiceImpl.java
│ │ │ │ ├── SysRoleServiceImpl.java
│ │ │ │ └── SysUserServiceImpl.java
│ │ │ │ └── util
│ │ │ │ └── FileUploadUtil.java
│ │ └── resources
│ │ │ ├── banner.txt
│ │ │ ├── bootstrap.yml
│ │ │ ├── logback-spring.xml
│ │ │ ├── mapper
│ │ │ ├── mysql
│ │ │ │ ├── SysApiMapper.xml
│ │ │ │ ├── SysMenuMapper.xml
│ │ │ │ ├── SysRoleMapper.xml
│ │ │ │ └── SysUserMapper.xml
│ │ │ └── oracle
│ │ │ │ ├── SysApiMapper.xml
│ │ │ │ ├── SysMenuMapper.xml
│ │ │ │ ├── SysRoleMapper.xml
│ │ │ │ └── SysUserMapper.xml
│ │ │ └── spy.properties
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── github
│ │ └── cadecode
│ │ └── uniboot
│ │ └── framework
│ │ └── svc
│ │ ├── JasyptEncryptorTest.java
│ │ └── UniFrameworkApplicationTests.java
└── pom.xml
├── gateway
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── github
│ │ └── cadecode
│ │ └── uniboot
│ │ └── gateway
│ │ ├── UniGatewayApplication.java
│ │ ├── config
│ │ └── GatewaySwaggerConfig.java
│ │ ├── controller
│ │ └── SwaggerController.java
│ │ ├── filter
│ │ ├── RequestHeaderFilter.java
│ │ └── TraceInfoFilter.java
│ │ └── handler
│ │ └── GlobalExceptionHandler.java
│ └── resources
│ ├── banner.txt
│ ├── bootstrap.yml
│ ├── logback-spring.xml
│ └── spy.properties
└── pom.xml
/.docs/intro/some-code-specification.md:
--------------------------------------------------------------------------------
1 | ## 一些代码规约
2 |
3 | ### 常见命名规范
4 |
5 | web 接口,以 Controller 结尾,放于 controller 包
6 |
7 | service,以 Service 结尾,放于 service 包
8 |
9 | service 实现,以 ServiceImpl 结尾,放于 serviceimpl 包
10 |
11 | dao,以 Mapper 结尾,放于 mapper 包
12 |
13 | manager(复杂业务聚合处理),以 Manager 结尾,放于 manager 包
14 |
15 | feign 客户端,以 Client 结尾,放于 feignclient 包
16 |
17 | bean 转换器,以 Convert 结尾,放于 convert 包
18 |
19 | aop 切面,以 Aspect 结尾,放于 aspect 包
20 |
21 | 常量类,以 Const 结尾,放于 consts 包
22 |
23 | 枚举类,以 Enum 结尾,放于 enums 包
24 |
25 | ### bean 的命名
26 |
27 | 在 bean 包下维护各类简单 bean(贫血模型)
28 |
29 | 数据表实体,类名和表名一致,放于 bean.po 或 bean.entity 包
30 |
31 | web 请求/返回实体,以 ReqVo/ResVo 结尾,放于 bean.vo 包
32 |
33 | feign 请求/返回实体,以 ReqDto/ResDto 结尾,放于 bean.dto 包
34 |
35 | mongoDB 实体,以 doc 结尾,放于 bean.doc 包
36 |
37 | 复杂业务实体,以 Bo 结尾,放于 bean.bo 包
38 |
39 | 其他数据实体,以 Do 结尾并冠以前缀,放于 bean.data 包,如
40 |
41 | - 缓存实体,以 CacheDo 结尾
42 | - es 实体,以 IdxDo 结尾
43 | - 消息实体,以 MsgDo 结尾
44 |
45 | 另外,一些独立于业务之外的简单 bean,由于工具类、框架配置等的需要,可放于 model 包下,也可使用内部类方式
46 |
47 | ### 工具类的命名
48 |
49 | 工具类放于 util 包
50 |
51 | 一般使用单数的 Util 结尾,当工具类需要注入使用时,推荐以 Kit 结尾进行区分
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 |
3 | name: Bug Report
4 | about: 问题报告
5 |
6 | ---
7 |
8 | ### Describe the bug 问题描述
9 |
10 | A clear and concise description of what the bug is. 简洁有效的说明问题。
11 |
12 | ### To Reproduce 重现问题
13 |
14 | Steps to reproduce the behavior. 把遇到的问题的发生步骤下下来:
15 |
16 | 1. xxx
17 | 2. xxx
18 |
19 | ### Expected behavior 期望效果
20 |
21 | A clear and concise description of what you expected to happen. 简单描述期望达成的效果。
22 |
23 | ### Screenshots 相关截图
24 |
25 | If applicable, add screenshots to help explain your problem. 如有必要,可以截图说明
26 |
27 | ### Version 版本说明
28 |
29 | Provide version information. 提供相关版本信息。
30 |
31 | 1. JDK 版本:8
32 | 2. xxx 版本:xxx
33 |
34 | ### Additional context 其他说明
35 |
36 | Add any other context about the problem here. 添加你认为有必要的补充内容。
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 |
3 | name: Feature Request
4 | about: 功能需求
5 |
6 | ---
7 |
8 | ### Describe the request 需求描述
9 |
10 | A clear and concise description of what the request is. 简洁有效的说明需求。
11 |
12 | ### Describe the solution 建议描述
13 |
14 | If applicable, add screenshots to help explain your problem. 如有必要,可以截图说明
15 |
16 | ### Additional context 其他说明
17 |
18 | Add any other context about the problem here. 添加你认为有必要的补充内容。
19 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | HELP.md
2 | target/
3 | !.mvn/wrapper/maven-wrapper.jar
4 | !**/src/main/**/target/
5 | !**/src/test/**/target/
6 |
7 | ### STS ###
8 | .apt_generated
9 | .classpath
10 | .factorypath
11 | .project
12 | .settings
13 | .springBeans
14 | .sts4-cache
15 |
16 | ### IntelliJ IDEA ###
17 | .idea
18 | *.iws
19 | *.iml
20 | *.ipr
21 |
22 | ### NetBeans ###
23 | /nbproject/private/
24 | /nbbuild/
25 | /dist/
26 | /nbdist/
27 | /.nb-gradle/
28 | build/
29 | !**/src/main/**/build/
30 | !**/src/test/**/build/
31 |
32 | ### VS Code ###
33 | .vscode/
34 |
35 | # Custom
36 | logs
37 |
38 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "app"]
2 | path = app
3 | url = https://github.com/cadecode/uni-boot-cloud-vue.git
4 |
--------------------------------------------------------------------------------
/ci/git-hooks/commit-msg:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # 获取提交信息
3 | commit_msg_file=$(git rev-parse --git-dir)/COMMIT_EDITMSG
4 | commit_msg=$(head -n 1 ${commit_msg_file})
5 | # 使用正则匹配 Angular 提交日志格式
6 | regex="^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert|wip|workflow|release)(\(.+\))?: .{1,72}$"
7 |
8 | if [[ ! ${commit_msg} =~ ${regex} ]]; then
9 | echo "Error: Commit message format does not comply with Angular commit message convention"
10 | echo "The correct format is: type(scope): short description (not exceeding 72 characters)"
11 | echo "For example: feat(core): Add new feature"
12 | exit 1
13 | fi
14 |
15 | exit 0
16 |
--------------------------------------------------------------------------------
/common/core/src/main/java/com/github/cadecode/uniboot/common/core/annotation/ExcelField.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.core.annotation;
2 |
3 | import java.lang.annotation.*;
4 |
5 | /**
6 | * Excel 字段注解
7 | * 基于 hutool-poi,提供注解支持
8 | *
9 | * @author Cade Li
10 | * @date 2023/6/9
11 | */
12 | @Target(ElementType.FIELD)
13 | @Retention(RetentionPolicy.RUNTIME)
14 | @Documented
15 | public @interface ExcelField {
16 |
17 | /**
18 | * 按表头对应名称映射字段
19 | * 读:用于根据表头确定列,比 colIndex 优先级高
20 | * 写:用于确定写出时的表头
21 | * 注意:由于使用 BeanUtil 进行 Map 到 Bean 的拷贝,即便 headAlias/colIndex 都没有生效,默认同名属性也会拷贝成功
22 | */
23 | String headAlias() default "";
24 |
25 | /**
26 | * 按列顺序映射字段
27 | * 读:在没有设置 headAlias 时 / 在读取没有表头的表格时用于确定列
28 | * 写:用于确定写出时列的顺序
29 | * 注意:多个字段 colIndex 不相同时只会有一个字段生效
30 | */
31 | int colIndex() default -1;
32 |
33 | /**
34 | * 是否读时忽略
35 | */
36 | boolean readIgnore() default false;
37 |
38 | /**
39 | * 是否写时忽略
40 | */
41 | boolean writeIgnore() default false;
42 | }
43 |
--------------------------------------------------------------------------------
/common/core/src/main/java/com/github/cadecode/uniboot/common/core/enums/ApiErrorCode.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.core.enums;
2 |
3 | import com.github.cadecode.uniboot.common.core.web.response.ApiStatus;
4 |
5 | /**
6 | * 通用异常错误码接口,使用枚举类继承该类,便于统一管理异常信息
7 | *
8 | * @author Cade Li
9 | * @date 2022/5/8
10 | */
11 | public interface ApiErrorCode {
12 |
13 | String DEFAULT_CODE = "UNKNOWN";
14 | String DEFAULT_MESSAGE = "未知错误";
15 |
16 | default String getCode() {
17 | return DEFAULT_CODE;
18 | }
19 |
20 | default String getMessage() {
21 | return DEFAULT_MESSAGE;
22 | }
23 |
24 | default int getStatus() {
25 | return ApiStatus.SERVER_ERROR;
26 | }
27 |
28 | /**
29 | * 未知异常
30 | */
31 | ApiErrorCode UNKNOWN = new ApiErrorCode() {};
32 | }
33 |
--------------------------------------------------------------------------------
/common/core/src/main/java/com/github/cadecode/uniboot/common/core/enums/ExtTypeCode.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.core.enums;
2 |
3 | /**
4 | * 扩展类型码接口,使用枚举类继承该类,便于统一管理扩展类型
5 | *
6 | * @author Cade Li
7 | * @since 2023/6/23
8 | */
9 | public interface ExtTypeCode {
10 |
11 | String getCode();
12 | }
13 |
--------------------------------------------------------------------------------
/common/core/src/main/java/com/github/cadecode/uniboot/common/core/exception/BaseException.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.core.exception;
2 |
3 | import cn.hutool.core.util.StrUtil;
4 |
5 | /**
6 | * 基础异常类
7 | *
message 支持字符串模板,由 hutool {@code StrUtil.format} 提供
8 | *
9 | * @author Cade Li
10 | * @since 2024/4/23
11 | */
12 | public class BaseException extends RuntimeException {
13 | public BaseException() {
14 | }
15 |
16 | public BaseException(String message, Object... params) {
17 | super(StrUtil.format(message, params));
18 | }
19 |
20 | public BaseException(String message, Throwable cause, Object... params) {
21 | super(StrUtil.format(message, params), cause);
22 | }
23 |
24 | public BaseException(Throwable cause) {
25 | super(cause);
26 | }
27 |
28 | public BaseException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Object... params) {
29 | super(StrUtil.format(message, params), cause, enableSuppression, writableStackTrace);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/common/core/src/main/java/com/github/cadecode/uniboot/common/core/exception/ExtException.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.core.exception;
2 |
3 | /**
4 | * 扩展异常
5 | *
6 | * @author Cade Li
7 | * @since 2023/6/24
8 | */
9 | public class ExtException extends BaseException {
10 | public ExtException() {
11 | }
12 |
13 | public ExtException(String message, Object... params) {
14 | super(message, params);
15 | }
16 |
17 | public ExtException(String message, Throwable cause, Object... params) {
18 | super(message, cause, params);
19 | }
20 |
21 | public ExtException(Throwable cause) {
22 | super(cause);
23 | }
24 |
25 | public ExtException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Object... params) {
26 | super(message, cause, enableSuppression, writableStackTrace, params);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/common/core/src/main/java/com/github/cadecode/uniboot/common/core/exception/UtilException.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.core.exception;
2 |
3 | /**
4 | * 工具类异常
5 | *
6 | * @author Cade Li
7 | * @date 2023/6/9
8 | */
9 | public class UtilException extends BaseException {
10 | public UtilException() {
11 | }
12 |
13 | public UtilException(String message, Object... params) {
14 | super(message, params);
15 | }
16 |
17 | public UtilException(String message, Throwable cause, Object... params) {
18 | super(message, cause, params);
19 | }
20 |
21 | public UtilException(Throwable cause) {
22 | super(cause);
23 | }
24 |
25 | public UtilException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Object... params) {
26 | super(message, cause, enableSuppression, writableStackTrace, params);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/common/core/src/main/java/com/github/cadecode/uniboot/common/core/extension/pipeline/AbstractPipelineContext.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.core.extension.pipeline;
2 |
3 | import com.github.cadecode.uniboot.common.core.enums.ExtTypeCode;
4 | import com.github.cadecode.uniboot.common.core.extension.pipeline.selector.FilterSelector;
5 | import lombok.Getter;
6 |
7 | /**
8 | * pipeline 上下文抽象类
9 | *
10 | * @author Cade Li
11 | * @since 2023/6/25
12 | */
13 | @Getter
14 | public abstract class AbstractPipelineContext implements PipelineContext {
15 |
16 | private final ExtTypeCode pipelineType;
17 | private final FilterSelector filterSelector;
18 |
19 | public AbstractPipelineContext(ExtTypeCode pipelineType, FilterSelector filterSelector) {
20 | this.pipelineType = pipelineType;
21 | this.filterSelector = filterSelector;
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/common/core/src/main/java/com/github/cadecode/uniboot/common/core/extension/pipeline/DefaultPipelineFilterChain.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.core.extension.pipeline;
2 |
3 | import com.github.cadecode.uniboot.common.core.extension.pipeline.filter.PipelineFilter;
4 | import lombok.Setter;
5 |
6 | import java.util.Objects;
7 |
8 | /**
9 | * 过滤器链默认实现
10 | *
11 | * @author Cade Li
12 | * @date 2023/6/20
13 | */
14 | public class DefaultPipelineFilterChain implements PipelineFilterChain {
15 |
16 | @Setter
17 | private PipelineFilterChain next;
18 | private final PipelineFilter filter;
19 |
20 | public DefaultPipelineFilterChain(PipelineFilterChain next, PipelineFilter filter) {
21 | this.next = next;
22 | this.filter = filter;
23 | }
24 |
25 |
26 | /**
27 | * 当前 filter 处理
28 | */
29 | @Override
30 | public void filter(T context) {
31 | filter.doFilter(context, this);
32 | }
33 |
34 | /**
35 | * 下一 filter 处理
36 | */
37 | @Override
38 | public void next(T context) {
39 | if (Objects.nonNull(this.next)) {
40 | this.next.filter(context);
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/common/core/src/main/java/com/github/cadecode/uniboot/common/core/extension/pipeline/PipelineContext.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.core.extension.pipeline;
2 |
3 | import com.github.cadecode.uniboot.common.core.enums.ExtTypeCode;
4 | import com.github.cadecode.uniboot.common.core.extension.pipeline.selector.FilterSelector;
5 |
6 | /**
7 | * pipeline 上下文
8 | *
9 | * @author Cade Li
10 | * @since 2023/6/23
11 | */
12 | public interface PipelineContext {
13 |
14 | ExtTypeCode getPipelineType();
15 |
16 | FilterSelector getFilterSelector();
17 |
18 | boolean continueChain();
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/common/core/src/main/java/com/github/cadecode/uniboot/common/core/extension/pipeline/PipelineFilterChain.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.core.extension.pipeline;
2 |
3 | /**
4 | * 过滤器链接口
5 | *
6 | * @author Cade Li
7 | * @date 2023/6/20
8 | */
9 | public interface PipelineFilterChain {
10 |
11 | void filter(T context);
12 |
13 | void next(T context);
14 | }
15 |
--------------------------------------------------------------------------------
/common/core/src/main/java/com/github/cadecode/uniboot/common/core/extension/pipeline/PipelineGenerator.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.core.extension.pipeline;
2 |
3 | import com.github.cadecode.uniboot.common.core.extension.pipeline.filter.PipelineFilter;
4 | import lombok.Getter;
5 |
6 | import java.util.Objects;
7 |
8 | /**
9 | * 管道构建器
10 | *
11 | * @author Cade Li
12 | * @date 2023/6/20
13 | */
14 | public class PipelineGenerator, A extends PipelineContext> {
15 |
16 | @Getter
17 | private DefaultPipelineFilterChain firstChain;
18 | private DefaultPipelineFilterChain lastChain;
19 |
20 | public void appendFilter(T filter) {
21 | DefaultPipelineFilterChain newChain = new DefaultPipelineFilterChain<>(null, filter);
22 | if (Objects.isNull(firstChain)) {
23 | firstChain = newChain;
24 | lastChain = firstChain;
25 | return;
26 | }
27 | lastChain.setNext(newChain);
28 | lastChain = newChain;
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/common/core/src/main/java/com/github/cadecode/uniboot/common/core/extension/pipeline/filter/AbstractPipelineFilter.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.core.extension.pipeline.filter;
2 |
3 | import com.github.cadecode.uniboot.common.core.extension.pipeline.PipelineContext;
4 | import com.github.cadecode.uniboot.common.core.extension.pipeline.PipelineFilterChain;
5 |
6 | /**
7 | * 过滤器抽象类
8 | *
9 | * @author Cade Li
10 | * @date 2023/6/20
11 | */
12 | public abstract class AbstractPipelineFilter implements PipelineFilter {
13 |
14 | /**
15 | * 过滤方法模板
16 | */
17 | @Override
18 | public void doFilter(T context, PipelineFilterChain filterChain) {
19 | // 如果包含该 filter
20 | if (context.getFilterSelector().matchFilter(this.getClass().getSimpleName())) {
21 | handle(context);
22 | }
23 | if (context.continueChain()) {
24 | filterChain.next(context);
25 | }
26 | }
27 |
28 | /**
29 | * 过滤处理主逻辑
30 | */
31 | public abstract void handle(T context);
32 | }
33 |
--------------------------------------------------------------------------------
/common/core/src/main/java/com/github/cadecode/uniboot/common/core/extension/pipeline/filter/PipelineFilter.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.core.extension.pipeline.filter;
2 |
3 | import com.github.cadecode.uniboot.common.core.extension.pipeline.PipelineContext;
4 | import com.github.cadecode.uniboot.common.core.extension.pipeline.PipelineFilterChain;
5 |
6 | /**
7 | * 过滤器接口
8 | *
9 | * @author Cade Li
10 | * @date 2023/6/20
11 | */
12 | public interface PipelineFilter {
13 |
14 | void doFilter(T context, PipelineFilterChain filterChain);
15 | }
16 |
--------------------------------------------------------------------------------
/common/core/src/main/java/com/github/cadecode/uniboot/common/core/extension/pipeline/selector/FilterSelector.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.core.extension.pipeline.selector;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * 过滤器选择器
7 | *
8 | * @author Cade Li
9 | * @date 2023/6/20
10 | */
11 | public interface FilterSelector {
12 |
13 | boolean matchFilter(String currFilterName);
14 |
15 | List getFilterNames();
16 | }
17 |
--------------------------------------------------------------------------------
/common/core/src/main/java/com/github/cadecode/uniboot/common/core/extension/pipeline/selector/LocalListFilterSelector.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.core.extension.pipeline.selector;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.NoArgsConstructor;
5 |
6 | import java.util.ArrayList;
7 | import java.util.List;
8 | import java.util.Objects;
9 |
10 | /**
11 | * 基于本地 list 的过滤器选择器
12 | *
13 | * @author Cade Li
14 | * @date 2023/6/20
15 | */
16 | @NoArgsConstructor
17 | @AllArgsConstructor
18 | public class LocalListFilterSelector implements FilterSelector {
19 |
20 | private List filterNames = new ArrayList<>();
21 |
22 | @Override
23 | public boolean matchFilter(String currFilterName) {
24 | return filterNames.stream().anyMatch(o -> Objects.equals(currFilterName, o));
25 | }
26 |
27 | @Override
28 | public List getFilterNames() {
29 | return filterNames;
30 | }
31 |
32 | public void addFilter(String filterName) {
33 | filterNames.add(filterName);
34 | }
35 |
36 | private void addFilters(List filterNames) {
37 | this.filterNames.addAll(filterNames);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/common/core/src/main/java/com/github/cadecode/uniboot/common/core/extension/strategy/AbstractStrategyExecutor.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.core.extension.strategy;
2 |
3 | import java.util.List;
4 | import java.util.Optional;
5 |
6 | /**
7 | * 策略执行器抽象类
8 | *
9 | * @author Cade Li
10 | * @since 2023/6/24
11 | */
12 | public abstract class AbstractStrategyExecutor implements StrategyExecutor {
13 |
14 | public abstract Optional selectService(Class clazz, StrategyContext context);
15 |
16 | public abstract List selectServices(Class clazz, StrategyContext context);
17 | }
18 |
--------------------------------------------------------------------------------
/common/core/src/main/java/com/github/cadecode/uniboot/common/core/extension/strategy/StrategyContext.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.core.extension.strategy;
2 |
3 | import com.github.cadecode.uniboot.common.core.enums.ExtTypeCode;
4 |
5 | /**
6 | * 策略上下文
7 | *
8 | * @author Cade Li
9 | * @since 2023/6/25
10 | */
11 | public interface StrategyContext {
12 |
13 | ExtTypeCode getStrategyType();
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/common/core/src/main/java/com/github/cadecode/uniboot/common/core/extension/strategy/StrategyExecutor.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.core.extension.strategy;
2 |
3 | import java.util.List;
4 | import java.util.function.Consumer;
5 | import java.util.function.Function;
6 |
7 | /**
8 | * 策略执行器接口
9 | *
10 | * @author Cade Li
11 | * @since 2023/6/24
12 | */
13 | public interface StrategyExecutor {
14 |
15 | void execute(Class clazz, StrategyContext context, Consumer consumer);
16 |
17 | void executeAll(Class clazz, StrategyContext context, Consumer consumer);
18 |
19 | R submit(Class clazz, StrategyContext context, Function function);
20 |
21 | List submitAll(Class clazz, StrategyContext context, Function function);
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/common/core/src/main/java/com/github/cadecode/uniboot/common/core/extension/strategy/StrategyService.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.core.extension.strategy;
2 |
3 | import org.springframework.plugin.core.Plugin;
4 |
5 | /**
6 | * 策略模式统一服务接口
7 | *
8 | * @author Cade Li
9 | * @since 2023/6/23
10 | */
11 | public interface StrategyService extends Plugin {
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/common/core/src/main/java/com/github/cadecode/uniboot/common/core/util/TreeUtil.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.core.util;
2 |
3 | import cn.hutool.core.util.ObjUtil;
4 |
5 | import java.util.List;
6 | import java.util.function.BiConsumer;
7 | import java.util.function.Function;
8 | import java.util.stream.Collectors;
9 |
10 | /**
11 | * Tree 工具
12 | *
13 | * @author Cade Li
14 | * @since 2023/11/26
15 | */
16 | public class TreeUtil {
17 |
18 | /**
19 | * List 树形化
20 | *
21 | * @param list 原数据列表
22 | * @param rootId root id
23 | * @param idGetter 获取 id 的方法
24 | * @param parentIdGetter 获取 parentId 的方法
25 | * @param childrenSetter 设置 children 的方法
26 | * @return 树形化之后的列表
27 | * @param 原数据类型
28 | * @param 数据 ID 类型
29 | */
30 | public static List listToTree(List list,
31 | L rootId,
32 | Function idGetter,
33 | Function parentIdGetter,
34 | BiConsumer> childrenSetter) {
35 | List parentList = list.stream()
36 | .filter(o -> ObjUtil.equals(rootId, parentIdGetter.apply(o)))
37 | .collect(Collectors.toList());
38 | parentList.forEach(p -> {
39 | List children = list.stream()
40 | .filter(c -> ObjUtil.equals(parentIdGetter.apply(c), idGetter.apply(p)))
41 | .peek(c -> childrenSetter.accept(c, listToTree(list, idGetter.apply(c), idGetter, parentIdGetter, childrenSetter)))
42 | .collect(Collectors.toList());
43 | childrenSetter.accept(p, children);
44 | });
45 | return parentList;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/common/core/src/main/java/com/github/cadecode/uniboot/common/core/web/convertor/ParamEnumConvertor.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.core.web.convertor;
2 |
3 | /**
4 | * 请求参数枚举转换接口
5 | *
6 | * @author Cade Li
7 | * @date 2022/5/28
8 | */
9 | public interface ParamEnumConvertor {
10 |
11 | /**
12 | * 返回枚举元素的对应标记
13 | */
14 | String convertBy();
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/common/core/src/main/java/com/github/cadecode/uniboot/common/core/web/convertor/ParamEnumConvertorFactory.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.core.web.convertor;
2 |
3 | import org.springframework.core.convert.converter.Converter;
4 | import org.springframework.core.convert.converter.ConverterFactory;
5 |
6 | import java.util.Arrays;
7 | import java.util.Map;
8 | import java.util.Objects;
9 | import java.util.concurrent.ConcurrentHashMap;
10 |
11 | import static java.util.stream.Collectors.toMap;
12 |
13 | /**
14 | * spring mvc 接口参数字符串转枚举转换器工厂
15 | *
16 | * @author Cade Li
17 | * @date 2022/6/14
18 | */
19 | public class ParamEnumConvertorFactory implements ConverterFactory {
20 |
21 | private static final Map, Converter> CONVERTER_MAP = new ConcurrentHashMap<>();
22 |
23 | @SuppressWarnings("unchecked")
24 | @Override
25 | public Converter getConverter(Class targetType) {
26 | Converter stringConverter = CONVERTER_MAP.get(targetType);
27 | if (Objects.isNull(stringConverter)) {
28 | stringConverter = new StringEnumConvertor<>(targetType);
29 | CONVERTER_MAP.put(targetType, stringConverter);
30 | }
31 | return (Converter) stringConverter;
32 | }
33 |
34 | /**
35 | * 字符串转枚举转换器
36 | */
37 | public static class StringEnumConvertor implements Converter {
38 |
39 | private final Map enumMap;
40 |
41 | public StringEnumConvertor(Class targetType) {
42 | enumMap = Arrays.stream(targetType.getEnumConstants())
43 | .collect(toMap(ParamEnumConvertor::convertBy, o -> o, (p, n) -> n));
44 | }
45 |
46 | @Override
47 | public T convert(String source) {
48 | return enumMap.get(source);
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/common/core/src/main/java/com/github/cadecode/uniboot/common/core/web/response/ApiStatus.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.core.web.response;
2 |
3 | /**
4 | * Http 状态码
5 | *
6 | * @author Cade Li
7 | * @date 2022/5/8
8 | */
9 | public interface ApiStatus {
10 |
11 | /**
12 | * 200 OK
13 | */
14 | int OK = 200;
15 | /**
16 | * 400 错误的请求
17 | */
18 | int BAD_REQUEST = 400;
19 | /**
20 | * 401 未验证
21 | */
22 | int NO_AUTHENTICATION = 401;
23 | /**
24 | * 403 被拒绝
25 | */
26 | int NO_AUTHORITY = 403;
27 | /**
28 | * 404 无法找到
29 | */
30 | int NOT_FOUND = 404;
31 | /**
32 | * 405 请求方法不合适
33 | */
34 | int BAD_REQUEST_METHOD = 405;
35 | /**
36 | * 410 已下线
37 | */
38 | int NOT_SUPPORT = 410;
39 | /**
40 | * 429 过多的请求
41 | */
42 | int TOO_MANY_REQUESTS = 429;
43 | /**
44 | * 500 内部服务错误
45 | */
46 | int SERVER_ERROR = 500;
47 | /**
48 | * 502 无效代理
49 | */
50 | int INVALID_AGENT = 502;
51 | /**
52 | * 503 服务暂时失效
53 | */
54 | int SERVER_UNAVAILABLE = 503;
55 | /**
56 | * 504 代理超时
57 | */
58 | int AGENT_TIMEOUT = 504;
59 | }
60 |
--------------------------------------------------------------------------------
/common/core/src/main/java/com/github/cadecode/uniboot/common/core/web/response/PageParams.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.core.web.response;
2 |
3 | import lombok.Data;
4 |
5 | import javax.validation.constraints.NotNull;
6 |
7 | /**
8 | * 分页参数
9 | *
10 | * @author Cade Li
11 | * @date 2023/4/23
12 | */
13 | @Data
14 | public class PageParams {
15 | @NotNull
16 | private Integer pageSize = 1;
17 | @NotNull
18 | private Integer pageNumber = 10;
19 |
20 | private String orderBy;
21 | }
22 |
--------------------------------------------------------------------------------
/common/core/src/main/java/com/github/cadecode/uniboot/common/core/web/response/PageResult.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.core.web.response;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Data;
5 | import lombok.NoArgsConstructor;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * 分页查询返回格式
11 | *
12 | * @author Cade Li
13 | * @date 2022/5/27
14 | */
15 | @Data
16 | @AllArgsConstructor
17 | @NoArgsConstructor
18 | public class PageResult {
19 |
20 | /**
21 | * 总条数
22 | */
23 | private Integer total;
24 |
25 | /**
26 | * 当前结果集
27 | */
28 | private List records;
29 | }
30 |
--------------------------------------------------------------------------------
/common/plugin/actuator/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | com.github.cadecode
7 | uni-boot-common-plugin
8 | 2024.2.0
9 |
10 | 4.0.0
11 |
12 | uni-boot-common-plugin-actuator
13 |
14 |
15 |
16 |
17 | org.springframework.boot
18 | spring-boot-starter-actuator
19 |
20 |
21 |
22 | de.codecentric
23 | spring-boot-admin-starter-client
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/common/plugin/cache/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | com.github.cadecode
7 | uni-boot-common-plugin
8 | 2024.2.0
9 |
10 | 4.0.0
11 |
12 | uni-boot-common-plugin-cache
13 |
14 |
15 |
16 | com.github.cadecode
17 | uni-boot-common-core
18 | ${uni.version}
19 |
20 |
21 |
22 |
23 | org.springframework.boot
24 | spring-boot-starter-cache
25 |
26 |
27 | io.lettuce
28 | lettuce-core
29 |
30 |
31 |
32 |
33 |
34 | org.springframework.boot
35 | spring-boot-starter-data-redis
36 |
37 |
38 | redis.clients
39 | jedis
40 |
41 |
42 |
43 | org.apache.commons
44 | commons-pool2
45 |
46 |
47 |
48 | com.github.ben-manes.caffeine
49 | caffeine
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/common/plugin/cache/src/main/java/com/github/cadecode/uniboot/common/plugin/cache/consts/CacheConst.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.plugin.cache.consts;
2 |
3 | /**
4 | * Cache 常量
5 | *
6 | * @author Cade Li
7 | * @date 2023/6/17
8 | */
9 | public class CacheConst {
10 |
11 | // cache manager name
12 | public static final String CCM_5S = "caffeineCacheManager5s";
13 | public static final String RCM_5M = "redisCacheManager5m";
14 | public static final String RCM_30M = "redisCacheManager30m";
15 | // 二级缓存
16 | public static final String DL = "dlCacheManager";
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/common/plugin/cache/src/main/java/com/github/cadecode/uniboot/common/plugin/cache/exception/DLCacheException.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.plugin.cache.exception;
2 |
3 | /**
4 | * DLCache 异常
5 | *
6 | * @author Cade Li
7 | * @date 2023/6/17
8 | */
9 | public class DLCacheException extends RuntimeException {
10 | public DLCacheException() {
11 | super();
12 | }
13 |
14 | public DLCacheException(String message) {
15 | super(message);
16 | }
17 |
18 | public DLCacheException(String message, Throwable cause) {
19 | super(message, cause);
20 | }
21 |
22 | public DLCacheException(Throwable cause) {
23 | super(cause);
24 | }
25 |
26 | protected DLCacheException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
27 | super(message, cause, enableSuppression, writableStackTrace);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/common/plugin/cache/src/main/java/com/github/cadecode/uniboot/common/plugin/cache/exception/RedisLockException.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.plugin.cache.exception;
2 |
3 | /**
4 | * Redis 相关异常
5 | *
6 | * @author Cade Li
7 | * @date 2023/6/9
8 | */
9 | public class RedisLockException extends RuntimeException {
10 | public RedisLockException() {
11 | }
12 |
13 | public RedisLockException(String message) {
14 | super(message);
15 | }
16 |
17 | public RedisLockException(String message, Throwable cause) {
18 | super(message, cause);
19 | }
20 |
21 | public RedisLockException(Throwable cause) {
22 | super(cause);
23 | }
24 |
25 | public RedisLockException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
26 | super(message, cause, enableSuppression, writableStackTrace);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/common/plugin/cache/src/main/java/com/github/cadecode/uniboot/common/plugin/cache/exception/RedisMessageException.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.plugin.cache.exception;
2 |
3 | /**
4 | * Redis 过期处理异常
5 | *
6 | * @author Cade Li
7 | * @date 2023/6/13
8 | */
9 | public class RedisMessageException extends RuntimeException {
10 |
11 | public RedisMessageException() {
12 | super();
13 | }
14 |
15 | public RedisMessageException(String message) {
16 | super(message);
17 | }
18 |
19 | public RedisMessageException(String message, Throwable cause) {
20 | super(message, cause);
21 | }
22 |
23 | public RedisMessageException(Throwable cause) {
24 | super(cause);
25 | }
26 |
27 | protected RedisMessageException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
28 | super(message, cause, enableSuppression, writableStackTrace);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/common/plugin/cache/src/main/java/com/github/cadecode/uniboot/common/plugin/cache/l2cache/DLCacheProperties.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.plugin.cache.l2cache;
2 |
3 | import lombok.Data;
4 | import org.springframework.boot.context.properties.ConfigurationProperties;
5 |
6 | import java.util.Map;
7 |
8 |
9 | /**
10 | * 二级缓存配置项
11 | *
12 | * @author Cade Li
13 | * @date 2023/6/15
14 | */
15 | @Data
16 | @ConfigurationProperties(prefix = "uni-boot.cache.dl")
17 | public class DLCacheProperties {
18 |
19 | /**
20 | * 是否存储 null 值
21 | */
22 | private boolean allowNullValues = true;
23 |
24 | /**
25 | * 过期时间,为 0 表示不过期,默认 30 分钟
26 | * 单位:毫秒
27 | */
28 | private long defaultExpiration = 30 * 60 * 1000;
29 |
30 | /**
31 | * 针对 cacheName 设置过期时间,为 0 表示不过期
32 | * 单位:毫秒
33 | */
34 | private Map cacheExpirationMap;
35 |
36 | /**
37 | * 本地缓存 caffeine 配置
38 | */
39 | private LocalConfig local = new LocalConfig();
40 |
41 | /**
42 | * 远程缓存 redis 配置
43 | */
44 | private RemoteConfig remote = new RemoteConfig();
45 |
46 |
47 | @Data
48 | public static class LocalConfig {
49 |
50 | /**
51 | * 初始化大小,为 0 表示默认
52 | */
53 | private int initialCapacity;
54 |
55 | /**
56 | * 最大缓存个数,为 0 表示默认
57 | * 默认最多 5 万条
58 | */
59 | private long maximumSize = 10000L;
60 | }
61 |
62 | @Data
63 | public static class RemoteConfig {
64 |
65 | /**
66 | * Redis pub/sub 缓存刷新通知主题
67 | */
68 | private String syncTopic = "cache:dl:refresh:topic";
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/common/plugin/cache/src/main/java/com/github/cadecode/uniboot/common/plugin/cache/l2cache/sync/DLCacheRefreshMsg.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.plugin.cache.l2cache.sync;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Builder;
5 | import lombok.Data;
6 | import lombok.NoArgsConstructor;
7 |
8 | /**
9 | * 二级缓存刷新消息
10 | *
11 | * @author Cade Li
12 | * @date 2023/6/15
13 | */
14 | @Data
15 | @AllArgsConstructor
16 | @NoArgsConstructor
17 | @Builder
18 | public class DLCacheRefreshMsg {
19 |
20 | private String cacheName;
21 |
22 | private Object key;
23 | }
24 |
--------------------------------------------------------------------------------
/common/plugin/cache/src/main/java/com/github/cadecode/uniboot/common/plugin/cache/listener/RedisExpiredHandler.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.plugin.cache.listener;
2 |
3 | /**
4 | * Redis 过期时间处理器接口
5 | *
6 | * @author Cade Li
7 | * @date 2023/6/12
8 | */
9 | public interface RedisExpiredHandler {
10 |
11 | boolean checkKey(String key);
12 |
13 | void handle(String key);
14 | }
15 |
--------------------------------------------------------------------------------
/common/plugin/cache/src/main/java/com/github/cadecode/uniboot/common/plugin/cache/listener/RedisMessageListener.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.plugin.cache.listener;
2 |
3 | import org.springframework.data.redis.connection.MessageListener;
4 | import org.springframework.data.redis.listener.Topic;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * Redis 消息监听器父类
10 | * 添加 topics 方法方便注册到 RedisMessageListenerContainer
11 | *
12 | * @author Cade Li
13 | * @date 2023/6/14
14 | */
15 | public abstract class RedisMessageListener implements MessageListener {
16 |
17 | public abstract List topics();
18 | }
19 |
--------------------------------------------------------------------------------
/common/plugin/cache/src/main/java/com/github/cadecode/uniboot/common/plugin/cache/util/KeyGeneUtil.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.plugin.cache.util;
2 |
3 | /**
4 | * Redis key 命名生成器
5 | *
6 | * @author Cade Li
7 | * @date 2022/5/29
8 | */
9 | public class KeyGeneUtil {
10 |
11 | public static final String SEPARATOR = ":";
12 |
13 | /**
14 | * 生成 : 分割的 redis key
15 | *
16 | * @param prefix 前缀
17 | * @param extra 其他字符串
18 | * @return redis key
19 | */
20 | public static String key(String prefix, Object... extra) {
21 | StringBuilder prefixBuilder = new StringBuilder(prefix);
22 | for (Object obj : extra) {
23 | prefixBuilder.append(SEPARATOR).append(obj);
24 | }
25 | return prefixBuilder.toString();
26 | }
27 |
28 | public static String lockKey(Object... extra) {
29 | return key("lock", extra);
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/common/plugin/concurrent/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | com.github.cadecode
7 | uni-boot-common-plugin
8 | 2024.2.0
9 |
10 | 4.0.0
11 |
12 | uni-boot-common-plugin-concurrent
13 |
14 |
15 |
16 | com.github.cadecode
17 | uni-boot-common-core
18 | ${uni.version}
19 |
20 |
21 |
22 |
23 | com.alibaba
24 | transmittable-thread-local
25 |
26 |
27 |
28 | org.dromara.dynamictp
29 | dynamic-tp-spring-cloud-starter-nacos
30 |
31 |
32 |
33 | org.dromara.dynamictp
34 | dynamic-tp-spring-boot-starter-extension-notify-email
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/common/plugin/concurrent/src/main/java/com/github/cadecode/uniboot/common/plugin/concurrent/annotation/RateLimit.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.plugin.concurrent.annotation;
2 |
3 | import org.springframework.core.annotation.AliasFor;
4 |
5 | import java.lang.annotation.*;
6 | import java.util.concurrent.TimeUnit;
7 |
8 | /**
9 | * 限流注解
10 | *
11 | * @author Cade Li
12 | * @date 2022/9/4
13 | */
14 | @Target({ElementType.METHOD})
15 | @Retention(RetentionPolicy.RUNTIME)
16 | @Documented
17 | public @interface RateLimit {
18 |
19 |
20 | @AliasFor("limitPerSecond")
21 | double value() default 1;
22 |
23 | /**
24 | * 每秒限制数量
25 | */
26 | @AliasFor("value")
27 | double limitPerSecond() default 1;
28 |
29 | /**
30 | * 等待超时时间
31 | * <0 表示时间不限
32 | * =0 表示不等待,直接返回结果
33 | * >0 表示超时时间
34 | */
35 | long waitTimeout() default -1;
36 |
37 | /**
38 | * 等待时间单位
39 | */
40 | TimeUnit waitTimeUnit() default TimeUnit.SECONDS;
41 |
42 | /**
43 | * 预热时间,单位毫秒
44 | * < 0 表示不需要预热
45 | */
46 | long warmupMillis() default -1;
47 | }
48 |
--------------------------------------------------------------------------------
/common/plugin/concurrent/src/main/java/com/github/cadecode/uniboot/common/plugin/concurrent/config/DynamicTpConfig.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.plugin.concurrent.config;
2 |
3 | import org.dromara.dynamictp.core.spring.EnableDynamicTp;
4 | import org.springframework.context.annotation.Configuration;
5 |
6 | /**
7 | * DynamicTp Config
8 | *
9 | * @author Cade Li
10 | * @since 2023/6/9
11 | */
12 | @EnableDynamicTp
13 | @Configuration
14 | public class DynamicTpConfig {
15 | }
16 |
--------------------------------------------------------------------------------
/common/plugin/concurrent/src/main/java/com/github/cadecode/uniboot/common/plugin/concurrent/exception/RateLimitException.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.plugin.concurrent.exception;
2 |
3 | /**
4 | * 限流异常
5 | *
6 | * @author Cade Li
7 | * @date 2023/6/9
8 | */
9 | public class RateLimitException extends RuntimeException{
10 | }
11 |
--------------------------------------------------------------------------------
/common/plugin/concurrent/src/main/java/com/github/cadecode/uniboot/common/plugin/concurrent/util/TransmitUtil.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.plugin.concurrent.util;
2 |
3 | import com.alibaba.ttl.TtlCallable;
4 | import com.alibaba.ttl.TtlRunnable;
5 | import com.alibaba.ttl.threadpool.TtlExecutors;
6 |
7 | import java.util.concurrent.Callable;
8 | import java.util.concurrent.Executor;
9 |
10 | /**
11 | * Transmittable 工具类
12 | *
13 | * @author Cade Li
14 | * @since 2023/6/9
15 | */
16 | public class TransmitUtil {
17 |
18 | // 包装线程池或者 Runnable/Callable
19 |
20 | public static Executor wrap(Executor executor) {
21 | return TtlExecutors.getTtlExecutor(executor);
22 | }
23 |
24 | public static TtlRunnable wrap(Runnable runnable) {
25 | return TtlRunnable.get(runnable);
26 | }
27 |
28 | public static TtlCallable wrap(Callable callable) {
29 | return TtlCallable.get(callable);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/common/plugin/datasource/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | com.github.cadecode
7 | uni-boot-common-plugin
8 | 2024.2.0
9 |
10 | 4.0.0
11 |
12 | uni-boot-common-plugin-datasource
13 |
14 |
15 |
16 | com.github.cadecode
17 | uni-boot-common-core
18 | ${uni.version}
19 |
20 |
21 |
22 |
23 | mysql
24 | mysql-connector-java
25 | runtime
26 |
27 |
28 |
29 | p6spy
30 | p6spy
31 |
32 |
33 |
34 | com.alibaba
35 | druid-spring-boot-starter
36 |
37 |
38 |
39 | com.baomidou
40 | dynamic-datasource-spring-boot-starter
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/common/plugin/datasource/src/main/java/com/github/cadecode/uniboot/common/plugin/datasource/annotation/DynamicDs.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.plugin.datasource.annotation;
2 |
3 | import java.lang.annotation.*;
4 |
5 | /**
6 | * 指定动态数据源注解
7 | *
8 | * @author Cade Li
9 | * @date 2022/5/10
10 | */
11 | @Target({ElementType.TYPE, ElementType.METHOD})
12 | @Retention(RetentionPolicy.RUNTIME)
13 | @Documented
14 | public @interface DynamicDs {
15 | String value();
16 | }
17 |
--------------------------------------------------------------------------------
/common/plugin/datasource/src/main/java/com/github/cadecode/uniboot/common/plugin/datasource/config/DynamicDsProperties.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.plugin.datasource.config;
2 |
3 | import com.zaxxer.hikari.HikariConfig;
4 | import lombok.Data;
5 | import org.springframework.boot.context.properties.ConfigurationProperties;
6 |
7 | import java.util.Map;
8 |
9 | /**
10 | * HikariDataSource 的动态数据源配置
11 | *
12 | * @author Cade Li
13 | * @since 2023/6/8
14 | */
15 | @Data
16 | @ConfigurationProperties("uni-boot.dynamic-ds")
17 | public class DynamicDsProperties {
18 |
19 | private boolean enable;
20 |
21 | /**
22 | * 主数据源 KEY
23 | */
24 | private String master;
25 |
26 | /**
27 | * 数据源 MAP
28 | */
29 | private Map datasource;
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/common/plugin/datasource/src/main/java/com/github/cadecode/uniboot/common/plugin/datasource/dynamic/DynamicDs.java:
--------------------------------------------------------------------------------
1 | package com.github.cadecode.uniboot.common.plugin.datasource.dynamic;
2 |
3 | import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
4 |
5 | import javax.sql.DataSource;
6 | import java.util.Map;
7 |
8 | /**
9 | * 动态数据源类
10 | *
11 | * @author Cade Li
12 | * @date 2021/12/3
13 | */
14 | public class DynamicDs extends AbstractRoutingDataSource {
15 |
16 | /**
17 | * 设置数据源 key
18 | */
19 | @Override
20 | protected Object determineCurrentLookupKey() {
21 | return DynamicDsHolder.getDataSourceKey();
22 | }
23 |
24 | /**
25 | * 设置全部数据源
26 | */
27 | @Override
28 | public void setTargetDataSources(Map