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
| Item | Recommendation |
|---|---|
| Table name | Use a business prefix and avoid conflicts with system tables. |
| Primary key | Keep consistent with existing project style. |
| Column comments | Required for page labels and export headers. |
| Status fields | Reuse dictionaries when possible. |
| Create/update fields | Keep consistent with the project's common fields. |
| Tenant field | Add it early when data isolation is required. |
| Logical delete | Follow the project-wide strategy. |
3. Field Configuration
| Config | Description |
|---|---|
| Java type | Backend entity field type. |
| Query mode | Equals, like, range, and other query modes. |
| List display | Whether the column is displayed in the list. |
| Form display | Whether the column is displayed in add/edit forms. |
| Required | Whether frontend required validation is generated. |
| Control type | Input, select, date, radio, checkbox, and other controls. |
| Dictionary type | Dictionary used for status or enum labels. |
4. Post-generation Checks
- Package and module names are correct.
- Controller path follows API conventions.
- Permission identifiers match menu buttons.
- Mapper XML is scanned.
- Frontend API path is correct.
- Route and menu are configured.
- Import/export display follows column comments.
- 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
| Type | Path Or API | Description |
|---|---|---|
| Frontend page | vue3/src/views/tool/gen | Code generation page. |
| Backend module | springboot/fastbee-plugs/fastbee-generator | Generator core. |
| Backend API | /tool/gen | Generator APIs. |
| Tables | gen_table, gen_table_column | Table and column generation configuration. |
| Dictionary API | /system/dict/type, /system/dict/data | Dictionary configuration. |

