Online Manualv3.5.16 · Plugin v1.0.8JDK 21+

EasyFK Generator User Manual

Covers both the IntelliJ IDEA plugin and CLI modes, YAML configuration, 4 project architectures, full-layer code generation, 22 database type mappings, custom annotations, and FAQ. Click # next to any heading to copy a direct anchor link.

1. Overview

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:

  1. IntelliJ IDEA Plugin (Recommended): Visual UI supporting database schema import, step-by-step generation, and configuration persistence with zero learning curve
  2. CLI Tool: Runs independently of any IDE, generating the full stack with a single command — ideal for automation workflows

2. Environment Requirements

ItemRequirement
JDK21 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

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)

  1. Open IntelliJ IDEA and go to File → Settings → Plugins (macOS: IntelliJ IDEA → Preferences → Plugins)
  2. Select the Marketplace tab
  3. Search for EasyFK Generator
  4. 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

  1. Obtain the plugin package easyfk-generator-idea-x.x.x.zip
  2. Open IntelliJ IDEA and go to File → Settings → Plugins
  3. Click the gear icon ⚙ → Install Plugin from Disk...
  4. Select the downloaded .zip file, 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.yml to the project root and reloads it on next launch
  • Keyboard Shortcut: Ctrl + Alt + Z to quickly open the code generation dialog

3.3 Plugin Entry Points

Entry PointDescription
File → New → EasyFK ProjectCreate a new project, scaffold the project structure, and generate code
Generate → EasyFK Incremental GenerationGenerate code in an existing project without overwriting existing files (Ctrl + Alt + Z)
Generate → EasyFK Generate Business CodeGenerate only Repository / Service / API / Remote / Controller
Generate → EasyFK Refresh Model (Field Changes)Regenerate Entity / Mapper + DTO / Param
Generate → EasyFK Refresh DTO/ParamRegenerate only DTO and Param classes
Generate → EasyFK Generate AutoConfigurationGenerate Spring Boot AutoConfiguration
Right Tool Window → EasyFKQuick-action panel grouped by scenario

3.4 Global Settings

File → Settings → Tools → EasyFK Generator:

SettingDescriptionDefault
Default Author@author tag in generated Javadoc commentseb-jack
Default Framework VersionEasyFK framework version number3.5.16
Auto-refresh Project Tree After GenerationAutomatically refreshes the IDEA project directory after generationEnabled
Show Summary Dialog After GenerationDisplays a generation summary dialog upon completionEnabled

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-tables and merges it with model-list
  • Tables imported from a database can now set only-repository: true directly in "Confirm Models" to generate only the Repository layer
  • Changed table-prefix semantics to "ignored table prefixes", supporting multiple comma-separated prefixes
  • Removed the obsolete project-level create-repository setting; generation scope is now unified under the model-level only-repository option

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

  1. Obtain and extract the installation package efg-3.5.16.zip
  2. Enter the efg-3.5.16 directory and run the installer:

Windows:

TEXT
Double-click install.bat

macOS / Linux:

BASH
chmod +x install && ./install
  1. Reopen your terminal and verify the installation:
BASH
efg -V

The following output indicates a successful installation:

TEXT
easyfk-generator 3.5.16

4.2 Uninstallation

Windows: Double-click uninstall.bat

macOS / Linux:

BASH
chmod +x uninstall && ./uninstall

4.3 Quick Start

BASH
# 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
efg

4.4 CLI Command Reference

Basic Syntax

TEXT
efg [options]
efg init [-o filename]

Generation Commands

CommandDescription
efgFull generation (project skeleton + Entity + Mapper + business code + AutoConfiguration)
efg -pGenerate project skeleton only (directory structure + build files)
efg -mGenerate Entity + Mapper only (including Mapper XML)
efg -sGenerate business code only (Repository / Service / API / Remote / Controller + DTO/Param, etc.)
efg -aGenerate AutoConfiguration only
efg -dRefresh DTO and Param only (use after database schema changes without touching other code)

Combining Flags

Flags can be combined:

CommandDescription
efg -pmProject skeleton + Entity + Mapper (first step when initializing a new project)
efg -saBusiness code + AutoConfiguration (second step after adding new business tables)
efg -pmsProject skeleton + Entity + all business code

Other Options

OptionDescription
-c <file>Specify the configuration file path (defaults to generator.yml in the current directory)
-h, --helpShow help information
-V, --versionShow version number

init Subcommand

CommandDescription
efg initGenerate a generator.yml configuration template in the current directory
efg init -o my-config.ymlSpecify a custom output filename

4.5 Typical Usage Scenarios

Scenario 1: Creating a New Project from Scratch

BASH
mkdir my-project && cd my-project
efg init                    # Generate configuration template
# Edit generator.yml and fill in all settings
efg                         # Run full generation

Scenario 2: Adding New Business Tables to an Existing Project

  1. Create the new tables in the database
  2. Update generator.yml to add the new table names to db-tables (or add new Model definitions to model-list)
  3. Run step by step:
BASH
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:

BASH
efg                         # Full generation (existing files will not be overwritten)

Scenario 3: Database Schema Changes (Adding/Modifying Columns)

BASH
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

BASH
efg -c dev-generator.yml            # Development environment config
efg -c prod-generator.yml -m        # Production environment, generate Model only

Scenario 5: Generating Only the Project Skeleton (No Business Code)

BASH
efg -p                      # Generate directory structure and build files to set up the project layout before adding business logic

4.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)

YAML
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 Info

4.6.2 Microservice Product Layer Project (MICRO_PRD)

YAML
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: mall

A 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)

YAML
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)

YAML
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 Address

4.6.5 Multi-Stack Microservice Project (SMART)

YAML
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: false

4.6.6 Auto-Parsing Table Schemas from a Database

YAML
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_brand

How it works:

  1. The generator connects to the database via JDBC
  2. Uses DatabaseMetaData to retrieve table schemas (column names, types, comments, primary keys, etc.)
  3. Automatically strips ignored prefixes based on table-prefix (e.g., when configured with base_,auth_, base_product → Product)
  4. Converts snake_case column names to camelCase (product_name → productName)
  5. Maps database column types to Java types according to the type mapping rules
  6. Reads column comments as descriptions for @Schema and @Column

4.6.7 Configuration with Resource Permission Annotations

YAML
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: Account

Automatic 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:

YAML
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

PropertyRequiredTypeDefaultDescription
project-dirYesString-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-idYesString-Maven groupId, e.g., com.example
project-nameYesString-Project name, used both as the project root directory name and as the prefix for all submodules. Example: my-app
base-packageYesString-Root Java package path; all generated code is organized under this package. Example: com.example.myapp
project-typeNoEnumsmartProject architecture type, which determines the generated project structure and code layers. See details below
rpc-typeNoEnumcloudRPC framework type; applies when project-type: microservice or micro_prd (required for MICRO_PRD). Options: cloud (Spring Cloud Feign), dubbo (Apache Dubbo)
build-typeNoEnummavenBuild tool type. maven → generates pom.xml; gradle → generates build.gradle
gradle-typeNoEnumgroovyGradle DSL type; only applies when build-type: gradle. groovy → build.gradle; kotlin → build.gradle.kts
orm-typeNoEnumMYBATISORM framework type: MYBATIS (MyBatis-Plus), MYBATIS_FLEX (MyBatis-Flex), HIBERNATE
prd-typeNoEnumnonePRD / Controller layer strategy. none — do not generate; single — single PRD project; separation — separated (client + bms)
log-typeNoEnumLOGBACKLogging framework type: LOGBACK or LOG4J2
framework-versionNoString3.5.16EasyFK framework version written into the build file dependencies
project-versionNoString1.0.0-SNAPSHOTVersion of the generated project
app-typeYesEnum-Application type, which determines the generated project template and configuration style. Options: BMS (Admin / Back-office), CLIENT (Customer-facing / ToC)
create-prd-projectNoBooleantrueWhether to generate the PRD (Controller) subproject. Setting to false skips generating any Controller-related modules
controller-auto-configNoBooleanfalseWhether to generate Spring Boot AutoConfiguration for the Controller layer

project-type Details:

ValueDescription
singleMonolithic project: all code resides in a single project with no submodule split
micro_prdMicroservice product-layer project: generates only the bootstrap class and configuration files, invoking backend microservices via RPC with no ORM/DB/business code
microserviceStandard microservice architecture: generates API + Server + PRD modules with a single chosen RPC protocol (Cloud or Dubbo)
smartMulti-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

PropertyRequiredTypeDefaultDescription
module-nameYesString-Module name, used to generate configuration class names (e.g., MyappServerConfig), remote call serviceId, Controller path prefixes, etc. Example: myapp
authorNoStringeb-jackAuthor name included in generated code comments
orm-typeNoEnumMYBATISORM type. Options: MYBATIS, MYBATIS_FLEX, HIBERNATE
spring-annotationNoBooleantrueWhether 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-controllerNoBooleantrueWhether to generate Controller layer code (global setting, overridable at the Model level)
extends-supper-classNoBooleantrueWhether Entity classes extend the framework base class, which provides common fields deleted, insertTime, and lastUpdateTime

Database Connection Configuration

PropertyRequiredTypeDefaultDescription
db-typeNoEnumMYSQLDatabase type. See 8.1 Supported Databases for the full list of supported values
db-short-urlConditionalString-Short database connection URL in host:port/database format, e.g., localhost:3306/my_db. Required only when using db-tables
db-userNoStringrootDatabase username
db-pwdConditionalString-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

PropertyRequiredTypeDefaultDescription
table-prefixNoString-Global ignored table prefixes; supports multiple comma-separated prefixes. Example: with base_,auth_, table base_product → class Product, table auth_role → class Role
db-tablesNoString-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.

YAML
code:
  model-list:
    - model-name: Product
      model-desc: Product Info
      # ... more configuration
    - model-name: Order
      model-desc: Order Info

Model Configuration Properties

PropertyRequiredTypeDefaultDescription
model-nameYesString-Model name in PascalCase. Used as the prefix for all generated class names. Example: Product → ProductDto, ProductReq, IProductService, etc.
model-descNoString-Human-readable model description, used in code comments, Swagger documentation, etc. Example: Product Info
table-nameNoStringAuto-derivedCorresponding 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-typeNoStringStringJava type of the primary key field. Options: String (default, UUID strategy), Long (for auto-increment primary keys)
id-is-autoNoBooleanfalseWhether the primary key is auto-incremented. true → @TableId(type = IdType.AUTO); false → @TableId(type = IdType.ASSIGN_UUID)
super-classNoStringcom.mcst.easyfk.service.mybatisplus.persistence.BaseMyBatisPlusEntityFully 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-repositoryNoBooleanfalseWhether to generate only the Repository layer. When true, generates only Entity + Mapper + Repository + DTO, skipping Service / API / Controller / Remote
create-controllerNoBooleantrueWhether to generate a Controller for this Model. Takes precedence over the global code.create-controller setting
table-prefixNoStringInherit globalModel-specific ignored table prefixes (comma-separated). Takes precedence over the global code.table-prefix setting
forbidden-filedNoString-Disable/status field name (e.g., forbidden, status). When set, the Controller layer automatically generates enable/disable endpoints
resource-groupNoStringInherit globalResource permission group for this Model (overrides global config)
resource-nameNoStringInherit globalResource permission display name for this Model (overrides global config)
resource-idNoStringInherit globalResource permission ID for this Model (overrides global config)
resource-pathNoStringInherit globalFrontend route path for this Model's resource permission (overrides global config)
resource-sortNoIntegerInherit globalResource group sort order value
model-resource-sortNoIntegerAuto-calculatedResource 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

PropertyRequiredTypeDefaultDescription
create-resource-annotationNoBooleanfalseMaster switch: whether to generate resource permission annotations. Set to true to generate @ResourceController and @AuthResource on Controllers
resource-groupNoString-Resource group identifier
resource-nameNoString-Display name of the resource group
resource-idNoString-Resource group ID
resource-pathNoString-Frontend route path corresponding to the resource group
resource-sortNoInteger10000Base sort order value for the resource group
module-resource-sortNoInteger10000Starting sort order value for individual Model resources
increment-starNoInteger100Increment step between sort order values of multiple Models

Example Controller annotations generated when enabled:

JAVA
@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:

TEXT
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}.service instead 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:

TEXT
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 CLOUD or DUBBO as 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-api or xxx-dubbo-api) to make RPC calls
  • Includes dependencies such as web-prd, doc-knife4j, registry-nacos, and rpc-${rpcType}
  • Optionally includes auth-prd (for BMS) and auth-${rpcType}-api (RPC interface for the authentication module)

Typical Workflow:

  1. Generate the project skeleton and base configuration using MICRO_PRD
  2. Manually add dependencies for the required microservice API modules in pom.xml / build.gradle
  3. Manually write Controllers and inject each microservice's Remote/API interface for remote calls
  4. 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):

TEXT
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):

TEXT
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.java

6.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:

TEXT
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.java

Key Highlights of the SMART Architecture:

  • Defines a unified IProductApi interface
  • 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-typeprd-typeGenerated 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)
microservicenoneapi + server (no Controller project)
microservicesingleapi + server + prd
microserviceseparationapi + server + prd-client + prd-bms
smartnoneapi + server + remote (including 4 cloud/dubbo sub-modules)
smartsingleapi + server + remote + prd
smartseparationapi + 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-typeGenerated Build Files
mavenpom.xml
gradle + gradle-type: groovy (default)build.gradle + settings.gradle
gradle + gradle-type: kotlinbuild.gradle.kts + settings.gradle.kts

Tech Stack Dimension

These options control technical dependencies and generated code style:

OptionScope of Impact
orm-typePersistence dependencies and Entity annotations: MyBatis-Plus (default) → @TableName + BaseMapper; MyBatis-Flex → Flex annotations; Hibernate → JPA annotations
rpc-typeActive in MICROSERVICE and MICRO_PRD (required for MICRO_PRD); determines RPC transport and dependencies
log-typeLogging config file: logback.xml or log4j2.xml
db-typeDatabase driver dependency in build files (e.g., MySQL / PostgreSQL) and JDBC URL format
include-authWhether 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:

OptionScopeDescription
only-repositoryModel-levelWhen true, generates only Entity + Mapper + Repository + DTO (skips Service / API / Controller / Remote)
create-controllerGlobal / Model-levelControls Controller layer generation; Model-level overrides global
controller-auto-configGlobalIn 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:

YAML
project-type: microservice
rpc-type: cloud
prd-type: none          # Skip PRD (Controller) sub-module

Scenario 2: SMART Architecture + Data-Layer-Only Models

Ideal when certain tables (e.g., line items or join tables) do not need standalone APIs:

YAML
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 Controller

Scenario 3: Monolith with Gradle + MyBatis-Flex

YAML
project-type: single
build-type: gradle
orm-type: MYBATIS_FLEX
app-type: BMS

Summary: 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):

JAVA
@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 @AutoMapper for automatic Entity-to-DTO mapping (powered by MapStruct-Plus)
  • Uses @EntityColumn(comment = "...") to record column comments
  • Uses @PrimaryKey to mark the primary key field
  • Extends the framework base class to inherit deleted, insertTime, and lastUpdateTime automatically

7.2 Mapper Interface and XML

Mapper Interface: ProductMapper.java

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/

JAVA
@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 @Schema for Swagger / OpenAPI documentation
  • Supports @SingleUniqueField and @CombUniqueField annotations (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/

JAVA
@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 @BetweenConditionField automatically generate xxxStart and xxxEnd range query fields
  • Param files use the force-refresh policy

7.5 Req (Request Object)

File: ProductReq.java

Location: {api}/request/

JAVA
@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/

JAVA
@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/

JAVA
@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

JAVA
public interface IProductRepository extends IBaseRepository<ProductDto, String> {
}

Implementation: ProductRepositoryImpl.java

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

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:

MethodDescription
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

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 invocation
  • ProductApiScImpl: Remote invocation via Spring Cloud Feign
  • ProductApiDubboImpl: 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-typeprd-typeGenerated Controller
singlesingleInjects IProductService directly for local calls
microservice + cloudsingleInjects the Remote interface (Feign) for remote calls
microservice + dubbosingleInjects the Remote interface (Dubbo) for remote calls
smartsingleInjects IProductApi, with the concrete implementation wired by auto-configuration
AnyseparationGenerates both ProductController (client-facing) and ProductBmsController (back-office)

Standard Controller endpoints generated:

EndpointHTTP MethodPathDescription
Detail queryGET/api/{module}/{model}/detailQuery record details by ID
Paginated queryGET/api/{module}/{model}/queryPagePaginated conditional query
Create / EditPOST/api/{module}/{model}/addOrEditCreate or update a record
Batch deletePOST/api/{module}/{model}/deleteBatch delete by list of IDs
Enable / DisablePOST/api/{module}/{model}/disableGenerated 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

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

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:

  1. Server Module: {Module}ServerConfig.java + AutoConfiguration.imports
    • Automatically registers Service, Repository, API implementation, and related beans
  2. Remote Cloud API Module: {Module}ApiConfig.java + AutoConfiguration.imports
    • Automatically registers Feign client beans
  3. Remote Cloud Provider Module: {Module}ProviderConfig.java + AutoConfiguration.imports
    • Automatically registers Remote implementation beans
  4. Remote Dubbo API/Provider Modules: Same structure as above for Dubbo
  5. 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 configuration
    • application-dev.yml — Development environment
    • application-test.yml — Testing environment
    • application-prod.yml — Production environment
  • Logging configuration: logback.xml or log4j2.xml (based on log-type)

8. Database Support & Type Mapping

8.1 Supported Databases

Database Type (db-type value)Description
MYSQLMySQL (default)
MARIADBMariaDB
POSTGRE_SQLPostgreSQL
ORACLEOracle 11g and earlier
ORACLE_12COracle 12c+
SQL_SERVERSQL Server
SQL_SERVER2005SQL Server 2005
DB2IBM DB2
H2H2 embedded database
HSQLHSQLDB
SQLITESQLite
DMDameng Database (DM)
KINGBASE_ESKingbaseES
GAUSSGaussDB
OCEAN_BASEOceanBase
CLICK_HOUSEClickHouse
GBASEGBase
OSCARShenTong (Oscar) Database
XU_GUXuGu Database
PHOENIXApache Phoenix (HBase)
FIREBIRDFirebird
SYBASESybase ASE
OTHEROther 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 TypeJava Type
DATETIME, TIMESTAMP, TIMESTAMPTZ, TIMESTAMP WITH TIME ZONELocalDateTime
DATELocalDate
TIMELocalTime
DECIMAL, NUMERICBigDecimal
TINYINT, BOOLEAN, BOOL, BITBoolean
INT, INT4, INTEGER, SMALLINT, INT2, SERIAL, SMALLSERIALInteger
BIGINT, NUMBER, BIGSERIAL, IDENTITY, INT8Long
REAL, FLOAT4Float
DOUBLE, DOUBLE PRECISION, FLOAT, FLOAT8Double
BYTEA, BLOB, VARBINARY, BINARYbyte[]
UUIDUUID
VARCHAR, CHAR, TEXT, CLOB, and othersString

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

JAVA
@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

JAVA
@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

JAVA
@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

JAVA
@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:

PolicyAffected FilesBehavior
Create only if absent (createOnNotExistFile)Mapper interfaces, Mapper XML, Repository, Service, API, Controller, Remote, Req, Resp, EditReq, entry-point classes, configuration filesIf the file already exists, it is skipped and never overwritten
Delete and recreate (delAndCreateFile)Entity, DTO, Param, AutoConfiguration classesDeletes 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 -d to refresh DTO/Param.
  • AutoConfiguration files: Rebuilt every time efg -a or efg runs, 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?

Featuredb-tablesmodel-list
Field metadata sourceAutomatically read from the databaseManually defined (does not auto-read fields)
Database connection requiredYesNo
Field types / commentsAutomatically parsedCannot define fields (Model-level config only)
Best suited forTables already exist in the databaseDesign 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:

YAML
model-list:
  - model-name: OrderItem
    model-desc: Order Item
    create-controller: false    # Do not generate a Controller for this Model

Q7: How do I generate only the Repository layer (without Service / Controller)?

Set only-repository: true in model-list:

YAML
model-list:
  - model-name: UserAddress
    model-desc: User Address
    only-repository: true       # Generate only Entity + Mapper + Repository + DTO

Q8: What is the difference between BaseMyBatisPlusEntity and BaseMyBatisPlusSimpleEntity as the Entity superclass?

SuperclassIncluded Common Fields
BaseMyBatisPlusEntity (default)deleted, insertTime, lastUpdateTime
BaseMyBatisPlusSimpleEntityNone (suitable for simple tables such as join tables)

Switch between them via super-class in model-list:

YAML
model-list:
  - model-name: UserRole
    super-class: BaseMyBatisPlusSimpleEntity

Q9: How are table names mapped to class names?

The generator applies the following rules automatically:

  1. Strips configured prefixes from table-prefix (e.g. with base_,auth_, base_product → product)
  2. Converts snake_case to camelCase (product_info → productInfo)
  3. Capitalizes the first letter (productInfo → ProductInfo)

You can also specify the table name explicitly via table-name in model-list:

YAML
model-list:
  - model-name: ProductInfo    # Class name
    table-name: t_prd_info     # Explicit table name; skips automatic derivation

Q10: 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 KeyAllowed ValuesDescription
project-typesingle, micro_prd, microservice, smartProject architecture type
app-typeBMS, CLIENTApplication type
rpc-typecloud, dubboRPC protocol type
build-typemaven, gradleBuild tool
gradle-typegroovy, kotlinGradle DSL type
orm-typeMYBATIS, MYBATIS_FLEX, HIBERNATEORM framework
prd-typenone, single, separationPRD layer strategy
log-typeLOGBACK, LOG4J2Logging framework
db-typeMYSQL, 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, OTHERDatabase type

12.2 Generated File Matrix

Below are all files that may be generated for a single Model (e.g. Product) across each architecture:

FileSINGLEMICRO_PRDMICROSMARTOverwrite 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.