ddd4j-mybatis
Installation
SKILL.md
DDD4J MyBatis-Plus 持久层约定
编码 DDD4J 项目中 MyBatis-Plus 的使用规则。LLM 会用标准 MyBatis-Plus 写法,但不符项目约定。
为什么需要这个技能
LLM 会用 implements Serializable 定义实体——DDD4J 要求 extends BaseEntity<T extends Model<?>>(ActiveRecord模式)。LLM 会在 XML 中写 #{entity.beginTime}——DDD4J 要求 #{model.beginTime}(@Param("model"))。这些约定 LLM 不知道。
Capability Boundaries
✅ Strong Suits
- 实体继承链 — BaseEntity→Model(ActiveRecord),PaginationEntity→BaseEntity
- 审计字段 — createBy/createTime(INSERT填充)、updateBy/updateTime(INSERT_UPDATE填充)
- 逻辑删除 — @TableLogic 标记 isDeleted 字段
- @Param("model") 约定 — getPagedList 的参数名是 model,不是 entity
- 分页封装 — PaginationEntity(默认15条/页,Oracle风格offset=(pageNo-1)*limit+1)
- 类型处理器 — BooleanEnum(0/1)、JSON(双套)、List/Set/Array
- BaseMapper 内置方法 — getPagedList/setStatus/getCountBy*