2.6 KiB
Strict Business Action Condition Fields Implementation Plan
For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: Reject business-action condition fields that do not belong to their configured target table and stop generated SQL from falling back to unrelated request fields.
Architecture: Keep conditionFields as target-table SQL columns. Normalize and validate against a table-scoped column map, require explicit conditions for condition-based effects, and render those validated fields directly in the Qing runtime template.
Tech Stack: Java 8, Spring Boot, Jackson, Apache Velocity, JUnit 4, Maven.
Task 1: Add table-scoped validation regression tests
Files:
-
Modify:
ruoyi-generator/src/test/java/com/ruoyi/generator/service/front/AiGenerateServiceImplTest.java -
Add a business blueprint where
book_infocontainsidbut another table containsbook_id. -
Configure a rule targeting
book_infowithconditionFields: ["book_id"]. -
Assert generation throws
ServiceExceptionidentifyingbook_info.book_id. -
Run the targeted test and confirm it fails before implementation.
Task 2: Enforce target-table field ownership
Files:
-
Modify:
ruoyi-generator/src/main/java/com/ruoyi/generator/service/front/AiGenerateServiceImpl.java -
Modify:
ruoyi-generator/src/main/java/com/ruoyi/generator/service/front/AiBusinessBlueprintValidator.java -
Normalize rule and effect condition fields using columns from their own
targetTable. -
Validate target fields, condition fields, and effect value keys against their own target table.
-
Require explicit condition fields for update and numeric effects.
-
Run the targeted service tests and confirm they pass.
Task 3: Remove runtime compatibility fallbacks
Files:
-
Modify:
ruoyi-generator/src/main/resources/qing/serviceImpl.java.vm -
Modify:
ruoyi-generator/src/test/java/com/ruoyi/generator/util/QingTemplateSupportTest.java -
Modify:
sql/qing_templates.sql -
Modify:
sql/db.sql -
Render only
conditionFields. -
Remove
conditionColumnsand request-field fallback behavior. -
Assert generated helpers build
where id = ?for valid conditions. -
Synchronize bundled templates with SQL seed copies.
Task 4: Verify
- Run
mvn -pl ruoyi-generator -Dtest=AiGenerateServiceImplTest,QingTemplateSupportTest test. - Run
mvn -pl ruoyi-generator test. - Inspect the final diff to ensure unrelated user changes remain untouched.