hl-api-changelog/changelogs/2026-04/2026-04-22_topic-status-string-enum-migration.md
API Changelog Bot 1330c54c2a feat(admin-topic): status 字段 Integer 改为 String 枚举 (ONLINE/OFFLINE) - PR #1156
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-22 13:51:43 +08:00

1.9 KiB

管理端 Topic status 字段从 Integer 改为 String 枚举

  • 日期: 2026-04-22
  • PR: #1156
  • 工单: #1154
  • DDL: 测试服已执行迁移脚本
  • 影响: 管理端专题模块

变更概要

Topic专题模块 status 字段由 Integer0/1改为 String 枚举(ONLINE / OFFLINE),对齐项目状态字段规范。

接口影响

1. 管理端专题列表查询 GET /admin/topic/list

变更前

?status=1     // 上线
?status=0     // 下线

变更后

?status=ONLINE   // 上线
?status=OFFLINE  // 下线

2. 管理端专题创建 / 更新 POST /admin/topic/save / PUT /admin/topic/{id}

请求 body 中 status 字段:

变更前

{ "status": 1 }

变更后

{ "status": "ONLINE" }

校验规则:@Pattern("^(ONLINE|OFFLINE)$"),不传入该枚举值会返回参数校验错误。

3. 所有返回 TopicVO 的接口(管理端 + C 端)

返回 body 中 status 字段:

变更前

{ "status": 1 }

变更后

{ "status": "ONLINE" }

前端需同步

  1. 下拉字典切换:管理端 topic 的 status 下拉/筛选从通用字典 common_status0=禁用 / 1=启用)切换到专用字典 topic_statusONLINE=上线 / OFFLINE=下线)
  2. 所有传 status 的表单/筛选:传值从 1/0 改为 "ONLINE"/"OFFLINE"
  3. 所有读 status 的列表/详情:显示逻辑从判 status===1 改为判 status==='ONLINE'

字段 createdAt 保持不变

为降低前端改动,TopicVO 的 createdAt 字段名保留不变(后端内部已从 getCreatedAt 改为 getCreateTime 读取,返回值仍是 ISO 时间字符串,业务语义和格式完全不变)。

非破坏性说明

  • 已有逻辑只需按上述同步改 status 枚举值,无其他改动
  • 后端已部署,测试服已迁移 DB,可直接联调