CREATE TABLE "public"."t_crawler_book" (
  "book_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "book_name" varchar(255) COLLATE "pg_catalog"."default",
  "scheme_id" varchar(255) COLLATE "pg_catalog"."default",
  "subject_id" varchar(255) COLLATE "pg_catalog"."default",
  "stage_id" varchar(255) COLLATE "pg_catalog"."default",
  "id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL
)
;
COMMENT ON COLUMN "public"."t_crawler_book"."book_id" IS '册ID';
COMMENT ON COLUMN "public"."t_crawler_book"."book_name" IS '册的名称';
COMMENT ON COLUMN "public"."t_crawler_book"."scheme_id" IS '版本ID，比如人教版本ID,与t_crawler_scheme表中的scheme_id关联';
COMMENT ON COLUMN "public"."t_crawler_book"."subject_id" IS '科目id,与t_crawler_subject中的subject_id关联';
COMMENT ON COLUMN "public"."t_crawler_book"."stage_id" IS '学段ID，与t_crawler_stage中的stage_id关联';
COMMENT ON COLUMN "public"."t_crawler_book"."id" IS '主键，无实际意义';
COMMENT ON TABLE "public"."t_crawler_book" IS '课程章节目录中的册概念，比如三年级上册，四年级下册';

CREATE TABLE "public"."t_crawler_scheme" (
  "scheme_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "scheme_name" varchar(255) COLLATE "pg_catalog"."default",
  "subject_id" varchar(255) COLLATE "pg_catalog"."default",
  "stage_id" varchar(255) COLLATE "pg_catalog"."default",
  "id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL
)
;
COMMENT ON COLUMN "public"."t_crawler_scheme"."scheme_id" IS '版本ID';
COMMENT ON COLUMN "public"."t_crawler_scheme"."scheme_name" IS '版本名称';
COMMENT ON COLUMN "public"."t_crawler_scheme"."subject_id" IS '学科ID';
COMMENT ON COLUMN "public"."t_crawler_scheme"."stage_id" IS '学段ID';
COMMENT ON COLUMN "public"."t_crawler_scheme"."id" IS '主键';
COMMENT ON TABLE "public"."t_crawler_scheme" IS '教材版本，目前一般一个学科一个版本';


-- ----------------------------
-- Table structure for t_crawler_lesson
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_crawler_lesson";
CREATE TABLE "public"."t_crawler_lesson" (
  "lesson_id" varchar(255) COLLATE "pg_catalog"."default",
  "lesson_name" varchar(255) COLLATE "pg_catalog"."default",
  "node_id" varchar(255) COLLATE "pg_catalog"."default",
  "teacher_id" varchar(255) COLLATE "pg_catalog"."default",
  "teacher_name" varchar(255) COLLATE "pg_catalog"."default",
  "teacher_school_id" varchar(255) COLLATE "pg_catalog"."default",
  "teacher_school_name" varchar(255) COLLATE "pg_catalog"."default",
  "id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "book_id" varchar(255) COLLATE "pg_catalog"."default",
  "scheme_id" varchar(255) COLLATE "pg_catalog"."default",
  "subject_id" varchar(255) COLLATE "pg_catalog"."default",
  "stage_id" varchar(255) COLLATE "pg_catalog"."default",
  "preview_count" int4 DEFAULT 0,
  "learning_person_count" int4 DEFAULT 0,
  "learning_person_times" int4 DEFAULT 0,
  "grade_code" varchar(255) COLLATE "pg_catalog"."default",
  "publish_time" date,
  "node_type" int2 DEFAULT 1,
  "gather_regionc" varchar(255) COLLATE "pg_catalog"."default",
  "school_running_type" varchar(255) COLLATE "pg_catalog"."default",
  "stage_name" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."t_crawler_lesson"."lesson_id" IS '课程ID';
COMMENT ON COLUMN "public"."t_crawler_lesson"."lesson_name" IS '课程名称';
COMMENT ON COLUMN "public"."t_crawler_lesson"."node_id" IS '隶属哪个章节目录节点，关联t_crawler_structure中的node_id';
COMMENT ON COLUMN "public"."t_crawler_lesson"."teacher_id" IS '教师ID';
COMMENT ON COLUMN "public"."t_crawler_lesson"."teacher_name" IS '教师姓名';
COMMENT ON COLUMN "public"."t_crawler_lesson"."teacher_school_id" IS '教师学校ID,这个无用，处理关联学校时，使用t_crawler_lesson_school表';
COMMENT ON COLUMN "public"."t_crawler_lesson"."teacher_school_name" IS '教师学校名称';
COMMENT ON COLUMN "public"."t_crawler_lesson"."id" IS '主键';
COMMENT ON COLUMN "public"."t_crawler_lesson"."book_id" IS '册ID';
COMMENT ON COLUMN "public"."t_crawler_lesson"."scheme_id" IS '版本ID';
COMMENT ON COLUMN "public"."t_crawler_lesson"."preview_count" IS '预览次数';
COMMENT ON COLUMN "public"."t_crawler_lesson"."learning_person_count" IS '学习人数';
COMMENT ON COLUMN "public"."t_crawler_lesson"."learning_person_times" IS '学习人次';
COMMENT ON COLUMN "public"."t_crawler_lesson"."grade_code" IS '学段代码';
COMMENT ON COLUMN "public"."t_crawler_lesson"."publish_time" IS '发布时间';
COMMENT ON COLUMN "public"."t_crawler_lesson"."node_type" IS '节点类型 1：章节目录 2：知识点';
COMMENT ON COLUMN "public"."t_crawler_lesson"."gather_regionc" IS '行政区域名称';
COMMENT ON COLUMN "public"."t_crawler_lesson"."school_running_type" IS '学校类型';
COMMENT ON COLUMN "public"."t_crawler_lesson"."stage_name" IS '学段名称';
COMMENT ON TABLE "public"."t_crawler_lesson" IS '课程，resource资源表';


CREATE TABLE "public"."t_crawler_structure" (
  "node_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "node_name" varchar(255) COLLATE "pg_catalog"."default",
  "parent_id" varchar(255) COLLATE "pg_catalog"."default",
  "is_leaf" int2,
  "book_id" varchar(255) COLLATE "pg_catalog"."default",
  "scheme_id" varchar(255) COLLATE "pg_catalog"."default",
  "subject_id" varchar(255) COLLATE "pg_catalog"."default",
  "stage_id" varchar(255) COLLATE "pg_catalog"."default",
  "id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL
)
;
COMMENT ON COLUMN "public"."t_crawler_structure"."node_id" IS '章节目录结点ID';
COMMENT ON COLUMN "public"."t_crawler_structure"."node_name" IS '章节目录结点名称';
COMMENT ON COLUMN "public"."t_crawler_structure"."parent_id" IS '章节目录父结点ID';
COMMENT ON COLUMN "public"."t_crawler_structure"."is_leaf" IS '是不是叶子节点';
COMMENT ON COLUMN "public"."t_crawler_structure"."book_id" IS '哪一册，关联t_crawler_book表中的book_id';
COMMENT ON COLUMN "public"."t_crawler_structure"."scheme_id" IS '版本ID，关联t_crawler_scheme的scheme_id';
COMMENT ON COLUMN "public"."t_crawler_structure"."subject_id" IS '科目ID，关联t_crawler_subject中的subject_id';
COMMENT ON COLUMN "public"."t_crawler_structure"."stage_id" IS '学段ID,关联t_crawler_stage中的stage_id';
COMMENT ON COLUMN "public"."t_crawler_structure"."id" IS '主键';
COMMENT ON TABLE "public"."t_crawler_structure" IS 'stage-subject-scheme-book-structure-resource';

DROP TABLE IF EXISTS "public"."t_crawler_structure_knowledge";
CREATE TABLE "public"."t_crawler_structure_knowledge" (
  "id" int4 NOT NULL DEFAULT nextval('t_crawler_structure_knowledge_id_seq'::regclass),
  "title" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "parent_id" varchar(50) COLLATE "pg_catalog"."default",
  "is_leaf" bool,
  "node_id" varchar(50) COLLATE "pg_catalog"."default",
  "sort" int4,
  "stage_id" varchar(10) COLLATE "pg_catalog"."default",
  "stage_name" varchar(50) COLLATE "pg_catalog"."default",
  "subject_id" varchar(10) COLLATE "pg_catalog"."default",
  "subject_name" varchar(50) COLLATE "pg_catalog"."default",
  "created_at" timestamp(6) DEFAULT CURRENT_TIMESTAMP
)
;
COMMENT ON COLUMN "public"."t_crawler_structure_knowledge"."id" IS '主键';
COMMENT ON COLUMN "public"."t_crawler_structure_knowledge"."title" IS '知识点名称';
COMMENT ON COLUMN "public"."t_crawler_structure_knowledge"."parent_id" IS '父ID';
COMMENT ON COLUMN "public"."t_crawler_structure_knowledge"."is_leaf" IS '是不是叶子';
COMMENT ON COLUMN "public"."t_crawler_structure_knowledge"."node_id" IS '知识点ID';
COMMENT ON COLUMN "public"."t_crawler_structure_knowledge"."sort" IS '排序号';
COMMENT ON COLUMN "public"."t_crawler_structure_knowledge"."stage_id" IS '学段ID';
COMMENT ON COLUMN "public"."t_crawler_structure_knowledge"."stage_name" IS '学段名称';
COMMENT ON COLUMN "public"."t_crawler_structure_knowledge"."subject_id" IS '科目ID';
COMMENT ON COLUMN "public"."t_crawler_structure_knowledge"."subject_name" IS '科目名称';

特别注意：
1、如果用户需要检索科目，比如语文，数学，需要先到
 select subject_id from t_crawler_subject where subject_name='语文'
 用得到subject_id再与其它表进行关联查询，不要直接使用科目名称进行查询。
