Files
tuanwei-java/src/main/java/com/gxwebsoft/gxmu/module/controller/ModuleRegistryController.java
T
weicw 11f0f90f7a feat(spec58): 模块注册表后端与模块硬编码收敛(#60)
- 新增 gxmu/module 包:ModuleRegistry 实体/Mapper/Service,listEnabled 按 sort_number 升序,titleOf 未注册回退 module 原串
- 新增 GET /api/gxmu/module-registry/list(需登录),返回启用模块元数据
- ReviewFlowConfigServiceImpl / ReviewListServiceImpl 的模块名映射改读注册表,查不到回退原串
- DeclareGuardServiceImpl 的模块集合改为注册表驱动,含 enabled=0(停用模块存量仍可撤回/作废)
- 启动期一致性校验:table_name≠module 或业务表缺失即启动失败,gxmu.module-registry.strict=false 可关闭
- 单测 13 例:注册表加载与排序、titleOf 回退、启动校验、module 名回退
2026-11-03 22:29:27 +08:00

40 lines
1.3 KiB
Java

package com.gxwebsoft.gxmu.module.controller;
import com.gxwebsoft.common.core.web.ApiResult;
import com.gxwebsoft.common.core.web.BaseController;
import com.gxwebsoft.gxmu.module.entity.ModuleRegistry;
import com.gxwebsoft.gxmu.module.service.ModuleRegistryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* 模块注册表控制器
*
* <p>前端启动时一次性拉取启用模块清单并缓存,模块下拉、详情页、导出模板都从这里驱动。
*
* @author Codex
* @since 2026-11-10
*/
@Api(tags = "模块注册表")
@RestController
@RequestMapping("/api/gxmu/module-registry")
public class ModuleRegistryController extends BaseController {
@Resource
private ModuleRegistryService moduleRegistryService;
@ApiOperation("启用模块清单")
@PreAuthorize("isAuthenticated()")
@GetMapping("/list")
public ApiResult<List<ModuleRegistry>> list() {
return success(moduleRegistryService.listEnabled());
}
}