参考了若依微服务架构,觉得可用性非常大,但是还是不能完全符合公司的使用性,花了一些时间进行改造。
最终的效果,每个大模组单独一个仓库、父级pom单独一个仓库管理、system单独一个仓库管理。
还去掉了一些无关紧要的模组。
先看看原来的若依结构。官方文档:介绍 | RuoYi
com.ruoyi
├── ruoyi-ui // 前端框架 [80]
├── ruoyi-gateway // 网关模块 [8080]
├── ruoyi-auth // 认证中心 [9200]
├── ruoyi-api // 接口模块
│ └── ruoyi-api-system // 系统接口
├── ruoyi-common // 通用模块
│ └── ruoyi-common-core // 核心模块
│ └── ruoyi-common-datascope // 权限范围
│ └── ruoyi-common-datasource // 多数据源
│ └── ruoyi-common-log // 日志记录
│ └── ruoyi-common-redis // 缓存服务
│ └── ruoyi-common-security // 安全模块
│ └── ruoyi-common-swagger // 系统接口
├── ruoyi-modules // 业务模块
│ └── ruoyi-system // 系统模块 [9201]
│ └── ruoyi-gen // 代码生成 [9202]
│ └── ruoyi-job // 定时任务 [9203]
│ └── ruoyi-file // 文件服务 [9300]
├── ruoyi-visual // 图形化管理模块
│ └── ruoyi-visual-monitor // 监控中心 [9100]
├──pom.xml // 公共依赖
改造后的一个结构
├── bdp-parent // 父级pom模组公共依赖
│ └── sql // sql
├── bdp-ui // 前端框架 [80]
├── bdp-gateway // 网关模块 [8080]
├── bdp-api // 接口模块
│ └── bdp-api-system // 系统接口
├── bdp-common // 通用模块
│ └── bdp-common-core // 核心模块
│ └── bdp-common-datascope // 权限范围
│ └── bdp-common-datasource // 多数据源
│ └── bdp-common-log // 日志记录
│ └── bdp-common-redis // 缓存服务
│ └── bdp-common-security // 安全模块
│ └── bdp-common-swagger // 系统接口
│ └── bdp-common-mybatis-plus // mybatis-plus拓展
├── bdp-modules // 业务模块
│ └── bdp-modules-controller // 这里做一个总的控制器,控制modules以下所有的控制器 [9202]
│ └── bdp-gen // 代码生成
├── bdp-system // 系统模块+认证中心 [9201]
每一个大模组为一个仓库,总共有7个仓库包括了前端。 其中 bdp-parent 、bdp-api、bdp-common 三个为公共类模组 ,其余 bdp-gateway 、bdp-system、bdp-modules-controller 三个为启动类模组。
这里为什么要把bdp-modules作为一个总的控制器出口启动类呢,因为我们之前的项目是参照若依的单体项目来整,单体要转成分布式的难度较大,所以在这里先这样设计,将之前的单体项目单个模组都挪到 跟bdp-gen同级别的位置,bdp-modules-controller 将其引用,作为总的输出。
后续有新增的模块可以放在跟system同级目录下,或者 bdp-gen同级作为一个模组。
源码:
https://gitee.com/gitee-regal/bdp-parent
https://gitee.com/gitee-regal/bdp-api
https://gitee.com/gitee-regal/bdp-common
https://gitee.com/gitee-regal/bdp-ui
https://gitee.com/gitee-regal/bdp-system
https://gitee.com/gitee-regal/bdp-modules
https://gitee.com/gitee-regal/bdp-gateway