From 1330c54c2acfec7ac126eef9657fd5849918f5f6 Mon Sep 17 00:00:00 2001 From: API Changelog Bot Date: Wed, 22 Apr 2026 13:51:33 +0800 Subject: [PATCH] =?UTF-8?q?feat(admin-topic):=20status=20=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=20Integer=20=E6=94=B9=E4=B8=BA=20String=20=E6=9E=9A?= =?UTF-8?q?=E4=B8=BE=20(ONLINE/OFFLINE)=20-=20PR=20#1156?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.7 (1M context) --- ...4-22_topic-status-string-enum-migration.md | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 changelogs/2026-04/2026-04-22_topic-status-string-enum-migration.md diff --git a/changelogs/2026-04/2026-04-22_topic-status-string-enum-migration.md b/changelogs/2026-04/2026-04-22_topic-status-string-enum-migration.md new file mode 100644 index 0000000..5174372 --- /dev/null +++ b/changelogs/2026-04/2026-04-22_topic-status-string-enum-migration.md @@ -0,0 +1,72 @@ +# 管理端 Topic status 字段从 Integer 改为 String 枚举 + +- **日期**: 2026-04-22 +- **PR**: #1156 +- **工单**: #1154 +- **DDL**: 测试服已执行迁移脚本 +- **影响**: 管理端专题模块 + +## 变更概要 + +Topic(专题)模块 `status` 字段由 `Integer`(0/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` 字段: + +**变更前**: +```json +{ "status": 1 } +``` + +**变更后**: +```json +{ "status": "ONLINE" } +``` + +校验规则:`@Pattern("^(ONLINE|OFFLINE)$")`,不传入该枚举值会返回参数校验错误。 + +### 3. 所有返回 TopicVO 的接口(管理端 + C 端) + +返回 body 中 `status` 字段: + +**变更前**: +```json +{ "status": 1 } +``` + +**变更后**: +```json +{ "status": "ONLINE" } +``` + +## 前端需同步 + +1. **下拉字典切换**:管理端 topic 的 status 下拉/筛选从通用字典 `common_status`(0=禁用 / 1=启用)切换到专用字典 `topic_status`(ONLINE=上线 / OFFLINE=下线) +2. **所有传 status 的表单/筛选**:传值从 `1/0` 改为 `"ONLINE"/"OFFLINE"` +3. **所有读 status 的列表/详情**:显示逻辑从判 `status===1` 改为判 `status==='ONLINE'` + +## 字段 `createdAt` 保持不变 + +为降低前端改动,TopicVO 的 `createdAt` 字段名保留不变(后端内部已从 `getCreatedAt` 改为 `getCreateTime` 读取,返回值仍是 ISO 时间字符串,业务语义和格式完全不变)。 + +## 非破坏性说明 + +- 已有逻辑只需按上述同步改 status 枚举值,无其他改动 +- 后端已部署,测试服已迁移 DB,可直接联调