Code Generation Advanced

Core Positioning

The code generator is RuoYi’s “nuclear weapon” for development efficiency. Regular single-table CRUD can no longer satisfy complex business scenarios. Here we introduce three advanced generation modes, covering the most common complex page patterns in enterprise development.

With these capabilities, a complex business page containing master-child tables and approval flows goes from “days of coding” to “minutes of configuration.”


Suitable Users

ScenarioRecommended ModeEffect
Order + Line ItemsMaster-Child Standard ModeSame dialog, master-child tables edited together
Work Order + ProcessesMaster-Child Embedded ModeExpand child table directly in list
Purchase Order + DetailsMaster-Child ERP ModeIndependent master and child lists, independent forms
Department Tree/Category TreeTree Table ModeAuto-generate tree table
Mobile Pagesuni-app ModeGenerate pages compatible with H5/Mini Programs

Three Master-Child Table Generation Modes

graph TB subgraph StandardMode["Mode 1: Standard Mode"] S1["Master Table List Page"] S2["Click Add → Dialog"] S3["Dialog: Master Form + Child Table
Edit in same dialog"] S1 --> S2 --> S3 end subgraph EmbeddedMode["Mode 2: Embedded Mode"] I1["Master Table List Page"] I2["Expand Row → Embedded Child Table
Child table shown directly below master row"] I1 --> I2 end subgraph ERPMode["Mode 3: ERP Mode"] E1["Master Table Independent List"] E2["Child Table Independent List
(Linked by master table ID)"] E3["Master Table Independent Form"] E4["Child Table Independent Form"] E1 --> E2 E3 --> E4 end

Mode Applicable Scenarios

ModeUse CaseUser ExperienceRepresentative Business
Standard ModeSmall master-child data volume, master+child need to be filled together⭐⭐⭐⭐ Smooth operationSurveys+Questions, Config+Config Items
Embedded ModeNeed to quickly view child data without navigating away⭐⭐⭐⭐⭐ High info densityWork Orders+Processes, Tasks+Subtasks
ERP ModeMaster and child each have independent business logic, large data volume⭐⭐⭐ High flexibilityPurchase Orders+Details, Sales Orders+Details

Tree Table Code Generation

graph LR DEPT["Department Table
id / parent_id / name"] GEN["Code Generator
Recognizes parent_id field"] OUT["Generate Tree Table Page
el-tree + Drag & Drop Sorting"] DEPT --> GEN --> OUT

Supports unlimited levels, auto-generates expand/collapse, drag-and-drop sorting, add child node, and other features.


uni-app Code Generation

Generate complete page code for mobile, supporting:

  • List pages (pull-to-refresh, load more)
  • Form pages
  • Detail pages
  • API request encapsulation

Frontend Version Support

Generation TargetVue3 AdminVben5Vue2uni-app
Single Table CRUD
Master-Child Standard
Master-Child Embedded
Master-Child ERP
Tree Table

Usage Process

  1. Create table structure in the database
  2. Import tables in the “Code Generation” menu
  3. Configure generation options (module name, business name, class name, generation mode)
  4. Preview and generate code
  5. Copy code to the project, configure menu to use
docs