You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.5 KiB
1.5 KiB
03 — DictGroup 出入参规范化
What to build: DictGroupVO 改名为 DictGroupDTO(继承 BaseDTO,加 fromEntity/toEntity)。DictGroupController.saveOrUpdate 入参从 DictGroup(实体)改为 DictGroupDTO——客户端伪造 builtin/createTime/creatorId 等字段被 InitBinder strip 掉,结构性消除 mass assignment 漏洞。DictGroupController.enabledList 出参从 List<DictGroup>(实体直出)改为 List<DictGroupDTO>——deleted/creatorId/updaterId 不再泄露给前端。Service 层手工置空审计字段的代码删除(InitBinder 接管)。
Blocked by: 01 (BaseDTO 重构), 02 (InitBinder)
Status: resolved
DictGroupVO改名为DictGroupDTO,加@Data+@EqualsAndHashCode(callSuper = true),继承BaseDTODictGroupDTO上实现fromEntity(DictGroup)静态方法和toEntity()实例方法DictGroupController.saveOrUpdate入参从DictGroup改为DictGroupDTODictGroupController.enabledList出参从List<DictGroup>改为List<DictGroupDTO>- Service 层手工置空
createTime/creatorId/updaterId/deleted的代码删除 - Service 层手工强制
builtin = false的代码删除 - DictGroupController 不再 import
DictGroup实体 - 测试:saveOrUpdate 入参为 DictGroupDTO,提交
builtin=true被 strip - 测试:enabledList 返回的 JSON 中不包含
deleted/creatorId/updaterId - 测试:现有 dict 模块测试在改入参类型后仍全绿