From 5a661b84a70bf283fdca96223e5407b1cac0be24 Mon Sep 17 00:00:00 2001 From: ssw Date: Mon, 29 Jun 2026 15:34:29 +0800 Subject: [PATCH] =?UTF-8?q?fix(backend-dev):=20v0.12+=20Mapper=20=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E4=BB=8E=20jnpf.mapper=20=E6=94=B9=20ssw.{app=5Fcode}?= =?UTF-8?q?.mapper?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 按用户洞察 (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 扫到) --- skills/backend-dev/templates/mapper.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/skills/backend-dev/templates/mapper.java b/skills/backend-dev/templates/mapper.java index 875d821..b9c4fbd 100644 --- a/skills/backend-dev/templates/mapper.java +++ b/skills/backend-dev/templates/mapper.java @@ -1,4 +1,4 @@ -package ssw.{app_code}.mapper; // ✅ Mapper 必须放 ssw.{app_code}.mapper +package ssw.{app_code}.mapper; // ✅ Mapper 放 ssw.{app_code}.mapper (ssw-common 共享 SswMapperConfig 自动注册) import ssw.{app_code}.entity.XxxEntity; import jnpf.base.mapper.SuperMapper; @@ -6,11 +6,15 @@ import jnpf.base.mapper.SuperMapper; /** * {业务描述} Mapper * - * ✅ Mapper 放 `ssw.{app_code}.mapper` (由 ssw-common 共享 SswMapperConfig 自动注册) - * ⚠️ 必须同时创建同名 XML 文件(即使是空的): + * ⭐ 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 * - * + * * * * ⚠️ 必备配套 2 件 (BS-14/15, 见 ssw-pack-init): @@ -18,8 +22,8 @@ import jnpf.base.mapper.SuperMapper; * (共享 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)。 + * ❌ 没有 XML 文件会导致 "Invalid bound statement" 错误. + * ❌ 缺 ssw-common-biz 依赖会启动报 NoSuchBeanDefinitionException (BS-14). */ public interface XxxMapper extends SuperMapper { -} \ No newline at end of file +}