Skip to content

Code Generator ​

Page Guide ​

ScenarioGenerate backend CRUD, frontend pages, and basic APIs from database tables.
PrerequisiteDatabase tables, comments, primary keys, dictionaries, permission identifiers, and menu paths have been designed.
PathSystem Tools -> Code Generation -> Import Table -> Configure Fields -> Preview -> Generate.
Acceptance CriteriaGenerated code compiles, APIs are accessible, and the frontend pages support list, add, edit, delete, and export.

1. Workflow ​

2. Table Design Suggestions ​

ItemRecommendation
Table nameUse a business prefix and avoid conflicts with system tables.
Primary keyKeep consistent with existing project style.
Column commentsRequired for page labels and export headers.
Status fieldsReuse dictionaries when possible.
Create/update fieldsKeep consistent with the project's common fields.
Tenant fieldAdd it early when data isolation is required.
Logical deleteFollow the project-wide strategy.

3. Field Configuration ​

ConfigDescription
Java typeBackend entity field type.
Query modeEquals, like, range, and other query modes.
List displayWhether the column is displayed in the list.
Form displayWhether the column is displayed in add/edit forms.
RequiredWhether frontend required validation is generated.
Control typeInput, select, date, radio, checkbox, and other controls.
Dictionary typeDictionary used for status or enum labels.

4. Post-generation Checks ​

  1. Package and module names are correct.
  2. Controller path follows API conventions.
  3. Permission identifiers match menu buttons.
  4. Mapper XML is scanned.
  5. Frontend API path is correct.
  6. Route and menu are configured.
  7. Import/export display follows column comments.
  8. List, add, edit, delete, and pagination pass smoke tests.

5. FAQ ​

Generated code does not compile ​

Check the package name, module name, dependent modules, entity types, Mapper scan path, and Lombok annotations.

Frontend page requests return 404 ​

Check the backend Controller path, frontend API path, proxy prefix, and menu route.

Buttons are not visible ​

Check menu button permissions, role authorization, and frontend permission identifiers.

Dictionary labels are not displayed ​

Check whether the dictionary type exists, whether the dictionary values are enabled, and whether the field is configured with a dictionary type.

6. Secondary Development Entry Points ​

TypePath Or APIDescription
Frontend pagevue3/src/views/tool/genCode generation page.
Backend modulespringboot/fastbee-plugs/fastbee-generatorGenerator core.
Backend API/tool/genGenerator APIs.
Tablesgen_table, gen_table_columnTable and column generation configuration.
Dictionary API/system/dict/type, /system/dict/dataDictionary configuration.

FastBee | fastbee.cn