From 9517ffdfb81c1b1be543a7e6e7ee35bf078c6182 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Tue, 20 Jun 2023 09:06:32 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=20mall=20product?= =?UTF-8?q?=20promotion=20=E6=B5=8B=E8=AF=95=20sql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/test/resources/sql/create_tables.sql | 88 +++------- .../src/test/resources/sql/clean.sql | 21 +-- .../src/test/resources/sql/create_tables.sql | 160 +++++------------- 3 files changed, 67 insertions(+), 202 deletions(-) diff --git a/yudao-module-mall/yudao-module-product-biz/src/test/resources/sql/create_tables.sql b/yudao-module-mall/yudao-module-product-biz/src/test/resources/sql/create_tables.sql index 172e916f7..f0f0c70ee 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/test/resources/sql/create_tables.sql +++ b/yudao-module-mall/yudao-module-product-biz/src/test/resources/sql/create_tables.sql @@ -126,82 +126,32 @@ CREATE TABLE IF NOT EXISTS `product_property_value` ( PRIMARY KEY("id") ) COMMENT '规格值'; --- TODO @puhui999:格式不太对哈 -CREATE TABLE IF NOT EXISTS `product_comment` -( - `id` - bigint - NOT - NULL - AUTO_INCREMENT - COMMENT - '评论编号,主键自增', - `user_id` - bigint - DEFAULT - NULL - COMMENT - '评价人的用户编号关联 MemberUserDO 的 id 编号', - `user_nickname` - varchar -( - 255 -) DEFAULT NULL COMMENT '评价人名称', - `user_avatar` varchar -( - 1024 -) DEFAULT NULL COMMENT '评价人头像', - `anonymous` bit -( - 1 -) DEFAULT NULL COMMENT '是否匿名', +DROP TABLE IF EXISTS `product_comment` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '评论编号,主键自增', + `user_id` bigint DEFAULT NULL COMMENT '评价人的用户编号关联 MemberUserDO 的 id 编号', + `user_nickname` varchar(255) DEFAULT NULL COMMENT '评价人名称', + `user_avatar` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '评价人头像', + `anonymous` bit(1) DEFAULT NULL COMMENT '是否匿名', `order_id` bigint DEFAULT NULL COMMENT '交易订单编号关联 TradeOrderDO 的 id 编号', `order_item_id` bigint DEFAULT NULL COMMENT '交易订单项编号关联 TradeOrderItemDO 的 id 编号', `spu_id` bigint DEFAULT NULL COMMENT '商品 SPU 编号关联 ProductSpuDO 的 id', - `spu_name` varchar -( - 255 -) DEFAULT NULL COMMENT '商品 SPU 名称', + `spu_name` varchar(255) DEFAULT NULL COMMENT '商品 SPU 名称', `sku_id` bigint DEFAULT NULL COMMENT '商品 SKU 编号关联 ProductSkuDO 的 id 编号', - `visible` bit -( - 1 -) DEFAULT NULL COMMENT '是否可见true:显示false:隐藏', - `scores` tinyint DEFAULT NULL COMMENT '评分星级1-5 分', + `visible` bit(1) DEFAULT NULL COMMENT '是否可见true:显示false:隐藏', + `scores` tinyint DEFAULT NULL COMMENT '评分星级1-5分', `description_scores` tinyint DEFAULT NULL COMMENT '描述星级1-5 星', `benefit_scores` tinyint DEFAULT NULL COMMENT '服务星级1-5 星', - `content` varchar -( - 1024 -) DEFAULT NULL COMMENT '评论内容', - `pic_urls` varchar -( - 4096 -) DEFAULT NULL COMMENT '评论图片地址数组', - `reply_status` bit -( - 1 -) DEFAULT NULL COMMENT '商家是否回复', + `content` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '评论内容', + `pic_urls` varchar(4096) DEFAULT NULL COMMENT '评论图片地址数组', + `reply_status` bit(1) DEFAULT NULL COMMENT '商家是否回复', `reply_user_id` bigint DEFAULT NULL COMMENT '回复管理员编号关联 AdminUserDO 的 id 编号', - `reply_content` varchar -( - 1024 -) DEFAULT NULL COMMENT '商家回复内容', + `reply_content` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '商家回复内容', `reply_time` datetime DEFAULT NULL COMMENT '商家回复时间', - `creator` varchar -( - 64 -) DEFAULT '' COMMENT '创建者', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `updater` varchar -( - 64 -) DEFAULT '' COMMENT '更新者', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - "deleted" bit NOT NULL DEFAULT FALSE, - "tenant_id" bigint not null default '0', - PRIMARY KEY -( - `id` -) - ) COMMENT '产品评论表'; + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 26 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '商品评论'; \ No newline at end of file diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/clean.sql b/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/clean.sql index ebeccb954..d848bf556 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/clean.sql +++ b/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/clean.sql @@ -1,14 +1,7 @@ -DELETE -FROM "market_activity"; -DELETE -FROM "promotion_coupon_template"; -DELETE -FROM "promotion_coupon"; -DELETE -FROM "promotion_reward_activity"; -DELETE -FROM "promotion_discount_activity"; -DELETE -FROM "promotion_discount_product"; -DELETE -FROM "promotion_seckill_config"; +DELETE FROM "market_activity"; +DELETE FROM "promotion_coupon_template"; +DELETE FROM "promotion_coupon"; +DELETE FROM "promotion_reward_activity"; +DELETE FROM "promotion_discount_activity"; +DELETE FROM "promotion_discount_product"; +DELETE FROM "promotion_seckill_config"; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/create_tables.sql b/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/create_tables.sql index 4cbd4b72c..33b6edc48 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/create_tables.sql +++ b/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/create_tables.sql @@ -107,123 +107,45 @@ CREATE TABLE IF NOT EXISTS "promotion_discount_activity" ( PRIMARY KEY ("id") ) COMMENT '限时折扣活动'; -CREATE TABLE IF NOT EXISTS "promotion_discount_product" ( - "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY, - "activity_id" bigint NOT NULL, - "spu_id" bigint NOT NULL, - "sku_id" bigint NOT NULL, - "discount_type" int NOT NULL, - "discount_percent" - int, - "discount_price" - int, - "creator" - varchar - DEFAULT - '', - "create_time" - datetime - NOT - NULL - DEFAULT - CURRENT_TIMESTAMP, - "updater" - varchar - DEFAULT - '', - "update_time" - datetime - NOT - NULL - DEFAULT - CURRENT_TIMESTAMP - ON - UPDATE - CURRENT_TIMESTAMP, - "deleted" - bit - NOT - NULL - DEFAULT - FALSE, - PRIMARY - KEY -( - "id" -) - ) COMMENT '限时折扣活动'; - -CREATE TABLE IF NOT EXISTS "promotion_seckill_config" -( - "id" - bigint - NOT - NULL - GENERATED - BY - DEFAULT AS - IDENTITY, - "name" - varchar - NOT - NULL, - "start_time" - varchar - NOT - NULL, - "end_time" - varchar - NOT - NULL, - "seckill_activity_count" - int - NOT - NULL, - "pic_url" - varchar - NOT - NULL, - "status" - varchar - NOT - NULL, - "creator" - varchar - DEFAULT - '', - "create_time" - datetime - NOT - NULL - DEFAULT - CURRENT_TIMESTAMP, - "updater" - varchar - DEFAULT - '', - "update_time" - datetime - NOT - NULL - DEFAULT - CURRENT_TIMESTAMP - ON - UPDATE - CURRENT_TIMESTAMP, - "deleted" - bit - NOT - NULL - DEFAULT - FALSE, - "tenant_id" - bigint - NOT - NULL, - PRIMARY - KEY -( - "id" -) - ) COMMENT '秒杀时段配置'; +-- 将该建表 SQL 语句,添加到 yudao-module-promotion-biz 模块的 test/resources/sql/create_tables.sql 文件里 +CREATE TABLE IF NOT EXISTS "promotion_seckill_activity" ( + "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY, + "spu_id" bigint NOT NULL, + "name" varchar NOT NULL, + "status" int NOT NULL, + "remark" varchar, + "start_time" varchar NOT NULL, + "end_time" varchar NOT NULL, + "sort" int NOT NULL, + "config_ids" varchar NOT NULL, + "order_count" int NOT NULL, + "user_count" int NOT NULL, + "total_price" int NOT NULL, + "total_limit_count" int, + "single_limit_count" int, + "stock" int, + "total_stock" int, + "creator" varchar DEFAULT '', + "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updater" varchar DEFAULT '', + "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + "deleted" bit NOT NULL DEFAULT FALSE, + "tenant_id" bigint NOT NULL, + PRIMARY KEY ("id") +) COMMENT '秒杀活动'; +CREATE TABLE IF NOT EXISTS "promotion_seckill_config" ( + "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY, + "name" varchar NOT NULL, + "start_time" varchar NOT NULL, + "end_time" varchar NOT NULL, + "pic_url" varchar NOT NULL, + "status" int NOT NULL, + "creator" varchar DEFAULT '', + "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updater" varchar DEFAULT '', + "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + "deleted" bit NOT NULL DEFAULT FALSE, + "tenant_id" bigint NOT NULL, + PRIMARY KEY ("id") +) COMMENT '秒杀时段配置';