3.4 KiB
学校组织管理菜单开关 Implementation Plan
For agentic workers: REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: Add per-school faculty, major, and administrative-class management switches with enforced dependencies.
Architecture: Persist three booleans in the school product configuration and normalize them in the service layer. Return them to the frontend, filter teacher navigation from the booleans, and make the platform editor update both presets and individual switches.
Tech Stack: Spring Boot, MyBatis, MySQL, Vue 3, Element Plus, Node static checks, JUnit 5/Mockito.
Global Constraints
- Existing organization data is retained when a switch is disabled.
- Faculty off forces major and administrative-class off; major off forces administrative-class off.
- Administrative-class writes remain blocked when its switch is off.
Task 1: Persist and normalize organization switches
Files:
-
Create:
docs/sql/2026-07-30-school-organization-menu-switches.sql -
Modify:
src/main/java/com/sztzjy/linkCommerce/entity/SchoolProductConfig.java -
Modify:
src/main/java/com/sztzjy/linkCommerce/service/SchoolProductConfigService.java -
Modify:
src/main/java/com/sztzjy/linkCommerce/service/impl/SchoolProductConfigServiceImpl.java -
Test:
src/test/java/com/sztzjy/linkCommerce/service/impl/SchoolProductConfigServiceImplTest.java -
Write JUnit tests for default switches and cascade normalization.
-
Run
mvn -q -DforkCount=0 -Dtest=SchoolProductConfigServiceImplTest testand confirm the new assertions fail. -
Add SQL columns, Java accessors, default values, normalization, and per-capability guards.
-
Re-run the focused test and confirm success.
Task 2: Enforce backend capability guards
Files:
-
Modify:
src/main/java/com/sztzjy/linkCommerce/controller/stu/UserController.java -
Test:
src/test/java/com/sztzjy/linkCommerce/controller/stu/UserControllerTeacherAdminTest.java -
Add failing tests that disable faculty/major/admin-class management and assert that the corresponding write API does not write.
-
Run the focused controller test and confirm failure.
-
Replace the single organization-mode permission check with capability-specific checks while preserving platform-admin access.
-
Re-run the focused test and confirm success.
Task 3: Configure and render switches in the frontend
Files:
-
Modify:
src/views/platformAdmin/school/index.vue -
Modify:
src/layout/components/Sidebar/index.vue -
Modify:
src/views/teacherEnd/class/index.vue -
Modify:
tests/school-product-config.static.test.cjs -
Add failing static assertions for three Element Plus switches and capability-based route filtering.
-
Run
node tests/school-product-config.static.test.cjsand confirm failure. -
Bind switches with dependency-aware handlers, filter menus by their capabilities, and derive the administrative-class UI from its switch.
-
Re-run all
tests/*.test.cjsandnpm run build:prod.
Task 4: Apply and verify the migration
Files:
-
Run:
docs/sql/2026-07-30-school-organization-menu-switches.sql -
Apply the migration to the configured development database.
-
Query Guangdong Science and Technology Vocational College’s product configuration and verify all three switches are disabled.
-
Restart backend and frontend, confirm the local health endpoints return HTTP 200.