This skill should be used when the user needs AI-powered code generation for RuoYi-Vue-Plus framework. It handles intelligent generation of Java backend code (Controller, Service, Mapper, Domain) and Vue3 frontend code (Vue pages, TypeScript API, Types) based on database table structures, replacing or enhancing the traditional Velocity template approach.
This skill enables AI-driven code generation for RuoYi-Vue-Plus framework, providing intelligent code generation that understands business context from table names, comments, and column definitions. It can generate production-ready Java backend code and Vue3 frontend code with minimal manual adjustments.
Key Capabilities:
Use this skill when:
ruoyi-generator module filesUser Request
│
├──► "生成XX表的代码" / "Generate code for table"
│ └──► Analyze table structure → Generate complete code → Output files
│
├──► "优化模板" / "Improve templates"
│ └──► Load references/ruoyi-architecture.md → Analyze → Suggest improvements
│
├──► "添加AI生成功能" / "Add AI generation"
│ └──► Read GenTableServiceImpl → Create AiCodeGenerator → Integrate
│
└──► "对比AI和Velocity" / "Compare AI vs Velocity"
└──► Load references/comparison.md → Analyze trade-offs → Recommend
Before generating code, analyze:
sys_user = system user management)Load reference: references/ruoyi-architecture.md for framework conventions
Generate these components with intelligent defaults:
| Component | Location Pattern | AI Enhancement |
|---|---|---|
| Domain | domain/{ClassName}.java | Smart field validation, comments |
| VO | domain/vo/{ClassName}Vo.java | View-oriented field selection |
| BO | domain/bo/{ClassName}Bo.java | Business operation fields |
| Mapper | mapper/{ClassName}Mapper.java | Custom SQL for complex queries |
| Service | service/I{ClassName}Service.java | Business method signatures |
| ServiceImpl | service/impl/{ClassName}ServiceImpl.java | Implementation with validation |
| Controller | controller/{ClassName}Controller.java | REST API with permissions |
Generate modern Vue3 + TypeScript code:
| Component | Location Pattern | Features |
|---|---|---|
| API | api/{module}/{business}/index.ts | Axios calls, error handling |
| Types | api/{module}/{business}/types.ts | TypeScript interfaces |
| Vue Page | views/{module}/{business}/index.vue | CRUD table, forms, dialogs |
Generated code should follow RuoYi conventions:
@Data, @RequiredArgsConstructor)@NotBlank, @Size)@Schema)Table Structure → AI Analysis → Direct Code Output
Best for: Complex business logic, custom requirements
Table Structure → AI Enhance → Velocity Template → Code Output
Best for: Consistent structure with intelligent content
Simple CRUD → Velocity Template
Complex Logic → AI Generation
Best for: Production use, optimal speed and quality
Create AiCodeGenerator Service
Path: ruoyi-modules/ruoyi-generator/src/main/java/org/dromara/generator/service/AiCodeGenerator.java
Modify GenTableServiceImpl
previewCode() methodCreate AI Prompt Builder
Reference: references/gen-table-schema.md for data structure details
String buildGenerationPrompt(GenTable table, String codeType) {
return """
Generate %s code for RuoYi-Vue-Plus framework.
Table Information:
- Name: %s
- Comment: %s
- Class Name: %s
- Module: %s
- Business: %s
Columns:
%s
Requirements:
1. Follow RuoYi naming conventions
2. Use proper validation annotations
3. Include Swagger documentation
4. Handle relationships if any
5. Return only the code, no explanations
""".formatted(
codeType,
table.getTableName(),
table.getTableComment(),
table.getClassName(),
table.getModuleName(),
table.getBusinessName(),
formatColumns(table.getColumns())
);
}
ruoyi-architecture.md - Framework architecture and conventionsgen-table-schema.md - GenTable/GenTableColumn data structuresvelocity-templates.md - Existing Velocity template referencecode-examples.md - High-quality code examples for AI trainingjava-templates/ - Java code templatesvue-templates/ - Vue3 code templatesKey files to integrate with:
ruoyi-modules/ruoyi-generator/src/main/java/org/dromara/generator/service/GenTableServiceImpl.javaruoyi-modules/ruoyi-generator/src/main/java/org/dromara/generator/util/VelocityUtils.javaruoyi-modules/ruoyi-generator/src/main/java/org/dromara/generator/domain/GenTable.javaruoyi-modules/ruoyi-generator/src/main/java/org/dromara/generator/domain/GenTableColumn.java