ecs-section-requirements.md 17 KB

功能需求规格文档 — ECS 课表管理

本文档描述 ECS 电子班牌模块「课表管理」功能的完整需求规格。 技能将根据此文档生成后端 + 前端代码。


1. 基础信息

属性
功能中文名 课表管理
功能简写 section
所属模块 ruoyi-modules/ruoyi-ecs
主表名 t_ecs_section
从表名
是否多租户
数据库类型 kingbase(人大金仓)
描述 管理课表信息,数据由第三方同步或平台录入,支持查看、查询、导出,第三方数据禁止编辑删除

2. 接口清单

2.1 主表接口

接口 HTTP 路径(后端) 前端路径 权限字符
列表 GET /section/list /ecs/section/list ecs:section:list
详情 GET /section/{id} /ecs/section/{id} ecs:section:query
导出数据 POST /section/export /ecs/section/export ecs:section:export

说明:课表数据由第三方同步或平台录入,本模块提供查看、查询、导出功能。暂不提供新增、编辑、删除接口。

2.2 补充接口


3. 字段属性速查表

属性 含义 可选值 说明
fieldName 字段名(驼峰) 代码变量名
columnName 列名(下划线) 数据库列名
fieldType Java类型 String/Long/Integer/BigDecimal/Date
inDb 是否在表中存在 true/false false=纯前端计算字段
inTable 列表是否显示 true/false 生成表格列
inQuery 是否查询字段 true/false 生成搜索条件
queryType 查询方式 eq/like/between 精确/模糊/范围
inForm 是否表单字段 true/false 生成表单项
inAdd 新增表单显示 true/false
inEdit 编辑表单显示 true/false
required 是否必填 true/false 生成校验注解
dictType 字典类型 字典标识 有值=字典下拉,否则普通输入
relation 关联选择配置 对象 有值=弹出选择框
component 前端组件类型 input/select/inputNumber/datetime/textarea 默认根据类型推断
width 表格列宽 数字(px) 默认auto
sort 排序 数字 越小越靠前
excelExport Excel导出 true/false 默认true
lockRule 操作锁定规则 对象 有值=按此字段值控制行级操作权限

4. 字段清单

4.1 主表 t_ecs_section

fields:
  # ---------- 主键 ----------
  - fieldName: sectionId
    columnName: section_id
    fieldType: Long
    inDb: true
    inTable: false
    inForm: false
    remark: 主键,详情时传递

  # ---------- 课程关联 ----------
  - fieldName: courseId
    columnName: course_id
    fieldType: Long
    inDb: true
    inTable: false
    inQuery: false
    inForm: false
    remark: 课程Id

  - fieldName: courseName
    columnName: course_name
    fieldType: String
    inDb: true
    inTable: true
    inQuery: false
    inForm: false
    component: input
    width: 150
    sort: 2
    excelExport: true
    remark: 课程名称(冗余存储)

  # ---------- 班级关联 ----------
  - fieldName: classId
    columnName: class_id
    fieldType: Long
    inDb: true
    inTable: false
    inQuery: false
    inForm: false
    remark: 班级Id

  - fieldName: className
    columnName: class_name
    fieldType: String
    inDb: true
    inTable: true
    inQuery: true
    queryType: like
    inForm: false
    component: input
    width: 150
    sort: 1
    excelExport: true
    remark: 班级名称(冗余存储)

  # ---------- 教室关联 ----------
  - fieldName: roomId
    columnName: room_id
    fieldType: Long
    inDb: true
    inTable: false
    inQuery: false
    inForm: false
    remark: 教室Id

  - fieldName: roomName
    columnName: room_name
    fieldType: String
    inDb: true
    inTable: true
    inQuery: true
    queryType: like
    inForm: false
    component: input
    width: 150
    sort: 3
    excelExport: true
    remark: 教室名称(冗余存储)

  # ---------- 学期信息 ----------
  - fieldName: academicYear
    columnName: academic_year
    fieldType: String
    inDb: true
    inTable: true
    inQuery: true
    queryType: eq
    inForm: false
    component: input
    width: 120
    sort: 4
    excelExport: true
    remark: 学年,如 2025-2026

  - fieldName: semester
    columnName: semester
    fieldType: Integer
    inDb: true
    inTable: true
    inQuery: true
    queryType: eq
    inForm: false
    component: select
    width: 80
    sort: 5
    excelExport: true
    remark: 学期:1-第一学期,2-第二学期

  # ---------- 排课信息 ----------
  - fieldName: courseDate
    columnName: course_date
    fieldType: Date
    inDb: true
    inTable: true
    inQuery: true
    queryType: between
    inForm: false
    component: datetime
    width: 120
    sort: 6
    excelExport: true
    remark: 上课日期

  - fieldName: weekday
    columnName: weekday
    fieldType: Integer
    inDb: true
    inTable: true
    inQuery: false
    inForm: false
    component: inputNumber
    width: 80
    sort: 7
    excelExport: true
    remark: 星期 1-7(周一至周日)

  - fieldName: timeSlot
    columnName: time_slot
    fieldType: Integer
    inDb: true
    inTable: true
    inQuery: false
    inForm: false
    dictType: ecs_time_slot
    component: select
    width: 100
    sort: 8
    excelExport: true
    remark: 上课时段:0-上午,1-下午,2-晚上

  - fieldName: sectionIndex
    columnName: section_index
    fieldType: Integer
    inDb: true
    inTable: true
    inQuery: false
    inForm: false
    component: inputNumber
    width: 80
    sort: 9
    excelExport: true
    remark: 课程节次,一天的第几节课

  - fieldName: startSection
    columnName: start_section
    fieldType: Integer
    inDb: true
    inTable: true
    inQuery: false
    inForm: false
    component: inputNumber
    width: 80
    sort: 10
    excelExport: true
    remark: 连课节次

  - fieldName: sectionCount
    columnName: section_count
    fieldType: Integer
    inDb: true
    inTable: true
    inQuery: false
    inForm: false
    component: inputNumber
    width: 80
    sort: 11
    excelExport: true
    remark: 占用节次,默认1

  - fieldName: sectionLList
    columnName: section_l_list
    fieldType: String
    inDb: true
    inTable: true
    inQuery: false
    inForm: false
    component: input
    width: 100
    sort: 12
    excelExport: true
    remark: 占用列表,JSON格式如[2,3]

  - fieldName: startTime
    columnName: start_time
    fieldType: Date
    inDb: true
    inTable: true
    inQuery: false
    inForm: false
    component: datetime
    width: 100
    sort: 13
    excelExport: true
    remark: 开始时间

  - fieldName: endTime
    columnName: end_time
    fieldType: Date
    inDb: true
    inTable: true
    inQuery: false
    inForm: false
    component: datetime
    width: 100
    sort: 14
    excelExport: true
    remark: 结束时间

  # ---------- 考勤标记 ----------
  - fieldName: isAttend
    columnName: is_attend
    fieldType: Integer
    inDb: true
    inTable: true
    inQuery: false
    inForm: false
    component: select
    width: 80
    sort: 15
    excelExport: true
    remark: 是否考勤:0-否,1-是

  # ---------- 第三方同步字段 ----------
  - fieldName: otherId
    columnName: other_id
    fieldType: String
    inDb: true
    inTable: false
    inQuery: false
    inForm: false
    excelExport: false
    remark: 第三方课表Id

  - fieldName: dataSource
    columnName: data_source
    fieldType: Integer
    inDb: true
    inTable: false
    inQuery: false
    inForm: false
    dictType: data_source
    component: select
    lockRule:
      lockValue: 1
      lockActions:
        - edit
        - delete
      tip: 第三方数据不可操作
    excelExport: true
    remark: 数据来源:0-平台录入,1-第三方同步

  - fieldName: courseOtherId
    columnName: course_other_id
    fieldType: String
    inDb: true
    inTable: false
    inQuery: false
    inForm: false
    excelExport: false
    remark: 第三方课程Id

  - fieldName: classOtherId
    columnName: class_other_id
    fieldType: String
    inDb: true
    inTable: false
    inQuery: false
    inForm: false
    excelExport: false
    remark: 第三方班级Id

  - fieldName: roomOtherId
    columnName: room_other_id
    fieldType: String
    inDb: true
    inTable: false
    inQuery: false
    inForm: false
    excelExport: false
    remark: 第三方教室Id

  # ---------- 公共字段(所有表统一包含,多租户表增加 tenant_id) ----------
  # 通用字段定义(无需在字段清单中重复写,建表时自动追加):
  # | 字段          | Java类型        | 说明               |
  # | ------------- | --------------- | ------------------ |
  # | del_flag      | Integer         | 逻辑删除:0-未删除,1-已删除 |
  # | create_dept   | Long            | 创建部门             |
  # | create_by     | Long            | 创建者              |
  # | create_time   | Date            | 创建时间             |
  # | update_by     | Long            | 最后修改者            |
  # | update_time   | Date            | 最后修改时间           |
  # | tenant_id     | Long            | 租户ID(多租户表包含)    |

  - fieldName: delFlag
    columnName: del_flag
    fieldType: Integer
    inDb: true
    inTable: false
    inForm: false

  - fieldName: createTime
    columnName: create_time
    fieldType: Date
    inDb: true
    inTable: false
    inQuery: false
    inForm: false
    component: datetime

5. VO 结构

5.1 主表列表 VO

EcsSectionVo:
  - sectionId          # 主键
  - className          # 班级名称
  - courseName         # 课程名称
  - roomName           # 教室名称
  - courseDate         # 上课日期
  - timeSlot           # 上课时段
  - sectionIndex       # 课程节次
  - startSection       # 连课节次
  - sectionCount       # 占用节次
  - sectionLList       # 占用列表
  - startTime          # 开始时间
  - endTime            # 结束时间
  - isAttend           # 是否考勤
  - dataSource         # 数据来源(lockRule需要,前端判断操作权限)

6. 特殊需求

special:
  excelImport: false       # 不支持导入
  excelExport: true        # 支持导出

  # 本模块仅提供查看、查询、导出功能,暂不提供新增、编辑、删除
  # data_source=1 时第三方数据禁止编辑和删除(预留 lockRule,后续开放编辑删除接口时生效)
  lockRule:
    field: dataSource
    lockValue: 1
    lockActions:
      - edit
      - delete
    tip: 第三方数据不可操作

  dubboExpose: false       # 不暴露 Dubbo 服务

7. 字典项

字典类型 枚举值 说明
ecs_time_slot 0=上午, 1=下午, 2=晚上 上课时段
data_source 0=平台录入, 1=第三方同步 数据来源

8. 建表语句

通用字段:所有表统一包含以下字段(建表语句自动追加,无需在字段清单中重复):

字段 类型 说明
del_flag character(1 char) 逻辑删除:0-未删除,1-已删除
create_dept bigint 创建部门
create_by bigint 创建者
create_time timestamp 创建时间
update_by bigint 更新者
update_time timestamp 更新时间
tenant_id bigint 租户ID(多租户表)

8.1 主表 t_ecs_section

-- ============================================
-- ECS 课表信息表(kingbase/人大金仓)
-- ============================================
CREATE TABLE "dbo"."t_ecs_section" (
  "section_id" bigint NOT NULL,
  "course_id" bigint NOT NULL,
  "class_id" bigint NOT NULL,
  "room_id" bigint NOT NULL,
  "course_name" character varying(200 char) NOT NULL DEFAULT ''::varchar,
  "class_name" character varying(200 char) NOT NULL DEFAULT ''::varchar,
  "room_name" character varying(200 char) NOT NULL DEFAULT ''::varchar,
  "academic_year" character varying(20 char) NOT NULL DEFAULT ''::varchar,
  "semester" integer NOT NULL DEFAULT 1,
  "course_date" timestamp NOT NULL,
  "weekday" integer NOT NULL DEFAULT 1,
  "time_slot" integer NOT NULL DEFAULT 0,
  "section_index" integer NOT NULL DEFAULT 1,
  "start_section" integer NOT NULL DEFAULT 1,
  "section_count" integer NOT NULL DEFAULT 1,
  "section_l_list" character varying(500 char) DEFAULT ''::varchar,
  "start_time" timestamp,
  "end_time" timestamp,
  "is_attend" integer NOT NULL DEFAULT 0,
  "other_id" character varying(100 char) DEFAULT ''::varchar,
  "data_source" integer NOT NULL DEFAULT 0,
  "course_other_id" character varying(100 char) DEFAULT ''::varchar,
  "class_other_id" character varying(100 char) DEFAULT ''::varchar,
  "room_other_id" character varying(100 char) DEFAULT ''::varchar,
  -- 通用字段(自动追加)
  "del_flag" character(1 char) NOT NULL DEFAULT '0'::bpchar,
  "create_dept" bigint,
  "create_by" bigint,
  "create_time" timestamp,
  "update_by" bigint,
  "update_time" timestamp,
  "tenant_id" bigint,
  CONSTRAINT "t_ecs_section_pkey" PRIMARY KEY ("section_id")
);

-- 表注释
ALTER TABLE "dbo"."t_ecs_section" COMMENT 'ECS课表信息表';

-- 列注释
ALTER TABLE "dbo"."t_ecs_section" MODIFY "section_id" COMMENT '主键';
ALTER TABLE "dbo"."t_ecs_section" MODIFY "course_id" COMMENT '课程Id';
ALTER TABLE "dbo"."t_ecs_section" MODIFY "class_id" COMMENT '班级Id';
ALTER TABLE "dbo"."t_ecs_section" MODIFY "room_id" COMMENT '教室Id';
ALTER TABLE "dbo"."t_ecs_section" MODIFY "course_name" COMMENT '课程名称';
ALTER TABLE "dbo"."t_ecs_section" MODIFY "class_name" COMMENT '班级名称';
ALTER TABLE "dbo"."t_ecs_section" MODIFY "room_name" COMMENT '教室名称';
ALTER TABLE "dbo"."t_ecs_section" MODIFY "academic_year" COMMENT '学年';
ALTER TABLE "dbo"."t_ecs_section" MODIFY "semester" COMMENT '学期:1-第一学期,2-第二学期';
ALTER TABLE "dbo"."t_ecs_section" MODIFY "course_date" COMMENT '上课日期';
ALTER TABLE "dbo"."t_ecs_section" MODIFY "weekday" COMMENT '星期 1-7(周一至周日)';
ALTER TABLE "dbo"."t_ecs_section" MODIFY "time_slot" COMMENT '上课时段:0-上午,1-下午,2-晚上';
ALTER TABLE "dbo"."t_ecs_section" MODIFY "section_index" COMMENT '课程节次';
ALTER TABLE "dbo"."t_ecs_section" MODIFY "start_section" COMMENT '连课节次';
ALTER TABLE "dbo"."t_ecs_section" MODIFY "section_count" COMMENT '占用节次';
ALTER TABLE "dbo"."t_ecs_section" MODIFY "section_l_list" COMMENT '占用列表,JSON格式如[2,3]';
ALTER TABLE "dbo"."t_ecs_section" MODIFY "start_time" COMMENT '开始时间';
ALTER TABLE "dbo"."t_ecs_section" MODIFY "end_time" COMMENT '结束时间';
ALTER TABLE "dbo"."t_ecs_section" MODIFY "is_attend" COMMENT '是否考勤:0-否,1-是';
ALTER TABLE "dbo"."t_ecs_section" MODIFY "other_id" COMMENT '第三方课表Id';
ALTER TABLE "dbo"."t_ecs_section" MODIFY "data_source" COMMENT '数据来源:0-平台录入,1-第三方同步';
ALTER TABLE "dbo"."t_ecs_section" MODIFY "course_other_id" COMMENT '第三方课程Id';
ALTER TABLE "dbo"."t_ecs_section" MODIFY "class_other_id" COMMENT '第三方班级Id';
ALTER TABLE "dbo"."t_ecs_section" MODIFY "room_other_id" COMMENT '第三方教室Id';

-- 索引
CREATE INDEX "idx_ecs_section_class_id" ON "dbo"."t_ecs_section" ("class_id");
CREATE INDEX "idx_ecs_section_course_id" ON "dbo"."t_ecs_section" ("course_id");
CREATE INDEX "idx_ecs_section_room_id" ON "dbo"."t_ecs_section" ("room_id");
CREATE INDEX "idx_ecs_section_course_date" ON "dbo"."t_ecs_section" ("course_date");
CREATE INDEX "idx_ecs_section_academic_year" ON "dbo"."t_ecs_section" ("academic_year", "semester");
CREATE INDEX "idx_ecs_section_data_source" ON "dbo"."t_ecs_section" ("data_source");

9. 备注

  1. 数据冗余设计:课程名称(courseName)、班级名称(className)、教室名称(roomName)采用冗余存储策略,单表无关联查询,提升查询性能。当课程/班级/教室信息变更时需考虑是否同步更新历史记录。
  2. 只读模型:课表数据主要由第三方同步或平台录入,当前版本仅提供查看、查询、导出功能,不支持新增、编辑、删除操作。
  3. lockRule 预留dataSource=1 时锁定编辑和删除操作。当前版本虽无编辑删除接口,但 lockRule 配置已预留,后续开放增删改接口时即可生效。
  4. JSON字段sectionLList 存储占用列表,格式为 JSON 数组(如 [2,3]),Java 端使用 String 类型存储,前端负责解析展示。
  5. 单表设计courseIdclassIdroomId 仅存储 ID 值,不配置关联选择器,名称字段冗余存储。
  6. 第三方字段otherIdcourseOtherIdclassOtherIdroomOtherId 用于第三方系统数据映射,不显示在列表和表单中。
  7. 原始需求中列表字段"推送状态"不在数据结构中,已从显示字段中移除。如需推送状态字段请后续补充。