1. Overview
EasyFK Generator is the core code generation tool of the EasyFK framework. Designed for Java / Spring Boot development teams, it delivers configuration-driven, database-aware, full-layer one-stop code generation capabilities.
Core Capabilities:
- Project Scaffolding: Automatically creates complete Maven / Gradle multi-module project structures
- Full-Layer Code Generation: Entity → Mapper → Repository → Service → API → Remote → Controller, generating 8–15 Java classes from a single table
- Database Awareness: Connects directly to databases to automatically parse table schemas, column types, comments, and other metadata
- Multi-Architecture Support: One-click switching across four architectures — Monolithic (SINGLE), Microservice Product Layer (MICRO_PRD), Microservice (MICROSERVICE), and Multi-Stack Microservice (SMART)
- Multi-ORM Support: Choose from three ORM frameworks — MyBatis-Plus, MyBatis-Flex, and Hibernate
- Multi-Build Tool Support: Supports Maven, Gradle Groovy DSL, and Gradle Kotlin DSL
- Incremental Safety: Existing files are never overwritten; only DTO/Param classes are refreshed when table schemas change
Two Ways to Use:
- IntelliJ IDEA Plugin (Recommended): Visual UI supporting database schema import, step-by-step generation, and configuration persistence with zero learning curve
- CLI Tool: Runs independently of any IDE, generating the full stack with a single command — ideal for automation workflows
2. Environment Requirements
| Item | Requirement |
|---|---|
| JDK | 21 or higher (Download) |
| IDE (Plugin mode) | IntelliJ IDEA 2023.1 or higher |
| Database (Optional) | A reachable database instance is required when importing table schemas from a database |
3. Method 1: IntelliJ IDEA Plugin (Recommended)
EasyFK Generator provides the EasyFK Generator IntelliJ IDEA plugin with a visual UI, enabling code generation without manually writing configuration files — the most convenient way to use it.
3.1 Plugin Installation
Method 1: Install from JetBrains Marketplace (Recommended)
- Open IntelliJ IDEA and go to
File → Settings → Plugins(macOS:IntelliJ IDEA → Preferences → Plugins) - Select the Marketplace tab
- Search for EasyFK Generator
- Click Install, then restart the IDE once installation completes
Tip: If EasyFK Generator does not appear in Marketplace search results, you can manually download the plugin package from the official JetBrains Plugins page:
https://plugins.jetbrains.com/plugin/30796-easyfk-generator/versions#tabs
Download the latest .zip file and follow the "Install from Local Disk" steps below.
Method 2: Install from Local Disk
- Obtain the plugin package
easyfk-generator-idea-x.x.x.zip - Open IntelliJ IDEA and go to
File → Settings → Plugins - Click the gear icon ⚙ → Install Plugin from Disk...
- Select the downloaded
.zipfile, then restart the IDE once installation completes
3.2 Core Features
- Visual Configuration: Fill in project, model, and code settings via dialogs without hand-writing YAML
- Database Import: Visually connect to a database, select tables to import, and automatically generate model definitions
- Step-by-Step Generation: Four independent buttons at the bottom of the dialog — "Generate Project", "Generate Model", "Generate Business Code", and "Generate Auto-Configuration"
- Tool Window: Quick-access panel on the right sidebar grouped by scenario (New Project / Incremental Generation / Individual Generation)
- Configuration Persistence: The IDEA plugin automatically saves
generator.ymlto the project root and reloads it on next launch - Keyboard Shortcut:
Ctrl + Alt + Zto quickly open the code generation dialog
3.3 Plugin Entry Points
| Entry Point | Description |
|---|---|
| File → New → EasyFK Project | Create a new project, scaffold the project structure, and generate code |
| Generate → EasyFK Incremental Generation | Generate code in an existing project without overwriting existing files (Ctrl + Alt + Z) |
| Generate → EasyFK Generate Business Code | Generate only Repository / Service / API / Remote / Controller |
| Generate → EasyFK Refresh Model (Field Changes) | Regenerate Entity / Mapper + DTO / Param |
| Generate → EasyFK Refresh DTO/Param | Regenerate only DTO and Param classes |
| Generate → EasyFK Generate AutoConfiguration | Generate Spring Boot AutoConfiguration |
| Right Tool Window → EasyFK | Quick-action panel grouped by scenario |
3.4 Global Settings
File → Settings → Tools → EasyFK Generator:
| Setting | Description | Default |
|---|---|---|
| Default Author | @author tag in generated Javadoc comments | eb-jack |
| Default Framework Version | EasyFK framework version number | 3.5.16 |
| Auto-refresh Project Tree After Generation | Automatically refreshes the IDEA project directory after generation | Enabled |
| Show Summary Dialog After Generation | Displays a generation summary dialog upon completion | Enabled |
For detailed IDEA plugin usage instructions, refer to easyfk-generator-idea/USER_MANUAL.md.
3.5 Plugin Version Upgrade Notes
1.0.8
- Refactored the Model Configuration tab from "Import from Database / Manually Create Model" to "Select Tables / Confirm Models" for a more seamless table-selection and model-control workflow
- Switching to "Confirm Models" now automatically builds the model list from
db-tablesand merges it withmodel-list - Tables imported from a database can now set
only-repository: truedirectly in "Confirm Models" to generate only the Repository layer - Changed
table-prefixsemantics to "ignored table prefixes", supporting multiple comma-separated prefixes - Removed the obsolete project-level
create-repositorysetting; generation scope is now unified under the model-levelonly-repositoryoption
4. Method 2: CLI Tool
The CLI tool runs standalone without requiring an IDE or Spring Boot project environment. It is ideal for bootstrapping new projects from scratch, quickly generating code in any directory, or integrating into CI/CD automation pipelines.
4.1 Installation
- Obtain and extract the installation package
efg-3.5.16.zip - Enter the
efg-3.5.16directory and run the installer:
Windows:
Double-click install.batmacOS / Linux:
chmod +x install && ./install- Reopen your terminal and verify the installation:
efg -VThe following output indicates a successful installation:
easyfk-generator 3.5.164.2 Uninstallation
Windows: Double-click uninstall.bat
macOS / Linux:
chmod +x uninstall && ./uninstall4.3 Quick Start
# 1. Create a working directory
mkdir my-project && cd my-project
# 2. Generate a configuration template
efg init
# 3. Open generator.yml in your editor and fill in project info, app-type, and database settings
# 4. Run full generation
efg4.4 CLI Command Reference
Basic Syntax
efg [options]
efg init [-o filename]Generation Commands
| Command | Description |
|---|---|
efg | Full generation (project skeleton + Entity + Mapper + business code + AutoConfiguration) |
efg -p | Generate project skeleton only (directory structure + build files) |
efg -m | Generate Entity + Mapper only (including Mapper XML) |
efg -s | Generate business code only (Repository / Service / API / Remote / Controller + DTO/Param, etc.) |
efg -a | Generate AutoConfiguration only |
efg -d | Refresh DTO and Param only (use after database schema changes without touching other code) |
Combining Flags
Flags can be combined:
| Command | Description |
|---|---|
efg -pm | Project skeleton + Entity + Mapper (first step when initializing a new project) |
efg -sa | Business code + AutoConfiguration (second step after adding new business tables) |
efg -pms | Project skeleton + Entity + all business code |
Other Options
| Option | Description |
|---|---|
-c <file> | Specify the configuration file path (defaults to generator.yml in the current directory) |
-h, --help | Show help information |
-V, --version | Show version number |
init Subcommand
| Command | Description |
|---|---|
efg init | Generate a generator.yml configuration template in the current directory |
efg init -o my-config.yml | Specify a custom output filename |
4.5 Typical Usage Scenarios
Scenario 1: Creating a New Project from Scratch
mkdir my-project && cd my-project
efg init # Generate configuration template
# Edit generator.yml and fill in all settings
efg # Run full generationScenario 2: Adding New Business Tables to an Existing Project
- Create the new tables in the database
- Update
generator.ymlto add the new table names todb-tables(or add new Model definitions tomodel-list) - Run step by step:
efg -m # Generate Entity + Mapper for the new tables
efg -s # Generate the corresponding business code
efg -a # Refresh AutoConfiguration (required for SMART architecture)Or in a single step:
efg # Full generation (existing files will not be overwritten)Scenario 3: Database Schema Changes (Adding/Modifying Columns)
efg -m # Regenerate Entity (overwrites existing)
efg -d # Refresh DTO and Param (overwrites existing)Other files (Service, Controller, etc.) will not be regenerated; add logic for the new fields manually in the relevant files.
Scenario 4: Managing Multiple Environments with Separate Config Files
efg -c dev-generator.yml # Development environment config
efg -c prod-generator.yml -m # Production environment, generate Model onlyScenario 5: Generating Only the Project Skeleton (No Business Code)
efg -p # Generate directory structure and build files to set up the project layout before adding business logic4.6 Complete Configuration Examples
Below are complete generator.yml configuration examples for CLI usage, covering different architectures and typical scenarios.
4.6.1 Monolithic Project (Minimal Configuration)
easyfk:
config:
generator:
project:
project-dir: D:\workspace\projects
group-id: com.example
project-name: my-app
base-package: com.example.myapp
project-type: single
app-type: BMS
code:
module-name: myapp
model-list:
- model-name: Product
model-desc: Product Info
- model-name: Order
model-desc: Order Info4.6.2 Microservice Product Layer Project (MICRO_PRD)
easyfk:
config:
generator:
project:
project-dir: D:\workspace\projects
group-id: com.example
project-name: mall-prd
base-package: com.example.mall.prd
project-type: micro_prd
rpc-type: cloud
app-type: CLIENT
framework-version: 3.5.16
code:
module-name: mallA MICRO_PRD project does not require database settings or model-list because it does not generate any business code. After generation, manually add dependencies on the microservice API modules you need to call, and write Controllers to invoke backend services remotely via RPC.
4.6.3 Microservice Project (Spring Cloud)
easyfk:
config:
generator:
project:
project-dir: D:\workspace\projects
group-id: com.example
project-name: order-service
base-package: com.example.order
project-type: microservice
rpc-type: cloud
prd-type: single
build-type: gradle
app-type: CLIENT
framework-version: 3.5.16
code:
module-name: order
author: developer
db-type: MYSQL
db-short-url: localhost:3306/order_db
db-user: root
db-pwd: 123456
db-tables: t_order,t_order_item
table-prefix: t_4.6.4 Microservice Project (Dubbo)
easyfk:
config:
generator:
project:
project-dir: D:\workspace\projects
group-id: com.example
project-name: user-service
base-package: com.example.user
project-type: microservice
rpc-type: dubbo
prd-type: separation
build-type: maven
app-type: BMS
framework-version: 3.5.16
code:
module-name: user
db-type: POSTGRE_SQL
db-short-url: localhost:5432/user_db
db-user: postgres
db-pwd: 123456
db-tables: user_info,user_address
model-list:
- model-name: UserInfo
model-desc: User Info
forbidden-filed: status
- model-name: UserAddress
model-desc: Shipping Address4.6.5 Multi-Stack Microservice Project (SMART)
easyfk:
config:
generator:
project:
project-dir: D:\workspace\projects
group-id: com.mcst
project-name: trading
base-package: com.mcst.trading
project-type: smart
prd-type: separation
build-type: gradle
gradle-type: groovy
orm-type: MYBATIS
log-type: LOGBACK
app-type: BMS
framework-version: 3.5.16
project-version: 1.0.0-SNAPSHOT
controller-auto-config: true
code:
module-name: trading
author: Dev Team
orm-type: MYBATIS
spring-annotation: true
create-controller: true
db-type: MYSQL
db-short-url: 192.168.1.100:3306/trading_db
db-user: root
db-pwd: secure_password
table-prefix: t_
db-tables: t_product,t_order,t_order_item,t_payment
model-list:
- model-name: Product
model-desc: Product
- model-name: Order
model-desc: Order
- model-name: OrderItem
model-desc: Order Item
only-repository: true
- model-name: Payment
model-desc: Payment Record
create-controller: false4.6.6 Auto-Parsing Table Schemas from a Database
easyfk:
config:
generator:
project:
project-dir: D:\workspace\projects
group-id: com.example
project-name: my-app
base-package: com.example.myapp
project-type: single
app-type: BMS
code:
module-name: myapp
db-type: MYSQL
db-short-url: localhost:3306/my_database
db-user: root
db-pwd: 123456
table-prefix: base_
db-tables: base_product,base_category,base_brandHow it works:
- The generator connects to the database via JDBC
- Uses
DatabaseMetaDatato retrieve table schemas (column names, types, comments, primary keys, etc.) - Automatically strips ignored prefixes based on
table-prefix(e.g., when configured withbase_,auth_,base_product→Product) - Converts snake_case column names to camelCase (
product_name→productName) - Maps database column types to Java types according to the type mapping rules
- Reads column comments as descriptions for
@Schemaand@Column
4.6.7 Configuration with Resource Permission Annotations
easyfk:
config:
generator:
project:
project-dir: D:\workspace\projects
group-id: com.mcst
project-name: user
base-package: com.mcst.user
project-type: smart
prd-type: separation
build-type: gradle
app-type: BMS
code:
module-name: user
db-short-url: localhost:3306/user_db
db-pwd: 123456
create-resource-annotation: true
resource-group: userManagement
resource-id: userManagement
resource-name: User Management
resource-path: /user
resource-sort: 80000
module-resource-sort: 10000
increment-star: 100
model-list:
- model-name: UserInfo
model-desc: Member
- model-name: UserAddress
model-desc: Shipping Address
- model-name: UserAccount
model-desc: AccountAutomatic Sort Order Calculation:
- UserInfo:
modelResourceSort = 10000 + 100 = 10100 - UserAddress:
modelResourceSort = 10000 + 200 = 10200 - UserAccount:
modelResourceSort = 10000 + 300 = 10300
5. General Configuration Reference
5.1 Configuration File Structure
Whether using the CLI's generator.yml or the IntelliJ IDEA plugin's visual configuration, the underlying configuration structure is identical and resides under the easyfk.config.generator node:
easyfk:
config:
generator:
project: # Project configuration
...
code: # Code configuration
...The IntelliJ IDEA plugin's visual configuration is automatically saved as a generator.yml file, sharing the same YAML configuration as the CLI.
5.2 Project Configuration (project)
Configuration prefix: easyfk.config.generator.project
| Property | Required | Type | Default | Description |
|---|---|---|---|---|
project-dir | Yes | String | - | Root output directory for the project. The generated project creates a folder named after project-name inside this directory. Example: D:\workspace\projects or /home/user/projects |
group-id | Yes | String | - | Maven groupId, e.g., com.example |
project-name | Yes | String | - | Project name, used both as the project root directory name and as the prefix for all submodules. Example: my-app |
base-package | Yes | String | - | Root Java package path; all generated code is organized under this package. Example: com.example.myapp |
project-type | No | Enum | smart | Project architecture type, which determines the generated project structure and code layers. See details below |
rpc-type | No | Enum | cloud | RPC framework type; applies when project-type: microservice or micro_prd (required for MICRO_PRD). Options: cloud (Spring Cloud Feign), dubbo (Apache Dubbo) |
build-type | No | Enum | maven | Build tool type. maven → generates pom.xml; gradle → generates build.gradle |
gradle-type | No | Enum | groovy | Gradle DSL type; only applies when build-type: gradle. groovy → build.gradle; kotlin → build.gradle.kts |
orm-type | No | Enum | MYBATIS | ORM framework type: MYBATIS (MyBatis-Plus), MYBATIS_FLEX (MyBatis-Flex), HIBERNATE |
prd-type | No | Enum | none | PRD / Controller layer strategy. none — do not generate; single — single PRD project; separation — separated (client + bms) |
log-type | No | Enum | LOGBACK | Logging framework type: LOGBACK or LOG4J2 |
framework-version | No | String | 3.5.16 | EasyFK framework version written into the build file dependencies |
project-version | No | String | 1.0.0-SNAPSHOT | Version of the generated project |
app-type | Yes | Enum | - | Application type, which determines the generated project template and configuration style. Options: BMS (Admin / Back-office), CLIENT (Customer-facing / ToC) |
create-prd-project | No | Boolean | true | Whether to generate the PRD (Controller) subproject. Setting to false skips generating any Controller-related modules |
controller-auto-config | No | Boolean | false | Whether to generate Spring Boot AutoConfiguration for the Controller layer |
project-type Details:
| Value | Description |
|---|---|
single | Monolithic project: all code resides in a single project with no submodule split |
micro_prd | Microservice product-layer project: generates only the bootstrap class and configuration files, invoking backend microservices via RPC with no ORM/DB/business code |
microservice | Standard microservice architecture: generates API + Server + PRD modules with a single chosen RPC protocol (Cloud or Dubbo) |
smart | Multi-stack microservice architecture: extends microservice by generating both Spring Cloud and Dubbo RPC channels simultaneously |
5.3 Code Configuration (code)
Configuration prefix: easyfk.config.generator.code
Basic Configuration
| Property | Required | Type | Default | Description |
|---|---|---|---|---|
module-name | Yes | String | - | Module name, used to generate configuration class names (e.g., MyappServerConfig), remote call serviceId, Controller path prefixes, etc. Example: myapp |
author | No | String | eb-jack | Author name included in generated code comments |
orm-type | No | Enum | MYBATIS | ORM type. Options: MYBATIS, MYBATIS_FLEX, HIBERNATE |
spring-annotation | No | Boolean | true | Whether to add Spring annotations (such as @Repository, @Service) on generated implementation classes. Ignored when project-type is smart (annotations are omitted in favor of AutoConfiguration) |
create-controller | No | Boolean | true | Whether to generate Controller layer code (global setting, overridable at the Model level) |
extends-supper-class | No | Boolean | true | Whether Entity classes extend the framework base class, which provides common fields deleted, insertTime, and lastUpdateTime |
Database Connection Configuration
| Property | Required | Type | Default | Description |
|---|---|---|---|---|
db-type | No | Enum | MYSQL | Database type. See 8.1 Supported Databases for the full list of supported values |
db-short-url | Conditional | String | - | Short database connection URL in host:port/database format, e.g., localhost:3306/my_db. Required only when using db-tables |
db-user | No | String | root | Database username |
db-pwd | Conditional | String | - | Database password. Required only when using db-tables |
Connection String Format: For db-short-url, you only need to provide the host:port/database portion; the generator automatically constructs the full JDBC URL. For example, MySQL is automatically assembled into jdbc:mysql://host:port/database?characterEncoding=UTF-8&useSSL=false&...
Table Configuration
| Property | Required | Type | Default | Description |
|---|---|---|---|---|
table-prefix | No | String | - | Global ignored table prefixes; supports multiple comma-separated prefixes. Example: with base_,auth_, table base_product → class Product, table auth_role → class Role |
db-tables | No | String | - | Comma-separated list of database table names whose schemas should be read from the database, e.g., product,order,user_info. When configured, the generator connects to the database automatically to parse column metadata |
5.4 Model Definition Configuration
Models are defined as a list under code.model-list. Each Model corresponds to a database table and a complete set of generated layered code.
code:
model-list:
- model-name: Product
model-desc: Product Info
# ... more configuration
- model-name: Order
model-desc: Order InfoModel Configuration Properties
| Property | Required | Type | Default | Description |
|---|---|---|---|---|
model-name | Yes | String | - | Model name in PascalCase. Used as the prefix for all generated class names. Example: Product → ProductDto, ProductReq, IProductService, etc. |
model-desc | No | String | - | Human-readable model description, used in code comments, Swagger documentation, etc. Example: Product Info |
table-name | No | String | Auto-derived | Corresponding database table name. If omitted, automatically derived from model-name (PascalCase to snake_case + primary prefix). Example: Product + prefix base_ → base_product. If multiple global prefixes are configured, the first prefix is used by default |
id-type | No | String | String | Java type of the primary key field. Options: String (default, UUID strategy), Long (for auto-increment primary keys) |
id-is-auto | No | Boolean | false | Whether the primary key is auto-incremented. true → @TableId(type = IdType.AUTO); false → @TableId(type = IdType.ASSIGN_UUID) |
super-class | No | String | com.mcst.easyfk.service.mybatisplus.persistence.BaseMyBatisPlusEntity | Fully qualified class name of the Entity superclass. The framework base class provides deleted, insertTime, and lastUpdateTime. Set to BaseMyBatisPlusSimpleEntity to use the minimal base class |
only-repository | No | Boolean | false | Whether to generate only the Repository layer. When true, generates only Entity + Mapper + Repository + DTO, skipping Service / API / Controller / Remote |
create-controller | No | Boolean | true | Whether to generate a Controller for this Model. Takes precedence over the global code.create-controller setting |
table-prefix | No | String | Inherit global | Model-specific ignored table prefixes (comma-separated). Takes precedence over the global code.table-prefix setting |
forbidden-filed | No | String | - | Disable/status field name (e.g., forbidden, status). When set, the Controller layer automatically generates enable/disable endpoints |
resource-group | No | String | Inherit global | Resource permission group for this Model (overrides global config) |
resource-name | No | String | Inherit global | Resource permission display name for this Model (overrides global config) |
resource-id | No | String | Inherit global | Resource permission ID for this Model (overrides global config) |
resource-path | No | String | Inherit global | Frontend route path for this Model's resource permission (overrides global config) |
resource-sort | No | Integer | Inherit global | Resource group sort order value |
model-resource-sort | No | Integer | Auto-calculated | Resource sort order value for this Model (automatically incremented by increment-star) |
Relationship between db-tables and model-list: Both can be used together. db-tables first reads table schemas from the database to build base Model definitions, and model-list overrides those base models by matching table-name first and model-name second; unmatched model-list entries are appended as standalone manually defined models.
5.5 Resource Permission Configuration
Used to automatically generate EasyFK framework resource permission annotations (@ResourceController, @AuthResource) on Controller endpoints to integrate with the framework's authorization system.
Configuration prefix: easyfk.config.generator.code
| Property | Required | Type | Default | Description |
|---|---|---|---|---|
create-resource-annotation | No | Boolean | false | Master switch: whether to generate resource permission annotations. Set to true to generate @ResourceController and @AuthResource on Controllers |
resource-group | No | String | - | Resource group identifier |
resource-name | No | String | - | Display name of the resource group |
resource-id | No | String | - | Resource group ID |
resource-path | No | String | - | Frontend route path corresponding to the resource group |
resource-sort | No | Integer | 10000 | Base sort order value for the resource group |
module-resource-sort | No | Integer | 10000 | Starting sort order value for individual Model resources |
increment-star | No | Integer | 100 | Increment step between sort order values of multiple Models |
Example Controller annotations generated when enabled:
@ResourceController(group = "operationSetting", id = "operationSetting",
name = "Operations Management", sort = 81000, path = "/operation")
public class ProductController {
@AuthResource(id = "productManage", name = "Product Management",
pId = "operationSetting", pName = "Operations Management",
sort = 10100, path = "/operation/product",
category = ResourceCategory.menu)
public ResponseResult<List<ProductResp>> queryPage(...) { ... }
}6. Project Architecture Types
EasyFK Generator comes with four built-in project architectures, covering scenarios from small tools to large-scale platforms.
6.1 SINGLE Monolithic Architecture
Use Cases: Small-to-medium projects, rapid prototyping, internal tools
Configuration: project-type: single
Generated Project Structure:
my-app/
├── pom.xml (or build.gradle)
├── src/main/java/com/example/myapp/
│ ├── ServerApp.java # Application entry point
│ ├── controller/
│ │ └── ProductController.java # Controller (calls Service directly)
│ ├── api/
│ │ ├── dto/ProductDto.java # DTO
│ │ ├── param/ProductParam.java # Query parameters
│ │ ├── request/
│ │ │ ├── ProductReq.java # Request object
│ │ │ └── ProductEditReq.java # Edit request object
│ │ └── response/ProductResp.java # Response object
│ └── service/
│ ├── IProductService.java # Service interface
│ ├── impl/ProductServiceImpl.java # Service implementation
│ ├── persistence/
│ │ ├── model/Product.java # Entity
│ │ └── mapper/ProductMapper.java # Mapper interface
│ └── repository/
│ ├── IProductRepository.java # Repository interface
│ └── impl/ProductRepositoryImpl.java # Repository implementation
├── src/main/resources/
│ └── mappings/ProductMapper.xml # Mapper XML
└── config/
├── application.yml
├── application-dev.yml
├── application-test.yml
├── application-prod.yml
└── logback.xml (or log4j2.xml)Key Characteristics:
- All code lives in a single project
- Controller depends directly on the Service layer with no Remote/API intermediary layer
- Package path uses
{basePackage}.serviceinstead of{basePackage}.server - Service API/DTO package path uses
{basePackage}.api
6.2 MICRO_PRD Microservice Product-Layer Architecture
Use Cases: BMS admin portals and ToC API gateway projects that only expose REST APIs with no local business logic, fetching data by invoking backend microservices over RPC
Configuration: project-type: micro_prd, rpc-type: cloud or dubbo (required)
Generated Project Structure:
my-app/
├── pom.xml (or build.gradle + settings.gradle)
├── src/main/java/com/example/myapp/
│ └── MyappPrdApp.java # Application entry point (with RPC annotations)
└── config/
├── application.yml
├── application-dev.yml
├── application-test.yml
├── application-prod.yml
└── logback.xml (or log4j2.xml)Key Characteristics:
- Flat single-module structure similar to SINGLE, but with completely different dependencies
- RPC required: Must select either
CLOUDorDUBBOas the remote invocation protocol - No ORM/DB: Contains no database-related dependencies
- No business code: Does not generate Entity, Mapper, Repository, Service, DTO, Param, Controller, etc.
- Skeleton only: Generates only the bootstrap class, configuration files, and logging configuration
- At runtime, imports business modules' API projects (such as
xxx-cloud-apiorxxx-dubbo-api) to make RPC calls - Includes dependencies such as
web-prd,doc-knife4j,registry-nacos, andrpc-${rpcType} - Optionally includes
auth-prd(for BMS) andauth-${rpcType}-api(RPC interface for the authentication module)
Typical Workflow:
- Generate the project skeleton and base configuration using
MICRO_PRD - Manually add dependencies for the required microservice API modules in
pom.xml/build.gradle - Manually write Controllers and inject each microservice's Remote/API interface for remote calls
- Configure the Nacos registry address and start the application
6.3 MICROSERVICE Architecture
Use Cases: Standard microservice decomposition using a single RPC protocol (Spring Cloud or Dubbo)
Configuration: project-type: microservice, rpc-type: cloud or dubbo
Generated Project Structure (Spring Cloud Example):
my-app/
├── pom.xml (or build.gradle + settings.gradle) # Parent project
│
├── my-app-api/ # API definition module
│ ├── pom.xml
│ └── src/main/java/com/example/myapp/api/
│ ├── IProductApi.java # API interface (generated only for SMART architecture)
│ ├── dto/ProductDto.java
│ ├── param/ProductParam.java
│ ├── request/
│ │ ├── ProductReq.java
│ │ └── ProductEditReq.java
│ └── response/ProductResp.java
│
├── my-app-server/ # Service implementation module
│ ├── pom.xml
│ ├── src/main/java/com/example/myapp/
│ │ ├── ServerApp.java # Application entry point
│ │ └── server/
│ │ ├── persistence/model/Product.java
│ │ ├── persistence/mapper/ProductMapper.java
│ │ ├── repository/
│ │ │ ├── IProductRepository.java
│ │ │ └── impl/ProductRepositoryImpl.java
│ │ ├── service/
│ │ │ ├── IProductService.java
│ │ │ └── impl/ProductServiceImpl.java
│ │ └── impl/
│ │ └── ProductRemoteImpl.java # RPC implementation (Cloud or Dubbo)
│ ├── src/main/resources/mappings/ProductMapper.xml
│ └── config/
│ ├── application.yml / -dev.yml / -test.yml / -prod.yml
│ └── logback.xml
│
└── my-app-prd/ # PRD layer (Controller)
├── pom.xml
└── src/main/java/com/example/myapp/
├── ClientApp.java # Application entry point
└── controller/
└── ProductController.java # Controller (calls Server via Remote)When prd-type: separation is configured, the PRD layer is split into two independent projects (siblings of server):
my-app/
├── ...
├── my-app-prd-client/ # ToC / Client-side Controller
│ ├── ClientApp.java
│ └── controller/ProductController.java
└── my-app-prd-bms/ # ToB / Admin BMS Controller
├── BmsApp.java
└── controller/ProductBmsController.java6.4 SMART Multi-Stack Microservice Architecture
Use Cases: Large-scale platform projects that need to support both Spring Cloud and Dubbo RPC protocols simultaneously
Configuration: project-type: smart
Generated Project Structure:
my-app/
├── pom.xml
│
├── my-app-api/ # API definition module
│ └── com/example/myapp/api/
│ ├── IProductApi.java # Unified API interface
│ ├── dto/ProductDto.java
│ ├── param/ProductParam.java
│ ├── request/ProductReq.java / ProductEditReq.java
│ └── response/ProductResp.java
│
├── my-app-server/ # Service implementation module
│ └── com/example/myapp/server/
│ ├── persistence/model/Product.java
│ ├── persistence/mapper/ProductMapper.java
│ ├── repository/IProductRepository.java + impl/
│ ├── service/IProductService.java + impl/
│ ├── impl/ProductApiServerImpl.java # Server-side API implementation
│ └── config/MyappServerConfig.java # AutoConfiguration class
│
├── my-app-remote/ # Remote invocation module (parent project)
│ │
│ ├── my-app-cloud-api/ # Spring Cloud client
│ │ └── com/example/myapp/remote/
│ │ ├── IProductRemote.java # Feign interface
│ │ ├── impl/ProductApiScImpl.java # Spring Cloud API implementation
│ │ ├── properties/MyappApiProperties.java # Configuration properties
│ │ └── config/MyappApiConfig.java # AutoConfiguration
│ │
│ ├── my-app-cloud-provider/ # Spring Cloud service provider
│ │ └── com/example/myapp/remote/provider/
│ │ └── impl/ProductRemoteImpl.java # Remote implementation
│ │
│ ├── my-app-dubbo-api/ # Dubbo client
│ │ └── com/example/myapp/remote/
│ │ ├── IProductRemote.java # Dubbo interface
│ │ └── impl/ProductApiDubboImpl.java # Dubbo implementation of API
│ │
│ └── my-app-dubbo-provider/ # Dubbo service provider
│ └── com/example/myapp/remote/provider/
│ └── impl/ProductRemoteImpl.java
│
├── my-app-prd-client/ # PRD / Controller layer (Client)
│ └── controller/ProductController.java
│
└── my-app-prd-bms/ # PRD / Controller layer (BMS)
└── controller/ProductBmsController.javaKey Highlights of the SMART Architecture:
- Defines a unified
IProductApiinterface - The Server module implements
ProductApiServerImpl(local direct Service call) - The Cloud API module implements
ProductApiScImpl(remote call via Feign) - The Dubbo API module implements
ProductApiDubboImpl(remote call via Dubbo) - The Controller layer depends only on the API interface; Spring Boot AutoConfiguration injects the active implementation at runtime
- Switching transport modes only requires swapping a dependency—zero business code edits
6.5 Flexible Architecture Composition
The four built-in architectures are not rigid templates—they are composed from multiple configuration dimensions that determine the final generated project layout. Teams can combine these dimensions freely to match their business requirements.
Project Structure Dimension
Combine project-type + prd-type to generate tailored sub-module layouts:
| project-type | prd-type | Generated Sub-Modules |
|---|---|---|
single | (N/A) | Single project containing all code |
micro_prd | (N/A) | Single project with entry class + config files only (no business code) |
microservice | none | api + server (no Controller project) |
microservice | single | api + server + prd |
microservice | separation | api + server + prd-client + prd-bms |
smart | none | api + server + remote (including 4 cloud/dubbo sub-modules) |
smart | single | api + server + remote + prd |
smart | separation | api + server + remote + prd-client + prd-bms |
Example: For a pure backend API service without a Controller layer, use microservice + prd-type: none.
Build Tool Dimension
Select the build tool via build-type:
| build-type | Generated Build Files |
|---|---|
maven | pom.xml |
gradle + gradle-type: groovy (default) | build.gradle + settings.gradle |
gradle + gradle-type: kotlin | build.gradle.kts + settings.gradle.kts |
Tech Stack Dimension
These options control technical dependencies and generated code style:
| Option | Scope of Impact |
|---|---|
orm-type | Persistence dependencies and Entity annotations: MyBatis-Plus (default) → @TableName + BaseMapper; MyBatis-Flex → Flex annotations; Hibernate → JPA annotations |
rpc-type | Active in MICROSERVICE and MICRO_PRD (required for MICRO_PRD); determines RPC transport and dependencies |
log-type | Logging config file: logback.xml or log4j2.xml |
db-type | Database driver dependency in build files (e.g., MySQL / PostgreSQL) and JDBC URL format |
include-auth | Whether to include EasyFK's auth permission module dependency in build files |
Code Layer Trimming Dimension
Fine-tune which layers are generated per Model during code generation:
| Option | Scope | Description |
|---|---|---|
only-repository | Model-level | When true, generates only Entity + Mapper + Repository + DTO (skips Service / API / Controller / Remote) |
create-controller | Global / Model-level | Controls Controller layer generation; Model-level overrides global |
controller-auto-config | Global | In SMART architecture, generates extra Spring Boot AutoConfiguration for the Controller layer |
Typical Customization Scenarios
Scenario 1: Backend-Only Microservice (No Controller)
Ideal for internal RPC services that do not expose HTTP endpoints:
project-type: microservice
rpc-type: cloud
prd-type: none # Skip PRD (Controller) sub-moduleScenario 2: SMART Architecture + Data-Layer-Only Models
Ideal when certain tables (e.g., line items or join tables) do not need standalone APIs:
project-type: smart
prd-type: separation
code:
model-list:
- model-name: Order
model-desc: Order
- model-name: OrderItem
model-desc: Order Item
only-repository: true # Data access layer only
- model-name: Payment
model-desc: Payment Record
create-controller: false # Generate Service, skip ControllerScenario 3: Monolith with Gradle + MyBatis-Flex
project-type: single
build-type: gradle
orm-type: MYBATIS_FLEX
app-type: BMSSummary: The four built-in architectures are recommended starting points. Combining project-type, prd-type, build-type, orm-type, and rpc-type with Model-level only-repository and create-controller lets you tailor the exact structure and layers for any business scenario.
7. Generated Code Walkthrough
The following sections use a Model named Product in a module named myapp to illustrate each generated layer.
7.1 Entity Class
File: Product.java
Location: {server}/persistence/model/
The generated Entity varies slightly depending on orm-type:
MyBatis (default):
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("product")
@AutoMapper(target = ProductDto.class)
public class Product extends BaseMyBatisPlusEntity<Product> {
@PrimaryKey
@TableId(type = IdType.ASSIGN_UUID) // or IdType.AUTO (when id-is-auto: true)
@EntityColumn(comment = "Product ID")
private String productId;
@EntityColumn(comment = "Product name")
private String productName;
@EntityColumn(comment = "Product price")
private BigDecimal price;
}Highlights:
- Uses
@AutoMapperfor automatic Entity-to-DTO mapping (powered by MapStruct-Plus) - Uses
@EntityColumn(comment = "...")to record column comments - Uses
@PrimaryKeyto mark the primary key field - Extends the framework base class to inherit
deleted,insertTime, andlastUpdateTimeautomatically
7.2 Mapper Interface and XML
Mapper Interface: ProductMapper.java
public interface ProductMapper extends BaseMapper<Product> {
}Mapper XML: ProductMapper.xml
- Located under
resources/mappings/ - Initially generated as an empty XML skeleton ready for custom SQL queries
7.3 DTO (Data Transfer Object)
File: ProductDto.java
Location: {api}/dto/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@Schema(description = "Product data object")
@SuperBuilder
@NoArgsConstructor
public class ProductDto extends BaseDto {
@PrimaryKey
@Schema(description = "Product ID")
private String productId;
@Schema(description = "Product name")
private String productName;
@Schema(description = "Product price")
private BigDecimal price;
}Highlights:
- Extends
BaseDto - Annotates every field with
@Schemafor Swagger / OpenAPI documentation - Supports
@SingleUniqueFieldand@CombUniqueFieldannotations (parsed from the Entity) - DTO files use the force-refresh policy and are regenerated on every run to stay in sync with the table schema
7.4 Param (Query Parameter Object)
File: ProductParam.java
Location: {api}/param/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@Schema(description = "Product query parameter object")
@SuperBuilder
@NoArgsConstructor
public class ProductParam extends BasicParam {
@Schema(description = "Product name")
private String productName;
@Schema(description = "Product price")
private BigDecimal price;
// When a field is annotated with @BetweenConditionField, range query fields are generated automatically:
// @Schema(description = "Creation time start")
// private LocalDateTime createTimeStart;
// @Schema(description = "Creation time end")
// private LocalDateTime createTimeEnd;
}Highlights:
- Extends
BasicParam(which includes common query parameters such as pagination and sorting) - Fields annotated with
@BetweenConditionFieldautomatically generatexxxStartandxxxEndrange query fields - Param files use the force-refresh policy
7.5 Req (Request Object)
File: ProductReq.java
Location: {api}/request/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@Schema(description = "Product request object")
@SuperBuilder
@NoArgsConstructor
public class ProductReq extends ProductParam {
}Extends ProductParam and serves as the input parameter type for Service / API layer methods. Generated as an empty class initially so you can add request-specific fields as needed.
7.6 Resp (Response Object)
File: ProductResp.java
Location: {api}/response/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@Schema(description = "Product response object")
@SuperBuilder
@NoArgsConstructor
public class ProductResp extends ProductDto {
}Extends ProductDto and serves as the return type for Service / API layer methods. Generated as an empty class initially so you can add response-specific fields (such as computed fields or joined data) as needed.
7.7 EditReq (Edit Request Object)
File: ProductEditReq.java
Location: {api}/request/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@Schema(description = "Product edit request object")
@SuperBuilder
@NoArgsConstructor
public class ProductEditReq extends ProductDto {
}Extends ProductDto and serves as the input parameter for Controller create/update endpoints.
7.8 Repository Layer
Interface: IProductRepository.java
public interface IProductRepository extends IBaseRepository<ProductDto, String> {
}Implementation: ProductRepositoryImpl.java
@Repository // Generated when spring-annotation: true
public class ProductRepositoryImpl
extends BaseMyBatisRepositoryImpl<ProductMapper, ProductDto, Product, String>
implements IProductRepository {
}The Repository layer encapsulates data access logic and inherits standard CRUD operations from the framework base class.
7.9 Service Layer
Interface: IProductService.java
public interface IProductService extends IBaseService<ProductResp, String, ProductReq> {
}Implementation: ProductServiceImpl.java
The Service layer comes with a complete set of CRUD methods generated out of the box:
| Method | Description |
|---|---|
queryById(id) | Query a single record by ID |
queryOneByField(field, value) | Query a single record by a single field |
queryList(searchRequest) | Query a list of records by conditions |
queryOne(searchRequest) | Query a single record by conditions |
count(searchRequest) | Count records matching conditions |
exists(searchRequest) | Check whether any matching record exists |
queryByPage(searchRequest) | Paginated query |
save(modifyRequest) | Insert or update |
delete(modifyRequest) | Delete |
insertAndReturnId(req) | Insert and return the primary key |
7.10 API Interface Layer
Generated only in the SMART architecture.
File: IProductApi.java
public interface IProductApi extends IBaseApi<ProductResp, String, ProductReq> {
}The API interface is the core abstraction of the SMART architecture, defining a unified business operation contract. Three implementations invoke the Service layer in different ways:
ProductApiServerImpl: Direct local Service invocationProductApiScImpl: Remote invocation via Spring Cloud FeignProductApiDubboImpl: Remote invocation via Dubbo
7.11 Controller Layer
The Controller layer adapts its generated code style based on the combination of project-type and prd-type:
| project-type | prd-type | Generated Controller |
|---|---|---|
| single | single | Injects IProductService directly for local calls |
| microservice + cloud | single | Injects the Remote interface (Feign) for remote calls |
| microservice + dubbo | single | Injects the Remote interface (Dubbo) for remote calls |
| smart | single | Injects IProductApi, with the concrete implementation wired by auto-configuration |
| Any | separation | Generates both ProductController (client-facing) and ProductBmsController (back-office) |
Standard Controller endpoints generated:
| Endpoint | HTTP Method | Path | Description |
|---|---|---|---|
| Detail query | GET | /api/{module}/{model}/detail | Query record details by ID |
| Paginated query | GET | /api/{module}/{model}/queryPage | Paginated conditional query |
| Create / Edit | POST | /api/{module}/{model}/addOrEdit | Create or update a record |
| Batch delete | POST | /api/{module}/{model}/delete | Batch delete by list of IDs |
| Enable / Disable | POST | /api/{module}/{model}/disable | Generated only when the Model configures forbidden-filed |
7.12 Spring Cloud Remote Layer
Generated in MICROSERVICE (rpc-type: cloud) and SMART architectures.
Feign Interface: IProductRemote.java
@FeignClient(value = "${easyfk.config.remote.myapp.service-id:server}",
path = "${easyfk.config.remote.myapp.base-path:/remote}/myapp/product")
public interface IProductRemote extends IBaseRemote<ProductResp, String, ProductReq> {
}Implementation: ProductRemoteImpl.java — Implements the Remote interface on the Server / Provider side, receiving remote calls and delegating them to the Service layer.
7.13 Dubbo Remote Layer
Generated in MICROSERVICE (rpc-type: dubbo) and SMART architectures.
Interface: IProductRemote.java
public interface IProductRemote extends IDubboBaseRemote<ProductResp, String, ProductReq> {
}Implementation: ProductRemoteImpl.java — Dubbo service provider implementation.
7.14 AutoConfiguration
Primarily used in SMART architecture and in microservice architectures with controller-auto-config enabled.
The generator automatically creates Spring Boot AutoConfiguration classes for the following modules:
- Server Module:
{Module}ServerConfig.java+AutoConfiguration.imports- Automatically registers Service, Repository, API implementation, and related beans
- Remote Cloud API Module:
{Module}ApiConfig.java+AutoConfiguration.imports- Automatically registers Feign client beans
- Remote Cloud Provider Module:
{Module}ProviderConfig.java+AutoConfiguration.imports- Automatically registers Remote implementation beans
- Remote Dubbo API/Provider Modules: Same structure as above for Dubbo
- PRD Controller Module (when
controller-auto-config: true):{Module}ControllerConfig.java/{Module}ClientControllerConfig.java/{Module}BmsControllerConfig.java
7.15 Application Entry Points & Configuration Files
For non-SINGLE architectures, the Server and PRD modules each generate:
- Application entry points:
ServerApp.java,ClientApp.java,BmsApp.java - Configuration files:
application.yml— Base configurationapplication-dev.yml— Development environmentapplication-test.yml— Testing environmentapplication-prod.yml— Production environment
- Logging configuration:
logback.xmlorlog4j2.xml(based onlog-type)
8. Database Support & Type Mapping
8.1 Supported Databases
Database Type (db-type value) | Description |
|---|---|
MYSQL | MySQL (default) |
MARIADB | MariaDB |
POSTGRE_SQL | PostgreSQL |
ORACLE | Oracle 11g and earlier |
ORACLE_12C | Oracle 12c+ |
SQL_SERVER | SQL Server |
SQL_SERVER2005 | SQL Server 2005 |
DB2 | IBM DB2 |
H2 | H2 embedded database |
HSQL | HSQLDB |
SQLITE | SQLite |
DM | Dameng Database (DM) |
KINGBASE_ES | KingbaseES |
GAUSS | GaussDB |
OCEAN_BASE | OceanBase |
CLICK_HOUSE | ClickHouse |
GBASE | GBase |
OSCAR | ShenTong (Oscar) Database |
XU_GU | XuGu Database |
PHOENIX | Apache Phoenix (HBase) |
FIREBIRD | Firebird |
SYBASE | Sybase ASE |
OTHER | Other databases |
8.2 Column Type Mapping Rules
When reading table schemas from a database, column types are automatically mapped to Java types according to the following rules:
| Database Column Type | Java Type |
|---|---|
DATETIME, TIMESTAMP, TIMESTAMPTZ, TIMESTAMP WITH TIME ZONE | LocalDateTime |
DATE | LocalDate |
TIME | LocalTime |
DECIMAL, NUMERIC | BigDecimal |
TINYINT, BOOLEAN, BOOL, BIT | Boolean |
INT, INT4, INTEGER, SMALLINT, INT2, SERIAL, SMALLSERIAL | Integer |
BIGINT, NUMBER, BIGSERIAL, IDENTITY, INT8 | Long |
REAL, FLOAT4 | Float |
DOUBLE, DOUBLE PRECISION, FLOAT, FLOAT8 | Double |
BYTEA, BLOB, VARBINARY, BINARY | byte[] |
UUID | UUID |
VARCHAR, CHAR, TEXT, CLOB, and others | String |
Note: The framework base class already includes deleted, insertTime, and lastUpdateTime. These three fields are automatically excluded when reading from the database and will not be duplicated.
9. Custom Entity Annotations
You can manually add the following custom annotations provided by the EasyFK framework to generated Entity files. When you re-run code generation (efg -s or efg -d), the generator automatically parses these annotations and produces the corresponding logic in the DTO, Param, and Controller layers.
@SingleUniqueField — Single-Field Uniqueness Validation
@SingleUniqueField(repetitionMsg = "Product name already exists")
@EntityColumn(comment = "Product name")
private String productName;Effect: The generated DTO includes the @SingleUniqueField annotation, and the framework automatically enforces uniqueness during save operations.
@CombUniqueField — Composite Uniqueness Validation
@CombUniqueField(repetitionMsg = "A product with this name already exists in the category", combinationField = "categoryId")
@EntityColumn(comment = "Product name")
private String productName;Effect: Enforces composite uniqueness on productName + categoryId, returning the configured message if a duplicate is found.
@BetweenConditionField — Range Query Field
@BetweenConditionField
@EntityColumn(comment = "Creation time")
private LocalDateTime createTime;Effect: Automatically generates two additional range query fields, createTimeStart and createTimeEnd, in the generated Param class.
@ForbiddenField — Enable/Disable Field
@ForbiddenField(value = "forbidden")This annotation is placed at the Entity class level (not field level) to indicate that the Model supports enable/disable state toggling.
Effect: Generates an additional disable endpoint (enable/disable) in the Controller layer that toggles the specified field's value.
10. File Overwrite Policies
The generator uses two file-creation policies to protect developers' manual modifications:
| Policy | Affected Files | Behavior |
|---|---|---|
Create only if absent (createOnNotExistFile) | Mapper interfaces, Mapper XML, Repository, Service, API, Controller, Remote, Req, Resp, EditReq, entry-point classes, configuration files | If the file already exists, it is skipped and never overwritten |
Delete and recreate (delAndCreateFile) | Entity, DTO, Param, AutoConfiguration classes | Deletes the old file and regenerates it on every run to stay in sync with the database schema |
Practical implications:
- Safe to edit manually: Service implementations, Repository implementations, Controllers, Mapper XML, etc. Once generated, these files are never overwritten, so you can freely add custom business logic.
- Refreshed on regeneration (manual edits not recommended): Entity, DTO, and Param files. These are regenerated as the table schema evolves. If you need custom fields in these classes, add them to the Entity and run
efg -dto refresh DTO/Param. - AutoConfiguration files: Rebuilt every time
efg -aorefgruns, because the generator scans all existing implementation classes to produce a complete configuration.
11. Frequently Asked Questions (FAQ)
Q1: "java not found" error
Install JDK 21 or later: https://adoptium.net/
After installation, verify that java -version reports version >= 21.
Q2: Will generated code overwrite my manual edits?
No (in most cases). See File Overwrite Policies:
- Never overwritten: Mapper interfaces, Mapper XML, Repository, Service, API, Controller, Remote, Req, Resp, EditReq, entry-point classes, configuration files
- Overwritten on regeneration: Entity, DTO, Param, AutoConfiguration classes
Q3: What is the difference between db-tables and model-list?
| Feature | db-tables | model-list |
|---|---|---|
| Field metadata source | Automatically read from the database | Manually defined (does not auto-read fields) |
| Database connection required | Yes | No |
| Field types / comments | Automatically parsed | Cannot define fields (Model-level config only) |
| Best suited for | Tables already exist in the database | Design phase, offline environments, or standalone manually declared Models |
Both can be used together. They are merged into a single Model list: db-tables generates the base models, model-list overrides matching base models by table-name first and model-name second, and any unmatched entries are appended as standalone manual models.
Q4: Which databases are supported?
22 databases are supported. See the full list in 8.1 Supported Databases.
Q5: Is the config file format the same as Spring Boot's application.yml?
Identical. The CLI's generator.yml and Spring Boot's application.yml use the exact same configuration node structure. If you already have generator settings in a Spring Boot project, you can copy them directly into generator.yml.
Q6: How do I generate Controllers for only some Models?
Set create-controller: false for specific Models in model-list:
model-list:
- model-name: OrderItem
model-desc: Order Item
create-controller: false # Do not generate a Controller for this ModelQ7: How do I generate only the Repository layer (without Service / Controller)?
Set only-repository: true in model-list:
model-list:
- model-name: UserAddress
model-desc: User Address
only-repository: true # Generate only Entity + Mapper + Repository + DTOQ8: What is the difference between BaseMyBatisPlusEntity and BaseMyBatisPlusSimpleEntity as the Entity superclass?
| Superclass | Included Common Fields |
|---|---|
BaseMyBatisPlusEntity (default) | deleted, insertTime, lastUpdateTime |
BaseMyBatisPlusSimpleEntity | None (suitable for simple tables such as join tables) |
Switch between them via super-class in model-list:
model-list:
- model-name: UserRole
super-class: BaseMyBatisPlusSimpleEntityQ9: How are table names mapped to class names?
The generator applies the following rules automatically:
- Strips configured prefixes from
table-prefix(e.g. withbase_,auth_,base_product→product) - Converts snake_case to camelCase (
product_info→productInfo) - Capitalizes the first letter (
productInfo→ProductInfo)
You can also specify the table name explicitly via table-name in model-list:
model-list:
- model-name: ProductInfo # Class name
table-name: t_prd_info # Explicit table name; skips automatic derivationQ10: How do I switch the RPC invocation mode in SMART architecture?
The SMART architecture generates both Spring Cloud and Dubbo implementations side by side. To switch RPC modes, simply change which dependency module is included at runtime:
- Include
xxx-cloud-api→ Remote invocation via Spring Cloud Feign - Include
xxx-dubbo-api→ Remote invocation via Dubbo - Include
xxx-server→ Direct local invocation (for monolithic deployment)
No business code changes are required.
Q11: Cannot find EasyFK Generator in the IntelliJ IDEA Marketplace?
This may be caused by network issues or Marketplace index delays. You can download it directly from the official JetBrains Plugin page:
https://plugins.jetbrains.com/plugin/30796-easyfk-generator/versions#tabs
After downloading, install it via File → Settings → Plugins → ⚙ → Install Plugin from Disk....
12. Appendix
12.1 Configuration Enum Reference
| Configuration Key | Allowed Values | Description |
|---|---|---|
project-type | single, micro_prd, microservice, smart | Project architecture type |
app-type | BMS, CLIENT | Application type |
rpc-type | cloud, dubbo | RPC protocol type |
build-type | maven, gradle | Build tool |
gradle-type | groovy, kotlin | Gradle DSL type |
orm-type | MYBATIS, MYBATIS_FLEX, HIBERNATE | ORM framework |
prd-type | none, single, separation | PRD layer strategy |
log-type | LOGBACK, LOG4J2 | Logging framework |
db-type | MYSQL, POSTGRE_SQL, ORACLE, ORACLE_12C, MARIADB, SQL_SERVER, DM, KINGBASE_ES, GAUSS, OCEAN_BASE, CLICK_HOUSE, H2, HSQL, SQLITE, DB2, GBASE, OSCAR, XU_GU, PHOENIX, FIREBIRD, SYBASE, SQL_SERVER2005, OTHER | Database type |
12.2 Generated File Matrix
Below are all files that may be generated for a single Model (e.g. Product) across each architecture:
| File | SINGLE | MICRO_PRD | MICRO | SMART | Overwrite Policy |
|---|---|---|---|---|---|
PrdApp.java (Entry point) | — | ✓ | — | — | Do not overwrite |
application.yml (Config file) | ✓ | ✓ | ✓ | ✓ | Do not overwrite |
logback.xml (Logging config) | ✓ | ✓ | ✓ | ✓ | Do not overwrite |
Product.java (Entity) | ✓ | — | ✓ | ✓ | Force refresh |
ProductMapper.java | ✓ | — | ✓ | ✓ | Do not overwrite |
ProductMapper.xml | ✓ | — | ✓ | ✓ | Do not overwrite |
ProductDto.java | ✓ | — | ✓ | ✓ | Force refresh |
ProductParam.java | ✓ | — | ✓ | ✓ | Force refresh |
ProductReq.java | ✓ | — | ✓ | ✓ | Do not overwrite |
ProductResp.java | ✓ | — | ✓ | ✓ | Do not overwrite |
ProductEditReq.java | ✓ | — | ✓ | ✓ | Do not overwrite |
IProductRepository.java | ✓ | — | ✓ | ✓ | Do not overwrite |
ProductRepositoryImpl.java | ✓ | — | ✓ | ✓ | Do not overwrite |
IProductService.java | ✓ | — | ✓ | ✓ | Do not overwrite |
ProductServiceImpl.java | ✓ | — | ✓ | ✓ | Do not overwrite |
IProductApi.java | — | — | — | ✓ | Do not overwrite |
ProductApiServerImpl.java | — | — | — | ✓ | Do not overwrite |
IProductRemote.java (Cloud) | — | — | ✓★ | ✓ | Do not overwrite |
ProductRemoteImpl.java (Cloud) | — | — | ✓★ | ✓ | Do not overwrite |
ProductApiScImpl.java | — | — | — | ✓ | Do not overwrite |
IProductRemote.java (Dubbo) | — | — | ✓★ | ✓ | Do not overwrite |
ProductRemoteImpl.java (Dubbo) | — | — | ✓★ | ✓ | Do not overwrite |
ProductApiDubboImpl.java | — | — | — | ✓ | Do not overwrite |
ProductController.java | ✓ | — | ✓ | ✓ | Do not overwrite |
ProductBmsController.java | — | — | ✓★★ | ✓★★ | Do not overwrite |
★ In MICROSERVICE architecture, only Cloud or Dubbo is generated depending on rpc-type
★★ Generated only when prd-type: separation
EasyFK Generator v3.5.16 (Plugin v1.0.2) — Turning architectural design directly into runnable code.