-- ============================================================================
-- 教育培训模块缺失表 DDL（5 张）
-- 数据库: PostgreSQL / 瀚高
-- Schema: slaj
-- ============================================================================

-- 1. 培训记录表（通用）
CREATE TABLE slaj.bis_eutr_rec (
    guid        VARCHAR(64)  PRIMARY KEY,
    cour_guid   VARCHAR(64),
    plan_guid   VARCHAR(64),
    tr_time     VARCHAR(30),
    tr_addr     VARCHAR(200),
    tr_cont     TEXT,
    tr_type     VARCHAR(20),
    tr_stat     VARCHAR(20),
    org_guid    VARCHAR(64),
    teac_name   VARCHAR(100),
    tr_pers_num VARCHAR(20),
    note        TEXT,
    coll_time   VARCHAR(30),
    upd_time    VARCHAR(30),
    rec_pers    VARCHAR(100),
    to_date     VARCHAR(30)
);

COMMENT ON TABLE  slaj.bis_eutr_rec                    IS '培训记录表（通用）';
COMMENT ON COLUMN slaj.bis_eutr_rec.guid               IS '主键';
COMMENT ON COLUMN slaj.bis_eutr_rec.cour_guid          IS '课程guid';
COMMENT ON COLUMN slaj.bis_eutr_rec.plan_guid          IS '计划guid';
COMMENT ON COLUMN slaj.bis_eutr_rec.tr_time            IS '培训时间';
COMMENT ON COLUMN slaj.bis_eutr_rec.tr_addr            IS '培训地点';
COMMENT ON COLUMN slaj.bis_eutr_rec.tr_cont            IS '培训内容';
COMMENT ON COLUMN slaj.bis_eutr_rec.tr_type            IS '培训类型';
COMMENT ON COLUMN slaj.bis_eutr_rec.tr_stat            IS '培训状态';
COMMENT ON COLUMN slaj.bis_eutr_rec.org_guid           IS '组织单位';
COMMENT ON COLUMN slaj.bis_eutr_rec.teac_name          IS '讲师';
COMMENT ON COLUMN slaj.bis_eutr_rec.tr_pers_num        IS '参训人数';
COMMENT ON COLUMN slaj.bis_eutr_rec.note               IS '备注';
COMMENT ON COLUMN slaj.bis_eutr_rec.coll_time          IS '采集时间';
COMMENT ON COLUMN slaj.bis_eutr_rec.upd_time           IS '更新时间';
COMMENT ON COLUMN slaj.bis_eutr_rec.rec_pers           IS '记录人员';
COMMENT ON COLUMN slaj.bis_eutr_rec.to_date            IS '属性终止时间';

-- 2. 考试策略配置表
CREATE TABLE slaj.bis_eutr_exam_stra (
    guid        VARCHAR(64)  PRIMARY KEY,
    exam_guid   VARCHAR(64),
    stra_name   VARCHAR(200),
    stra_type   VARCHAR(20),
    eq_num      VARCHAR(10),
    eq_score    VARCHAR(10),
    note        TEXT,
    coll_time   VARCHAR(30),
    upd_time    VARCHAR(30),
    rec_pers    VARCHAR(100)
);

COMMENT ON TABLE  slaj.bis_eutr_exam_stra              IS '考试策略配置表（抽题规则等）';
COMMENT ON COLUMN slaj.bis_eutr_exam_stra.guid         IS '主键';
COMMENT ON COLUMN slaj.bis_eutr_exam_stra.exam_guid    IS '考试guid';
COMMENT ON COLUMN slaj.bis_eutr_exam_stra.stra_name    IS '策略名称';
COMMENT ON COLUMN slaj.bis_eutr_exam_stra.stra_type    IS '策略类型（随机抽题/固定题目）';
COMMENT ON COLUMN slaj.bis_eutr_exam_stra.eq_num       IS '抽题数量';
COMMENT ON COLUMN slaj.bis_eutr_exam_stra.eq_score     IS '每题分值';
COMMENT ON COLUMN slaj.bis_eutr_exam_stra.note         IS '备注';
COMMENT ON COLUMN slaj.bis_eutr_exam_stra.coll_time    IS '采集时间';
COMMENT ON COLUMN slaj.bis_eutr_exam_stra.upd_time     IS '更新时间';
COMMENT ON COLUMN slaj.bis_eutr_exam_stra.rec_pers     IS '记录人员';

-- 3. 考试题目选项表
CREATE TABLE slaj.bis_eutr_tque_opt (
    guid        VARCHAR(64)  PRIMARY KEY,
    eq_guid     VARCHAR(64),
    opt_label   VARCHAR(10),
    opt_cont    TEXT,
    is_corr     VARCHAR(4),
    opt_sort    VARCHAR(10),
    note        TEXT
);

COMMENT ON TABLE  slaj.bis_eutr_tque_opt               IS '考试题目选项表';
COMMENT ON COLUMN slaj.bis_eutr_tque_opt.guid          IS '主键';
COMMENT ON COLUMN slaj.bis_eutr_tque_opt.eq_guid       IS '题目guid';
COMMENT ON COLUMN slaj.bis_eutr_tque_opt.opt_label     IS '选项标签(A/B/C/D)';
COMMENT ON COLUMN slaj.bis_eutr_tque_opt.opt_cont      IS '选项内容';
COMMENT ON COLUMN slaj.bis_eutr_tque_opt.is_corr       IS '是否正确答案(0/1)';
COMMENT ON COLUMN slaj.bis_eutr_tque_opt.opt_sort      IS '排序';
COMMENT ON COLUMN slaj.bis_eutr_tque_opt.note          IS '备注';

-- 4. 课程-试题关联表
CREATE TABLE slaj.bis_eutr_cour_to_eq (
    guid        VARCHAR(64)  PRIMARY KEY,
    cour_guid   VARCHAR(64),
    eq_guid     VARCHAR(64),
    sort        VARCHAR(10),
    note        TEXT
);

COMMENT ON TABLE  slaj.bis_eutr_cour_to_eq             IS '课程-试题关联表（课程试题分配）';
COMMENT ON COLUMN slaj.bis_eutr_cour_to_eq.guid        IS '主键';
COMMENT ON COLUMN slaj.bis_eutr_cour_to_eq.cour_guid   IS '课程guid';
COMMENT ON COLUMN slaj.bis_eutr_cour_to_eq.eq_guid     IS '试题guid';
COMMENT ON COLUMN slaj.bis_eutr_cour_to_eq.sort        IS '排序';
COMMENT ON COLUMN slaj.bis_eutr_cour_to_eq.note        IS '备注';

-- 5. 课程-科目关联表
CREATE TABLE slaj.bis_eutr_subject_of_cour (
    guid        VARCHAR(64)  PRIMARY KEY,
    cour_guid   VARCHAR(64),
    subj_guid   VARCHAR(64),
    subj_name   VARCHAR(200),
    sort        VARCHAR(10),
    note        TEXT
);

COMMENT ON TABLE  slaj.bis_eutr_subject_of_cour        IS '课程-科目关联表（课程所属科目）';
COMMENT ON COLUMN slaj.bis_eutr_subject_of_cour.guid   IS '主键';
COMMENT ON COLUMN slaj.bis_eutr_subject_of_cour.cour_guid IS '课程guid';
COMMENT ON COLUMN slaj.bis_eutr_subject_of_cour.subj_guid IS '科目guid';
COMMENT ON COLUMN slaj.bis_eutr_subject_of_cour.subj_name IS '科目名称';
COMMENT ON COLUMN slaj.bis_eutr_subject_of_cour.sort   IS '排序';
COMMENT ON COLUMN slaj.bis_eutr_subject_of_cour.note   IS '备注';
