Skip to content
Back to skills

Mybatis

ASecurity

- Mapper接口方法名与XML中id一一对应,namespace为接口全限定名 - 动态SQL标签:<if test=""> 条件拼接、<choose>/<when>/<otherwise> 多分支、<foreach> 集合遍历 - ResultMap:一对一用<association>,一对多用<collection>,嵌套查询用select属性 - 参数传递:单参数直接用#{param},多参数用@Param注解或封装DTO - #{} 预编译防注入,${} 字符串替换仅用于动态表名/列名 - 分页:配合PageHelper插件,Mapper方法前调用PageHelper.startPage() - 批量操作:insert用<foreach>拼接VALUES,update用<foreach>+CASE WHEN - 缓存:一级缓存SqlSession级别默认开启,二级缓存需在XML加<cache/> - 通用字段(create_time/update_time)用拦截器自动填充 - XML文件放在 resources/mapper/ 目录,与接口包路径对应

  • 687 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added June 5, 2026
toolssql

Security analysis

A100/100

Scanned June 5, 2026

npx -y skills add val1813/kwcode --skill mybatis --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Mybatis?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Mybatis
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/val1813-mybatis/badge)](https://www.skillsdirectory.com/skills/val1813-mybatis)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: MybatisExpert
version: 1.0.0
trigger_keywords: [mybatis, mapper, xml映射, sql映射, dao]
trigger_min_confidence: 0.7
pipeline: [locator, generator, verifier]
lifecycle: mature
---

## 领域知识

- Mapper接口方法名与XML中id一一对应,namespace为接口全限定名
- 动态SQL标签:<if test=""> 条件拼接、<choose>/<when>/<otherwise> 多分支、<foreach> 集合遍历
- ResultMap:一对一用<association>,一对多用<collection>,嵌套查询用select属性
- 参数传递:单参数直接用#{param},多参数用@Param注解或封装DTO
- #{} 预编译防注入,${} 字符串替换仅用于动态表名/列名
- 分页:配合PageHelper插件,Mapper方法前调用PageHelper.startPage()
- 批量操作:insert用<foreach>拼接VALUES,update用<foreach>+CASE WHEN
- 缓存:一级缓存SqlSession级别默认开启,二级缓存需在XML加<cache/>
- 通用字段(create_time/update_time)用拦截器自动填充
- XML文件放在 resources/mapper/ 目录,与接口包路径对应

## 经验规则(自动生成)

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.