mybatis-plus-usage

Standardize MyBatis-Plus and MPJ usage across Java Spring data access layers.

1|Updated Apr 15, 2026
One-click install
npx skills add https://github.com/codernai14-source/Forgex --skill mybatis-plus-usage
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mybatis-plus-usage
Source: https://github.com/codernai14-source/Forgex/tree/main/.cursor/skills/mybatis-plus-usage
Command: npx skills add https://github.com/codernai14-source/Forgex --skill mybatis-plus-usage

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

本技能将 MyBatis-Plus 与 MPJ 的使用规范化、标准化,帮助开发者在数据访问层中避免重复实现、确保一致的 CRUD、联表查询和复杂 SQL 的编写风格,从而提升代码质量和可维护性。

Core Features & Use Cases

  • 强制使用 BaseMapper 提供的 CRUD 方法,避免在 Mapper 接口中编写注解 SQL
  • 使用 MPJLambdaQueryWrapper 进行多表联表查询,提升查询可读性和安全性
  • 通过 XML 编写复杂 SQL,提升灵活性和性能优化空间
  • 提供 Service 层示例与最佳实践,帮助新手快速上手

Quick Start

在项目中让 Mapper 继承 BaseMapper,并优先使用 MPJLambdaQueryWrapper 进行联表查询,复杂 SQL 通过 XML 实现。

Frequently Asked Questions about mybatis-plus-usage

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I standardize MyBatis-Plus CRUD operations and avoid annotation-based SQL in mappers?

Standardize MyBatis-Plus CRUD by extending BaseMapper for standard operations and enforcing no annotation-based SQL in mapper interfaces. This ensures consistent data access and improves code maintainability across Java Spring projects.

What is the best way to perform multi-table join queries with MyBatis-Plus?

The best way to perform multi-table join queries with MyBatis-Plus is using MPJLambdaQueryWrapper. It promotes MPJ wrappers to enhance query readability and safety across data access layers without writing raw SQL annotations.

When should I use XML-based SQL instead of MPJLambdaQueryWrapper in MyBatis-Plus?

Use XML-based SQL in MyBatis-Plus for complex SQL statements that require maximum flexibility and performance optimization. MPJLambdaQueryWrapper handles standard joins, while XML templates manage highly intricate queries.

Does this MyBatis-Plus standardization approach work with Java Spring projects?

Yes, this MyBatis-Plus standardization applies directly to Java Spring projects. It automates data access layer consistency by providing Service layer examples and XML templates for BaseMapper CRUD and MPJ joins.

Why should I avoid annotation-based SQL in MyBatis-Plus mappers?

Avoid annotation-based SQL in MyBatis-Plus mappers to prevent fragmented query logic and ensure consistent code style. Moving complex SQL to XML and standard joins to MPJ wrappers improves overall project maintainability.