[Github] 2. MyBatis Generator Custom Plugins
[Github] 2. MyBatis Generator Custom Plugins
🔗 Project Repository: mybatis-generator-custome-plugins
A powerful collection of MyBatis Generator custom plugins designed to enhance code generation capabilities with MySQL-specific features, DTO layer generation, and automatic Service layer generation.
🚀 Features Overview
This plugin collection includes 6 custom plugins:
| Plugin Name | Description | Key Features |
|---|---|---|
InsertIgnoreIntoPlugin | MySQL INSERT IGNORE statement support | Batch insert ignoring duplicate records |
InsertOnDuplicateKeyPlugin | MySQL ON DUPLICATE KEY UPDATE support | Auto update on insert conflicts |
ReplaceIntoPlugin | MySQL REPLACE INTO statement support | Replace insert operations |
DtoGeneratorPlugin | DTO layer code generation | Lombok annotations, Entity conversion methods |
ServiceGeneratorPlugin | Service layer code generation | Interface + Implementation, Complete CRUD operations |
CustomerMapperPlugin | Custom Mapper generation | Extended native Mapper functionality |
📦 Dependency Analysis
Core Dependencies
| |
Maven Plugin Configuration
| |
🔧 Plugin Details
MySQL Extension Plugins
InsertIgnoreIntoPlugin
- Function: Adds
INSERT IGNOREstatement support to Mapper - Generated Methods:
insertIgnoreCustom(),insertIgnoreBatchCustom() - Use Cases: Ignore primary key conflicts during batch inserts
InsertOnDuplicateKeyPlugin
- Function: Adds
ON DUPLICATE KEY UPDATEstatement support to Mapper - Generated Methods:
insertOnDuplicateKeyCustom(),insertOnDuplicateKeyBatchCustom() - Use Cases: Auto update records on duplicate key conflicts during insert
ReplaceIntoPlugin
- Function: Adds
REPLACE INTOstatement support to Mapper - Generated Methods:
replaceIntoCustom(),replaceIntoBatchCustom() - Use Cases: Replace existing records or insert new ones
DTO Layer Generation Plugin
DtoGeneratorPlugin
- Function: Automatically generates DTO classes
- Features:
- Lombok annotation support (
@Data,@Builder,@AllArgsConstructor,@NoArgsConstructor) - Auto-generated
fromEntity()andtoEntity()conversion methods - Package structure:
*.model.dto
- Lombok annotation support (
Service Layer Generation Plugin
ServiceGeneratorPlugin
- Function: Automatically generates Service interfaces and implementation classes
- Features:
- Complete CRUD operation methods
- Support for single and composite primary keys
- Spring annotation support (
@Service,@Autowired) - Package structure:
*.service.interfacesand*.service.impl
Custom Mapper Plugin
CustomerMapperPlugin
- Function: Generates extended Mapper interfaces
- Package structure:
*.dao.customer
💻 Usage Guide
Step 1: Add Dependencies
Add the plugin to your project:


