原生实现题库目录浏览,替换 Scalar catalog adapter #20

Closed
opened 2026-07-28 08:19:29 +00:00 by wangziqi · 1 comment
Owner

Parent

#12

What to build

在 RuoYi Education 模块中原生实现题库目录浏览功能,用 Java/PostgreSQL 替换当前通过 Scalar adapter 代理的只读查询。使用 RuoYi controller/service/mapper 分层和 /app-api/education/ 路径;SCALAR_READ 仅作为显式兼容模式,不做静默 fallback。

Data model

由 Education 模块 Flyway migration 管理:

  • education_region
  • education_school
  • education_major
  • education_subject
  • education_category
  • education_content_entry
  • education_content_node
  • education_question_collection
  • education_question
  • education_practice_blueprint
  • education_question_collection_question

education_question_collection_question 是题集成员关系的唯一事实源。

API

/app-api/education/catalog/ 下提供:

  • GET /regions
  • GET /schools
  • GET /majors
  • GET /subjects
  • GET /categories
  • GET /content-entries
  • GET /content-nodes
  • GET /question-collections
  • GET /question-collections/{id}/questions

原有以下接口改为走原生数据源:

  • GET /app-api/education/questions/page
  • GET /app-api/education/questions/get
  • GET /app-api/education/practice-config/preview

Constraints

  • 提交前响应不得包含正确答案、解析、analysis 或 option isCorrect
  • 支持显式 PUBLICTENANT_OWNED scope;公共数据固定 tenant_id=0
  • 保留题目内容版本,保证历史报告稳定。
  • 只返回已发布、未隐藏、未停用内容。
  • malformed ID 必须 fail-closed。
  • Flyway 发布历史 forward-only,clean-disabled=true

Current status

本地实现与验证已经完成:

  • 新增 V4020__create_native_catalog.sql,包含 11 张目录表。
  • PostgreSQL 18.4 + Flyway 12.4.0 空库首次 migrate 到 4020 成功,重复 migrate 为 no-op。
  • 聚焦目录/题目测试通过。
  • mvn -pl yudao-server -am -DskipTests clean compile 通过。
  • migration 已打包到 Education 模块 target/classes/db/migration/education/

代码当前仍位于功能分支的未提交工作区,待整理提交后关闭本票据。

Out of scope

  • 管理端题目 CRUD
  • 数据导入/迁移工具
  • 词汇、手册、分数线、视频、AI 推荐等其他模块
## Parent https://git.gongxue100.com/wangziqi/ruoyi-vue-pro/issues/12 ## What to build 在 RuoYi Education 模块中原生实现题库目录浏览功能,用 Java/PostgreSQL 替换当前通过 Scalar adapter 代理的只读查询。使用 RuoYi controller/service/mapper 分层和 `/app-api/education/` 路径;`SCALAR_READ` 仅作为显式兼容模式,不做静默 fallback。 ## Data model 由 Education 模块 Flyway migration 管理: - `education_region` - `education_school` - `education_major` - `education_subject` - `education_category` - `education_content_entry` - `education_content_node` - `education_question_collection` - `education_question` - `education_practice_blueprint` - `education_question_collection_question` `education_question_collection_question` 是题集成员关系的唯一事实源。 ## API 在 `/app-api/education/catalog/` 下提供: - GET `/regions` - GET `/schools` - GET `/majors` - GET `/subjects` - GET `/categories` - GET `/content-entries` - GET `/content-nodes` - GET `/question-collections` - GET `/question-collections/{id}/questions` 原有以下接口改为走原生数据源: - GET `/app-api/education/questions/page` - GET `/app-api/education/questions/get` - GET `/app-api/education/practice-config/preview` ## Constraints - 提交前响应不得包含正确答案、解析、analysis 或 option `isCorrect`。 - 支持显式 `PUBLIC` 和 `TENANT_OWNED` scope;公共数据固定 `tenant_id=0`。 - 保留题目内容版本,保证历史报告稳定。 - 只返回已发布、未隐藏、未停用内容。 - malformed ID 必须 fail-closed。 - Flyway 发布历史 forward-only,`clean-disabled=true`。 ## Current status 本地实现与验证已经完成: - 新增 `V4020__create_native_catalog.sql`,包含 11 张目录表。 - PostgreSQL 18.4 + Flyway 12.4.0 空库首次 migrate 到 4020 成功,重复 migrate 为 no-op。 - 聚焦目录/题目测试通过。 - `mvn -pl yudao-server -am -DskipTests clean compile` 通过。 - migration 已打包到 Education 模块 `target/classes/db/migration/education/`。 代码当前仍位于功能分支的未提交工作区,待整理提交后关闭本票据。 ## Out of scope - 管理端题目 CRUD - 数据导入/迁移工具 - 词汇、手册、分数线、视频、AI 推荐等其他模块
wangziqi added the
ready-for-agent
label 2026-07-28 08:19:29 +00:00
Author
Owner

实现状态更新:原生 Java/PostgreSQL 目录、PUBLIC/TENANT_OWNED 隔离、关联表题集顺序、嵌套题集题目 API、严格 ID 校验、敏感字段剥离及 V4020 Flyway migration 已在本地完成。验证包括 82 项聚焦测试、server clean compile、migration 打包,以及 PostgreSQL 18.4 上首次 Flyway migrate 和重复 no-op。由于代码尚未整理提交到远端分支,本票据暂不关闭;提交可引用后再关闭。

实现状态更新:原生 Java/PostgreSQL 目录、PUBLIC/TENANT_OWNED 隔离、关联表题集顺序、嵌套题集题目 API、严格 ID 校验、敏感字段剥离及 V4020 Flyway migration 已在本地完成。验证包括 82 项聚焦测试、server clean compile、migration 打包,以及 PostgreSQL 18.4 上首次 Flyway migrate 和重复 no-op。由于代码尚未整理提交到远端分支,本票据暂不关闭;提交可引用后再关闭。
Sign in to join this conversation.
No description provided.