项目模块结构说明.md 7.1 KB

Java 模块分层与引用关系

1. 分层结构(先看层次)

L0:根聚合层

  • storlead-saas-platform:全项目根 pom,负责聚合所有 Java 模块。

L1:平台基础层

  • java/storlead-dependencies:统一管理依赖版本(BOM)。
  • java/storlead-framework:基础框架层,提供公共能力(commoncoreauthmybatisredisweb)。

L2:平台能力域

  • java/storlead-system:系统模块(角色、模块、权限、设置等)。
  • java/storlead-user:用户模块聚合(子模块 storlead-user-corestorlead-user-spistorlead-user-bizstorlead-user-api)。
  • java/storlead-knowledge:知识库模块聚合(子模块 storlead-knowledge-corestorlead-knowledge-spistorlead-knowledge-bizstorlead-knowledge-api)。
  • java/storlead-thirdparty:第三方公共模块(企微、钉钉、支付宝等能力接入)。
  • java/storlead-account:账户业务模块。

L3:业务能力域

  • java/storlead-sms:手机短信模块(子模块 storlead-sms-corestorlead-sms-spistorlead-sms-bizstorlead-sms-api)。
  • java/storlead-message:站内消息模块(站内、邮箱、企微消息发送)。
  • java/storlead-es:ES 搜索模块。
  • java/storlead-sasa:子业务聚合模块(各业务线)。

L4:应用接入层

  • java/storlead-api:主 API 应用入口(当前启动类所在模块)。

2. 聚合树(父子关系)

storlead-saas-platform
├─ storlead-dependencies
├─ storlead-framework
│  ├─ storlead-common
│  ├─ storlead-core
│  ├─ storlead-auth
│  ├─ storlead-mybatis
│  ├─ storlead-redis
│  └─ storlead-web
├─ storlead-system
├─ storlead-user
│  ├─ storlead-user-core
│  ├─ storlead-user-spi
│  ├─ storlead-user-biz
│  └─ storlead-user-api
├─ storlead-knowledge
│  ├─ storlead-knowledge-core
│  ├─ storlead-knowledge-spi
│  ├─ storlead-knowledge-biz
│  └─ storlead-knowledge-api
├─ storlead-thirdparty
│  ├─ storlead-thirdparty-api
│  ├─ storlead-thirdparty-spi
│  ├─ storlead-thirdparty-biz
│  └─ storlead-thirdparty-dingtalk
├─ storlead-account
│  ├─ storlead-account-api
│  └─ storlead-account-biz
├─ storlead-sms
│  ├─ storlead-sms-core
│  ├─ storlead-sms-spi
│  ├─ storlead-sms-biz
│  └─ storlead-sms-api
├─ storlead-message
│  ├─ storlead-message-core
│  ├─ storlead-message-api
│  └─ storlead-message-biz
├─ storlead-es
│  ├─ storlead-es-core
│  ├─ storlead-es-api
│  └─ storlead-es-biz
├─ storlead-sasa
│  ├─ storlead-trade
│  │  ├─ storlead-customer
│  │  ├─ storlead-marketing
│  │  └─ storlead-acquisition
│  ├─ storlead-salary
│  ├─ storlead-sales
│  ├─ storlead-okr
│  └─ storlead-project
└─ storlead-api

3. 模块引用关系(依赖方向)

3.1 框架内部主链

  • storlead-core -> storlead-common
  • storlead-auth -> storlead-commonstorlead-core
  • storlead-redis -> storlead-common
  • storlead-mybatis -> storlead-commonstorlead-corestorlead-auth
  • storlead-web -> storlead-commonstorlead-corestorlead-redisstorlead-mybatis

3.2 业务模块主链

  • storlead-sms-spi -> storlead-common(对外契约与 BizResult
  • storlead-sms-biz -> storlead-sms-spistorlead-sms-corestorlead-commonstorlead-redisstorlead-mybatis
  • storlead-sms-api -> storlead-sms-spistorlead-sms-bizstorlead-web(HTTP Controller)
  • storlead-message-core -> storlead-commonstorlead-user-spi(间接依赖 storlead-user-core
  • storlead-message-biz -> storlead-message-corestorlead-commonstorlead-mybatisstorlead-webstorlead-user-biz
  • storlead-es-biz -> storlead-es-apistorlead-es-core
  • storlead-user-spi -> storlead-user-corestorlead-commonstorlead-mybatis
  • storlead-user-biz -> storlead-user-spistorlead-commonstorlead-mybatisstorlead-thirdparty-api
  • storlead-user-api -> storlead-user-spistorlead-user-bizstorlead-web(HTTP Controller 接入层)
  • storlead-knowledge-spi -> storlead-knowledge-corestorlead-commonstorlead-mybatis
  • storlead-knowledge-biz -> storlead-knowledge-spistorlead-commonstorlead-mybatis
  • storlead-knowledge-api -> storlead-knowledge-spistorlead-knowledge-bizstorlead-webstorlead-auth
  • storlead-system -> storlead-common
  • storlead-customerstorlead-marketingstorlead-acquisition -> storlead-commonstorlead-web
  • storlead-salarystorlead-salesstorlead-okrstorlead-project -> storlead-common
  • storlead-api -> storlead-commonstorlead-webstorlead-account-apistorlead-customer

3.3 第三方主链

  • storlead-thirdparty-spi -> storlead-thirdparty-api(对外扩展契约:com.storlead.thirdparty.spi
  • storlead-thirdparty-biz -> storlead-thirdparty-apistorlead-thirdparty-spi(默认聚合实现与自动配置)
  • storlead-thirdparty-dingtalk -> storlead-thirdparty-spi
  • storlead-thirdparty-wecom(目录存在)-> storlead-thirdparty-spistorlead-commonstorlead-webstorlead-redisstorlead-mybatis

4. 补充说明

  • 当前启动类:com.storlead.api.StorleadTradeApplication(位于 java/storlead-api)。
  • storlead-thirdparty-wecom 目录存在,但未在 java/storlead-thirdparty/pom.xml<modules> 中声明;如需纳入聚合构建,需要补充声明。

5. storlead-user 子模块与包结构

根包均为 com.storlead.user仅模型 + 业务接口 依赖 storlead-user-spi(传递 storlead-user-core);实现与数据访问 依赖 storlead-user-biz需要用户域 REST Controller 时再依赖 storlead-user-api(已含 spi、biz、web)。

子模块 Maven artifact 典型内容
core storlead-user-core pojo(entity/dto/vo)、model
spi storlead-user-spi 对外业务契约:service 下各 I* 接口
biz storlead-user-biz mapper 与 XML、service.implutilpropertytaskMETA-INF/spring.factoriesUserSystemConfigProperties
api storlead-user-api com.storlead.user.apiController 等 HTTP 接入

6. storlead-knowledge 子模块与包结构

根包为 com.storlead.knowledge模型 + 业务接口 依赖 storlead-knowledge-spi(传递 storlead-knowledge-core);实现与 Mapper 依赖 storlead-knowledge-bizREST 接入 依赖 storlead-knowledge-api

子模块 Maven artifact 典型内容
core storlead-knowledge-core pojomodel
spi storlead-knowledge-spi com.storlead.knowledge.serviceI* 接口
biz storlead-knowledge-biz mapper、XML、service.impl、自动配置等
api storlead-knowledge-api com.storlead.knowledge.apiController