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 名回退
This commit is contained in:
2026-11-03 22:29:27 +08:00
parent 1f2a837609
commit 11f0f90f7a
13 changed files with 758 additions and 46 deletions
@@ -0,0 +1,31 @@
package com.gxwebsoft.gxmu.module.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gxwebsoft.gxmu.module.entity.ModuleRegistry;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.Collection;
import java.util.List;
/**
* 模块注册表 Mapper
*
* @author Codex
* @since 2026-11-10
*/
public interface ModuleRegistryMapper extends BaseMapper<ModuleRegistry> {
/**
* 查询当前库中真实存在的表名,用于启动期校验注册表引用的业务表。
*
* @param names 待校验的表名集合
* @return 存在的表名
*/
@Select("<script>"
+ "SELECT TABLE_NAME FROM information_schema.TABLES "
+ "WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME IN "
+ "<foreach collection='names' item='name' open='(' separator=',' close=')'>#{name}</foreach>"
+ "</script>")
List<String> selectExistingTableNames(@Param("names") Collection<String> names);
}