> For the complete documentation index, see [llms.txt](https://65480539.gitbook.io/gop1/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://65480539.gitbook.io/gop1/di-yi-zhang-hou-duan-dai-ma/di-er-ke.md).

# 第二课

目前我们把 “在线教育的课程“  作为商品  所以商品表叫做courses

本课时快速完成项目目录的构建

![商品表](/files/-MMjTipY4JmmvfeV2j1o)

#### SQL构建：

```
DROP TABLE IF EXISTS `courses`;
CREATE TABLE `courses`  (
`course_id` int(11) NOT NULL AUTO_INCREMENT,
`course_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '课程名称',
`course_image` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图片',
`course_time` bigint(20) NULL DEFAULT NULL COMMENT '时长',
`course_stock` int(4) NULL DEFAULT -1 COMMENT '库存,默认-1代表不限制',
`course_adddate` datetime(0) NULL DEFAULT NULL,
PRIMARY KEY (`course_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;
```

&#x20;

传统的实体构建是这样的：

```
type CourseModel struct {
   CouserId int `json:"course_id"`
   CourseName string `json:"course_name"`
   CourseImage string `json:"course_image"`
   CourseTime int64  `json:"course_time"`
   CourseStock int  `json:"course_stock"`
   CouseAddDate int `json:"course_adddate"`
}
```

接下来几课时要进行值对象的划分

具体请大家根据课程提示做下思考
