浏览代码

v2.0 db product

huodongdong 7 年之前
父节点
当前提交
21beecfe35

+ 35 - 0
db/action/lj_event_log.md

@@ -0,0 +1,35 @@
+### lj_event_log table structure
+> 此表为用户行为
+
+
+| field | type | null | default | desc | extra |
+|----|:-----|:-------|:------|:-----|:-----|
+| id | bigint | no | | 主键 | pri |
+| user_id | bigint | yes | 0 | 用户id | |
+| merchant_id | bigint | yes | 0 | 渠道商id | |
+| event_type | int | no | | 事件类型 | |
+| tar_name | varchar(512) | yes | null | 目标名称 | |
+| tar_id | varchar(512) | yes | null | 目标id | |
+| value | bigint | no | 0 | 行为值 | |
+| platform | smallint | yes | null | | |
+| create_time | timestamp | no | now | 创建时间 | |
+| update_time | timestamp | no | create_time | 修改时间 | | |
+
+##### index
+
+##### create sql
+```
+CREATE TABLE `lj_event_log` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `user_id` bigint(16) DEFAULT NULL COMMENT '用户id',
+  `merchant_id` bigint(20) DEFAULT NULL COMMENT '渠道商',
+  `type` int NOT NULL COMMENT '事件类型',
+  `tar_name` varchar(512) DEFAULT NULL COMMENT '目标名称',
+  `tar_id` varchar(512) DEFAULT NULL COMMENT '目标id',
+  `value` bigint(20) DEFAULT 0 COMMENT '事件值',
+  `platform` smallint(6) DEFAULT NULL COMMENT '播放平台 TV APP ...',
+  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+```

+ 0 - 16
db/lj_combo_price.md

@@ -1,16 +0,0 @@
-### lj_combo_price table structure
-> 此表为课程包的出售价格
-
-
-| field | type | null | default | desc | extra |
-|----|:-----|:-------|:------|:-----|:-----|
-| id | bigint | no | | 主键 | pri |
-| combo_id | bigint | no | | 课程包id | |
-| type | int | no | | 类型 | |
-| price | double(16,2) | no | 0 | 价格 | |
-| status | smallint | no | | 状态 | |
-| create_time | smallint | no | now | 创建时间 | |
-| update_time | timestamp | no | now | 更新时间 | | |
-
-##### index
-> index item_id

+ 0 - 13
db/lj_course_lesson_relation.md

@@ -1,13 +0,0 @@
-### lj_course_lesson_relation table structure
-> 此表为课程与课的对应关系的数据结构
-
-
-| field | type | null | default | desc | extra |
-|----|:-----|:-------|:------|:-----|:-----|
-| id | bigint | no | | 主键 | pri |
-| cid | varchar(512) | no | | 课程编码 | |
-| lid | varchar(512) | no | | 课程编码 | |
-| create_time | smallint | no | now | 创建时间 | | |
-
-##### index
-> unique index on(cid, lid)

+ 0 - 13
db/lj_course_unit_relation.md

@@ -1,13 +0,0 @@
-### lj_course_unit_relation table structure
-> 此表为课程与单元的对应关系的数据结构
-
-
-| field | type | null | default | desc | extra |
-|----|:-----|:-------|:------|:-----|:-----|
-| id | bigint | no | | 主键 | pri |
-| cid | varchar(512) | no | | 课程编码 | |
-| uid | varchar(512) | no | | 单元编码 | |
-| create_time | smallint | no | now | 创建时间 | | |
-
-##### index
-> unique index on(cid, uid)

+ 1 - 1
db/lj_combo.md

@@ -9,9 +9,9 @@
 | name | varchar(1024) | yes | null | 课程名 | |
 | digest | text | yes | null | 课程摘要 | |
 | cv_img_ids | varchar(512) | yes | null | 封面图 | |
-| cost_price | double(16,2) | no | 0 | 成本价 | |
 | sale_price | double(16,2) | no | 0 | 渠道价格 | |
 | market_price | double(16,2) | no | 0 | 终端价格 | |
+| discount_price | double(16,2) | no| 0 | 折扣价 | |
 | sort | int | no | 0 | 排序字段 | |
 | status | smallint | no | | 状态 | |
 | create_time | smallint | no | now | 创建时间 | |

+ 2 - 0
db/lj_combo_item_relation.md

@@ -7,6 +7,8 @@
 | id | bigint | no | | 主键 | pri |
 | combo_id | bigint | no | | | |
 | item_id | bigint | no | | | |
+| type | smallint | no | | 出售价格类型 | |
+| price | double(16,2) | no | 0 | 课程在包内价格 | |
 | create_time | timestamp | no | now | 创建时间 | | |
 
 ##### index

+ 2 - 2
db/lj_course.md

@@ -5,7 +5,7 @@
 | field | type | null | default | desc | extra |
 |----|:-----|:-------|:------|:-----|:-----|
 | id | bigint | no | | 主键 | pri |
-| cid | varchar(512) | no | | 课程编码 | uni |
+| c_code | varchar(512) | no | | 课程编码 | uni |
 | name | varchar(1024) | yes | null | 课程名 | |
 | title | varchar(1024) | yes | null | 课程标题 | |
 | type | smallint | no | 0 | 课程类型,是否为单元 | |
@@ -19,4 +19,4 @@
 | update_time | timestamp | no | now | 更新时间 | | |
 
 ##### index
-> unique index cid
+> unique index c_code

+ 14 - 0
db/product/lj_course_sub_relation.md

@@ -0,0 +1,14 @@
+### lj_course_sub_relation table structure
+> 此表为课程与单元的对应关系的数据结构
+
+
+| field | type | null | default | desc | extra |
+|----|:-----|:-------|:------|:-----|:-----|
+| id | bigint | no | | 主键 | pri |
+| c_code | varchar(512) | no | | 课程编码 | |
+| t_code | varchar(512) | no | | 单元编码 | |
+| type | smallint | no | 0 | 类型, 0为课程与课对应关系, 1为课程与单元对应关系 | |
+| create_time | smallint | no | now | 创建时间 | | |
+
+##### index
+> unique index on(c_code, t_code)

+ 3 - 3
db/lj_course_support_relation.md

@@ -5,9 +5,9 @@
 | field | type | null | default | desc | extra |
 |----|:-----|:-------|:------|:-----|:-----|
 | id | bigint | no | | 主键 | pri |
-| cid | varchar(512) | no | | 课程编码 | |
-| sid | varchar(512) | no | | 周边编码 | |
+| c_code | varchar(512) | no | | 课程编码 | |
+| s_code | varchar(512) | no | | 周边编码 | |
 | create_time | smallint | no | now | 创建时间 | | |
 
 ##### index
-> unique index on(cid, sid)
+> unique index on(c_code, s_code)

+ 4 - 4
db/lj_item_tag_relation.md

@@ -1,13 +1,13 @@
-### lj_item_tag_relation table structure
+### lj_course_tag_relation table structure
 > 此表为课程或周边与标签的对应关系
 
 
 | field | type | null | default | desc | extra |
 |----|:-----|:-------|:------|:-----|:-----|
 | id | bigint | no | | 主键 | pri |
-| tag_id | bigint | no | | 标签id | |
-| item_id | varchar(512) | no | | 课程或周边id | |
+| tag_code |varchar(512) | no | | 标签编码 | |
+| c_code | varchar(512) | no | | 课程或周边编码 | |
 | create_time | timestamp | no | now | 创建时间 | | |
 
 ##### index
-> unique index (tag_id, item_id)
+> unique index (tag_code, c_code)

+ 2 - 3
db/lj_item.md

@@ -5,16 +5,15 @@
 | field | type | null | default | desc | extra |
 |----|:-----|:-------|:------|:-----|:-----|
 | id | bigint | no | | 主键 | pri |
-| oid | varchar(512) | no | | 课程编码/周边编码 | |
+| code | varchar(512) | no | | 课程编码/周边编码 | |
 | type | smallint | no | | 商品类型, 课程/周边 | |
 | merchant_id | bigint | no | | 渠道id | |
 | cost_price | double(16,2) | no | 0 | 成本价 | |
 | sale_price | double(16,2) | no | 0 | 渠道价格 | |
-| market_price | double(16,2) | no | 0 | 终端价格 | |
 | sort | int | no | 0 | 排序字段 | |
 | status | smallint | no | | 状态 | |
 | create_time | smallint | no | now | 创建时间 | |
 | update_time | timestamp | no | now | 更新时间 | | |
 
 ##### index
-> unique index (oid, merchant_id)
+> unique index (code, merchant_id)

+ 3 - 2
db/lj_item_price.md

@@ -5,12 +5,13 @@
 | field | type | null | default | desc | extra |
 |----|:-----|:-------|:------|:-----|:-----|
 | id | bigint | no | | 主键 | pri |
-| item_id | bigint | no | | 商品编码 | |
+| item_id | bigint | no | | 商品id |  |
 | type | int | no | | 类型 | |
+| name | varchar(512) | no | | 名称 | |
 | price | double(16,2) | no | 0 | 价格 | |
 | status | smallint | no | | 状态 | |
 | create_time | smallint | no | now | 创建时间 | |
 | update_time | timestamp | no | now | 更新时间 | | |
 
 ##### index
-> index item_id
+> index unique on(item_id, type)

+ 2 - 2
db/lj_lesson.md

@@ -5,7 +5,7 @@
 | field | type | null | default | desc | extra |
 |----|:-----|:-------|:------|:-----|:-----|
 | id | bigint | no | | 主键 | pri |
-| lid | varchar(512) | no | | 课编码 | uni |
+| l_code | varchar(512) | no | | 课编码 | uni |
 | title | varchar(1024) | yes | null | 标题 | |
 | digest | text | yes | null | 课摘要 | |
 | sort | int | no |  | tag排序 | |
@@ -14,4 +14,4 @@
 | update_time | timestamp | no | now | 更新时间 | |
 
 ##### index
-> unique index lid
+> unique index l_code

+ 3 - 3
db/lj_lesson_ware_relation.md

@@ -5,9 +5,9 @@
 | field | type | null | default | desc | extra |
 |----|:-----|:-------|:------|:-----|:-----|
 | id | bigint | no | | 主键 | pri |
-| lid | varchar(512) | no | | 课编码 | |
-| wid | varchar(512) | no | | 课件编码 | |
+| l_code | varchar(512) | no | | 课编码 | |
+| w_code | varchar(512) | no | | 课件编码 | |
 | create_time | timestamp | no | now | 创建时间 | | |
 
 ##### index
-> unique index on(lid, wid)
+> unique index on(l_code, w_code)

db/lj_price.md → db/product/lj_price.md


+ 2 - 2
db/lj_support.md

@@ -5,7 +5,7 @@
 | field | type | null | default | desc | extra |
 |----|:-----|:-------|:------|:-----|:-----|
 | id | bigint | no | | 主键 | pri |
-| sid | varchar(512) | no | | 周边编码 | uni |
+| s_code | varchar(512) | no | | 周边编码 | uni |
 | name | varchar(1024) | yes | null | 名 | |
 | title | varchar(1024) | yes | null | 标题 | |
 | type | smallint | no | 0 | 类型 | |
@@ -17,4 +17,4 @@
 | update_time | timestamp | no | now | 更新时间 | | |
 
 ##### index
-> unique index sid
+> unique index s_code

+ 3 - 3
db/lj_support_circle_relation.md

@@ -5,9 +5,9 @@
 | field | type | null | default | desc | extra |
 |----|:-----|:-------|:------|:-----|:-----|
 | id | bigint | no | | 主键 | pri |
-| fid | varchar(512) | no | | 课程编码 | |
-| tid | varchar(512) | no | | 课程编码 | |
+| f_code | varchar(512) | no | | 课程编码 | |
+| t_code | varchar(512) | no | | 课程编码 | |
 | create_time | smallint | no | now | 创建时间 | | |
 
 ##### index
-> unique index on(fid, tid)
+> unique index on(f_code, t_code)

+ 3 - 2
db/lj_tag.md

@@ -5,11 +5,12 @@
 | field | type | null | default | desc | extra |
 |----|:-----|:-------|:------|:-----|:-----|
 | id | bigint | no | | 主键 | pri |
-| name | varchar(256) | no | | 名字 | |
+| tag_code | varchar(512) | no | | 标签编码 |unique |
+| name | varchar(512) | no | | 名字 | |
 | sort | int | no |  | tag排序 | |
 | status | smallint | no | | 状态 | |
 | create_time | timestamp | no | now | 创建时间 | |
 | update_time | timestamp | no | now | 更新时间 | | |
 
 ##### index
-> unique index (name)
+> unique index (tag_code)

+ 2 - 2
db/lj_unit.md

@@ -5,7 +5,7 @@
 | field | type | null | default | desc | extra |
 |----|:-----|:-------|:------|:-----|:-----|
 | id | bigint | no | | 主键 | pri |
-| uid | varchar(512) | no | | 单元编码 | uni |
+| u_code | varchar(512) | no | | 单元编码 | uni |
 | title | varchar(1024) | yes | null | 单元标题 | |
 | digest | text | yes | null | 单元摘要 | |
 | sort | int | no |  | 排序 | |
@@ -14,4 +14,4 @@
 | update_time | timestamp | no | now | 更新时间 | | |
 
 ##### index
-> unique index uid
+> unique index u_code

+ 3 - 3
db/lj_unit_lesson_relation.md

@@ -5,9 +5,9 @@
 | field | type | null | default | desc | extra |
 |----|:-----|:-------|:------|:-----|:-----|
 | id | bigint | no | | 主键 | pri |
-| uid | varchar(512) | no | | 单元编码 | |
-| lid | varchar(512) | no | | 课程编码 | |
+| u_code | varchar(512) | no | | 单元编码 | |
+| l_code | varchar(512) | no | | 课程编码 | |
 | create_time | smallint | no | now | 创建时间 | | |
 
 ##### index
-> unique index on(uid, lid)
+> unique index on(u_code, l_code)

+ 3 - 2
db/lj_ware.md

@@ -5,14 +5,15 @@
 | field | type | null | default | desc | extra |
 |----|:-----|:-------|:------|:-----|:-----|
 | id | bigint | no | | 主键 | pri |
-| wid | varchar(512) | no | | 课件编码 | uni |
+| w_code | varchar(512) | no | | 课件编码 | uni |
 | title | varchar(1024) | yes | null | 课件标题 | |
 | digest | text | yes | null | 课件摘要 | |
 | type | smallint | no | | 类型 | |
+| img_ids | varchar(512) | yes | null | 课件组图 | |
 | sort | int | no | 0 | 排序 | |
 | status | smallint | no | | 状态 | |
 | create_time | timestamp | no | now | 创建时间 | |
 | update_time | timestamp | no | now | 更新时间 | | |
 
 ##### index
-> unique index wid
+> unique index w_code