1.原型图
这是利用Axure画的,简单画一下原型图,根据他们的业务逻辑我们完成书城商店API开发
首页
分类
商品详情
购物车
个人中心
2.数据库设计
首页
首页导航
导航栏产品
通过点击导航栏对应id和产品id关联获取产品内容
设置外建
sql语句
CREATE TABLE `book`.`Untitled` (
`id` int NOT NULL AUTO_INCREMENT,
`product_id` int NOT NULL COMMENT '产品id',
`product_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '产品名称',
`product_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '产品标题',
`product_imgUrl` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '产品封面',
`product_content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '产品内容',
`product_old_price` decimal(10, 2) NOT NULL COMMENT '产品旧价格',
`product_new_price` decimal(10, 2) NOT NULL COMMENT '产品新价格',
`product_remaining_quantity` int NOT NULL COMMENT '产品库存量',
`product_clicks` int NOT NULL COMMENT '产品点击量',
`product_sales` int NOT NULL COMMENT '产品销售量',
`product_total` int NOT NULL COMMENT '产品总数',
`module_id` int NULL DEFAULT NULL COMMENT '属于哪个模块',
`status` int NOT NULL DEFAULT 0 COMMENT '状态',
`created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '产品创建时间',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '产品更新时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `nav`(`product_id` ASC) USING BTREE,
INDEX `module`(`module_id` ASC) USING BTREE,
CONSTRAINT `module` FOREIGN KEY (`module_id`) REFERENCES `book`.`book_module` (`module_id`) ON DELETE CASCADE ON UPDATE RESTRICT,
CONSTRAINT `nav` FOREIGN KEY (`product_id`) REFERENCES `book`.`book_nav` (`navId`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
产品轮播图
通过外建获取产品轮播图数据
设置外建
sql语句
CREATE TABLE `book`.`Untitled` (
`image_id` int NOT NULL AUTO_INCREMENT COMMENT '产品轮播图id',
`product_id` int NOT NULL COMMENT '产品id',
`image` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '图片路径',
`order` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '图片展示顺序',
`created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`image_id`) USING BTREE,
INDEX `images`(`product_id` ASC) USING BTREE,
CONSTRAINT `images` FOREIGN KEY (`product_id`) REFERENCES `book`.`book_navproduct` (`product_id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
首页轮播图
sql语句
CREATE TABLE `book`.`Untitled` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '轮播图id',
`imgUrl` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '图片路径',
`order` int NOT NULL COMMENT '图片轮播顺序',
`introduce` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '图片介绍',
`created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
前台模块
外键
sql
CREATE TABLE `book`.`Untitled` (
`module_id` int NOT NULL AUTO_INCREMENT COMMENT 'id',
`module_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '模块名字',
`created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`module_id`) USING BTREE,
CONSTRAINT `module` FOREIGN KEY (`module_id`) REFERENCES `book`.`book_navproduct` (`module_id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;