Skip to content
This repository was archived by the owner on Dec 18, 2022. It is now read-only.

Database Scheme Design, Draft 3

renfeisong edited this page Nov 19, 2014 · 6 revisions

重要说明:系统级的表只包括用户表user、管理员表admin_user和配置表configuration。其他表均属于某个功能模块。各开发人员在开发模块时,要能够动态创建数据表(可在prepare函数中检测表是否存在,存在的话直接使用,否则就地创建)。

系统级表

table: user

user 表整合了和关注者(主要是学生)的个人信息

  1. id (PK,A_I)
  2. userId (学号或职工号, e.g. 12211010)
  3. userName (姓名, e.g. 荣芓萌)
  4. gender (性别, e.g. 男)
  5. identifyId (身份证号, e.g. 120107198912282561)
  6. openid (微信 Open ID, e.g. o_EXRjkVmOiYakBTzJAnH5x0uMF8)
  7. type (类型,可取学生student,教师teacher,辅导员admin,其他special)
  8. startYear (入学年份, e.g. 2012)
  9. dept (所属的系的编号, e.g. 21)
  10. class (小班号, e.g. 122111)
  11. birthday (出生日期, 格式 YYYYMMDD, e.g. 19921004)
  12. phoneNumber (手机号, e.g. 18612345678)
  13. email (邮件地址, e.g. person@example.com)
  14. qq (QQ, e.g. 10000)

table: configuration

configuration 是存储配置信息的表,同时为 Configuration API 提供支持。

  1. scope (作用域, global 表示全局, 否则应为某一 Module 的名称, PK)
  2. key (键, PK)
  3. value (值)
  4. dateUpdated (更新时间, timestamp 类型, update_on_default)

table: admin_user

admin_user 表保存管理后台的用户信息。

  1. userName (用户名, PK)
  2. hashedPassword (密码)
  3. isEnabled (是否启用, int, 取 0 或 1, 默认为 0)
  4. joinDate (加入时间, timestamp)
  5. lastActivity (上次活动时间, timestamp)
  6. authorizedPages (已授权的页面, varchar, JSON-formatted array)
  7. isSuperAdmin (是否是超级管理员, int, 取 0 或 1, 默认为 0)
  8. note (备注, varchar)
  9. ip (IP地址, 用于登陆验证)
  10. loginToken (登陆凭据, 保存在 cookie 中, 用于登陆验证)

模块级表

table: homework

homework 用于保存作业信息。应用时建立多张表如 homework_1221 等。

  1. homeworkId (PK, A_I)
  2. subject (科目, e.g. 语文)
  3. content (内容, e.g. 阅读课文《荷塘月色》)
  4. userName (FK, 发布人)
  5. publishDate (作业布置日期, 格式 YYYYMMDD, e.g. 20141010)
  6. dueDate (作业提交/过期日期, 格式 YYYYMMDD, e.g. 20141017)
  7. dateUpdated (更新时间, timestamp)

table:shahe_schedule

shahe_schedule 表记录沙河校区的作息时间

  1. id (PK, A_I)
  2. cid (课程时间顺序, 第一节课 e.g. 1)
  3. startTime (开始时间, 单位分钟, e.g. 480, 即早上8点)
  4. endTime (结束时间, 单位分钟, e.g. 530, 即早上8点50分)

table:xueyuan_schedule

xueyuan_schedule 表记录学院路校区的作息时间

  1. id (PK, A_I)
  2. cid (课程时间顺序, 第一节课 e.g. 1)
  3. startTime (开始时间, 单位分钟, e.g. 480, 即早上8点)
  4. endTime (结束时间, 单位分钟, e.g. 530, 即早上8点50分)

table:class_schedule

class_schedule 表记录所有的课程信息

  1. weekday (星期几 e.g. 1 PK)
  2. classification (年纪 e.g. 1221 PK)
  3. class_1 (第一节[大]课信息 e.g. 英语口语 J1-101#s1e2k3j4g5)
  4. class_2 (第二节[大]课信息 e.g. C++ J1-101#s3e4k3j4g5)
  5. ......
Clone this wiki locally