按用户洞察 (jxcj 端到端 200 后):
- ssw-common 共享 SswMapperConfig (@MapperScan('ssw.**.mapper')) 已覆盖所有 ssw 业务包
- Mapper 不需要放 jnpf.mapper (走 jnpf MybatisPlusConfig 自带 @MapperScan)
- 走 ssw.{app_code}.mapper 更标准, 跟业务包命名一致, BS-14 集中化本意
具体改动:
1. templates/mapper.java: package 从 jnpf.mapper 改 ssw.{app_code}.mapper
注释说明走 ssw-common SswMapperConfig
2. SKILL.md 第 2 关键点: 'Mapper 放 jnpf.mapper' → 'Mapper 放 ssw.{app_code}.mapper (走 ssw-common 共享)'
3. 模板注释更新: BS-14 集中化说明
验证: jxcj 端到端 API 200 (用 ssw.jxcj.mapper.TeamMapper 路径, 被 SswMapperConfig 扫到)
30 lines
1.4 KiB
Java
30 lines
1.4 KiB
Java
package ssw.{app_code}.mapper; // ✅ Mapper 放 ssw.{app_code}.mapper (ssw-common 共享 SswMapperConfig 自动注册)
|
|
|
|
import ssw.{app_code}.entity.XxxEntity;
|
|
import jnpf.base.mapper.SuperMapper;
|
|
|
|
/**
|
|
* {业务描述} Mapper
|
|
*
|
|
* ⭐ FIX-TEMPLATE-V0.12+ (jxcj 实战验证 端到端 200):
|
|
* Mapper 放 `ssw.{app_code}.mapper` (不是 jnpf.mapper!)
|
|
* 由 ssw-common 共享 SswMapperConfig (@MapperScan("ssw.**.mapper")) 统一注册.
|
|
* 不需要自己写 MapperConfig. 业务包零 MapperConfig 配置 (BS-14 集中化).
|
|
*
|
|
* ⚠️ 必须同时创建同名 XML 文件 (即使是空的):
|
|
* src/main/java/ssw/{app_code}/mapper/XxxMapper.xml
|
|
* <?xml version="1.0" encoding="UTF-8"?>
|
|
* <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
* <mapper namespace="ssw.{app_code}.mapper.XxxMapper"></mapper>
|
|
*
|
|
* ⚠️ 必备配套 2 件 (BS-14/15, 见 ssw-pack-init):
|
|
* 1) ssw-{app_code}-biz/pom.xml 加 ssw-common-biz 依赖
|
|
* (共享 ssw.common.config.SswMapperConfig 含 @MapperScan("ssw.**.mapper"))
|
|
* 2) application-dev.yml: mybatis-plus.type-aliases-package: jnpf.**.entity,ssw.**.entity
|
|
*
|
|
* ❌ 没有 XML 文件会导致 "Invalid bound statement" 错误.
|
|
* ❌ 缺 ssw-common-biz 依赖会启动报 NoSuchBeanDefinitionException (BS-14).
|
|
*/
|
|
public interface XxxMapper extends SuperMapper<XxxEntity> {
|
|
}
|