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.4 KiB
1.4 KiB
04 — DictItem 出入参规范化
What to build: DictItemVO 改名为 DictItemDTO(继承 BaseDTO,加 fromEntity/toEntity)。DictItemController.saveOrUpdate 入参从 DictItem(实体)改为 DictItemDTO——消除 mass assignment 漏洞。DictItemController.enabledList 出参从 List<DictItem>(实体直出)改为 List<DictItemDTO>——deleted/creatorId/updaterId 不再泄露。Service 层手工置空审计字段的代码删除。与 03 同模式,作用于 DictItem 实体。
Blocked by: 01 (BaseDTO 重构), 02 (InitBinder)
Status: resolved
DictItemVO改名为DictItemDTO,加@Data+@EqualsAndHashCode(callSuper = true),继承BaseDTODictItemDTO上实现fromEntity(DictItem)静态方法和toEntity()实例方法DictItemController.saveOrUpdate入参从DictItem改为DictItemDTODictItemController.enabledList出参从List<DictItem>改为List<DictItemDTO>- Service 层手工置空
createTime/creatorId/updaterId/deleted的代码删除 - Service 层手工强制
builtin = false的代码删除 - DictItemController 不再 import
DictItem实体 - 测试:saveOrUpdate 入参为 DictItemDTO,提交
builtin=true被strip - 测试:enabledList 返回的 JSON 中不包含
deleted/creatorId/updaterId - 测试:现有 dict 模块测试在改入参类型后仍全绿