- ExtDbLinkController.java: ssw-common 控制器 (跨 app_code 共享) - SswMapperConfig.java: 共享 @MapperScan 配置 (BS-14 集中化) 对应 CLAUDE.md §3.6 ssw-common 共享 MapperConfig 规范
26 lines
1.3 KiB
Java
26 lines
1.3 KiB
Java
package ssw.common.config;
|
|
|
|
import org.mybatis.spring.annotation.MapperScan;
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
/**
|
|
* ssw 共享 MapperConfig — 所有 ssw.*.mapper 由这一个配置统一注册
|
|
*
|
|
* ⚠️ 根因: JNPF MybatisPlusConfig @MapperScan 只扫 "jnpf.*.mapper" / "jnpf.mapper" / "com.xxl.job.admin.dao",
|
|
* 不扫 ssw.**.mapper, 导致所有 ssw-{app_code} 的 Mapper 接口无法被 Spring 注册为 bean.
|
|
* ⚠️ 现象: java.lang.NoSuchBeanDefinitionException: No qualifying bean of type 'ssw.{app_code}.mapper.XxxMapper'
|
|
*
|
|
* ✅ 单一解决方案: 本文件统一处理 ssw.**.mapper (覆盖所有 ssw-jxcj/ssw-tds/ssw-tdr/...)
|
|
* — 任何新加 ssw-{app_code} 包都无需再单独写 MapperConfig.
|
|
*
|
|
* 路径: ssw-common/ssw-common-biz/src/main/java/ssw/common/config/SswMapperConfig.java
|
|
* 加载: ssw-common-controller 被 jnpf-admin pom 依赖 → ssw-common-biz 传递依赖 → SswMapperConfig 自动注册.
|
|
* @SpringBootApplication(scanBasePackages = {"jnpf","ssw"}) 自动扫描 ssw.common.config 包.
|
|
*
|
|
* 历史: 2026-06-23 之前, 每个 ssw-{app_code} 都要在 ssw-{app_code}-biz 自己写 {AppCode}MapperConfig,
|
|
* 重复 + 易遗漏. 2026-06-23 集中到 ssw-common 共享 (BS-14 闭环).
|
|
*/
|
|
@Configuration
|
|
@MapperScan(basePackages = "ssw.**.mapper")
|
|
public class SswMapperConfig {
|
|
} |