# 第二课

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

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

![商品表](https://2020297199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MMfNwvaFV6y20ONYu74%2F-MMjTU7hUBezllGNuO6M%2F-MMjTipY4JmmvfeV2j1o%2F%E5%9B%BE%E7%89%87.png?alt=media\&token=dfb9abc5-a2b3-48c3-8b1f-1aa6cb318466)

#### 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"`
}
```

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

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://65480539.gitbook.io/gop1/di-yi-zhang-hou-duan-dai-ma/di-er-ke.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
