Commit fb7915c917dedb090b7a07a42bed154ed792e896
Committed by
Gitee
!487 完善商品管理, 完善 mall.sql, 完善 product 测试相关sql, 完善 ProductSpuServiceImplTest 测试
Merge pull request !487 from puhui999/feature/mall_product
Showing
42 changed files
with
1367 additions
and
678 deletions
sql/mysql/optional/mall.sql
| @@ -22,23 +22,23 @@ SET FOREIGN_KEY_CHECKS = 0; | @@ -22,23 +22,23 @@ SET FOREIGN_KEY_CHECKS = 0; | ||
| 22 | -- ---------------------------- | 22 | -- ---------------------------- |
| 23 | DROP TABLE IF EXISTS `market_activity`; | 23 | DROP TABLE IF EXISTS `market_activity`; |
| 24 | CREATE TABLE `market_activity` ( | 24 | CREATE TABLE `market_activity` ( |
| 25 | - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '活动编号', | ||
| 26 | - `title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '活动标题', | ||
| 27 | - `activity_type` tinyint NOT NULL COMMENT '活动类型', | ||
| 28 | - `status` tinyint NOT NULL DEFAULT -1 COMMENT '活动状态', | ||
| 29 | - `start_time` datetime NOT NULL COMMENT '开始时间', | ||
| 30 | - `end_time` datetime NOT NULL COMMENT '结束时间', | ||
| 31 | - `invalid_time` datetime NULL DEFAULT NULL COMMENT '失效时间', | ||
| 32 | - `delete_time` datetime NULL DEFAULT NULL COMMENT '删除时间', | ||
| 33 | - `time_limited_discount` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '限制折扣字符串,使用 JSON 序列化成字符串存储', | ||
| 34 | - `full_privilege` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '限制折扣字符串,使用 JSON 序列化成字符串存储', | ||
| 35 | - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '创建者', | ||
| 36 | - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 37 | - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '更新者', | ||
| 38 | - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 39 | - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 40 | - `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | ||
| 41 | - PRIMARY KEY (`id`) USING BTREE | 25 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '活动编号', |
| 26 | + `title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '活动标题', | ||
| 27 | + `activity_type` tinyint NOT NULL COMMENT '活动类型', | ||
| 28 | + `status` tinyint NOT NULL DEFAULT -1 COMMENT '活动状态', | ||
| 29 | + `start_time` datetime NOT NULL COMMENT '开始时间', | ||
| 30 | + `end_time` datetime NOT NULL COMMENT '结束时间', | ||
| 31 | + `invalid_time` datetime NULL DEFAULT NULL COMMENT '失效时间', | ||
| 32 | + `delete_time` datetime NULL DEFAULT NULL COMMENT '删除时间', | ||
| 33 | + `time_limited_discount` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '限制折扣字符串,使用 JSON 序列化成字符串存储', | ||
| 34 | + `full_privilege` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '限制折扣字符串,使用 JSON 序列化成字符串存储', | ||
| 35 | + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '创建者', | ||
| 36 | + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 37 | + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '更新者', | ||
| 38 | + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 39 | + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 40 | + `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | ||
| 41 | + PRIMARY KEY (`id`) USING BTREE | ||
| 42 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '促销活动'; | 42 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '促销活动'; |
| 43 | 43 | ||
| 44 | -- ---------------------------- | 44 | -- ---------------------------- |
| @@ -52,20 +52,20 @@ COMMIT; | @@ -52,20 +52,20 @@ COMMIT; | ||
| 52 | -- ---------------------------- | 52 | -- ---------------------------- |
| 53 | DROP TABLE IF EXISTS `market_banner`; | 53 | DROP TABLE IF EXISTS `market_banner`; |
| 54 | CREATE TABLE `market_banner` ( | 54 | CREATE TABLE `market_banner` ( |
| 55 | - `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'Banner编号', | ||
| 56 | - `title` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT 'Banner标题', | ||
| 57 | - `pic_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '图片URL', | ||
| 58 | - `status` tinyint NOT NULL DEFAULT -1 COMMENT '活动状态', | ||
| 59 | - `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '跳转地址', | ||
| 60 | - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '创建者', | ||
| 61 | - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 62 | - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '更新者', | ||
| 63 | - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 64 | - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 65 | - `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | ||
| 66 | - `sort` tinyint NULL DEFAULT NULL COMMENT '排序', | ||
| 67 | - `memo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '描述', | ||
| 68 | - PRIMARY KEY (`id`) USING BTREE | 55 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'Banner编号', |
| 56 | + `title` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT 'Banner标题', | ||
| 57 | + `pic_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '图片URL', | ||
| 58 | + `status` tinyint NOT NULL DEFAULT -1 COMMENT '活动状态', | ||
| 59 | + `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '跳转地址', | ||
| 60 | + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '创建者', | ||
| 61 | + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 62 | + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '更新者', | ||
| 63 | + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 64 | + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 65 | + `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | ||
| 66 | + `sort` tinyint NULL DEFAULT NULL COMMENT '排序', | ||
| 67 | + `memo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '描述', | ||
| 68 | + PRIMARY KEY (`id`) USING BTREE | ||
| 69 | ) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'Banner管理'; | 69 | ) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'Banner管理'; |
| 70 | 70 | ||
| 71 | -- ---------------------------- | 71 | -- ---------------------------- |
| @@ -79,29 +79,29 @@ COMMIT; | @@ -79,29 +79,29 @@ COMMIT; | ||
| 79 | -- ---------------------------- | 79 | -- ---------------------------- |
| 80 | DROP TABLE IF EXISTS `member_address`; | 80 | DROP TABLE IF EXISTS `member_address`; |
| 81 | CREATE TABLE `member_address` ( | 81 | CREATE TABLE `member_address` ( |
| 82 | - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '收件地址编号', | ||
| 83 | - `user_id` bigint NOT NULL COMMENT '用户编号', | ||
| 84 | - `name` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '收件人名称', | ||
| 85 | - `mobile` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '手机号', | ||
| 86 | - `area_id` bigint NOT NULL COMMENT '地区编码', | ||
| 87 | - `post_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '邮编', | ||
| 88 | - `detail_address` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '收件详细地址', | ||
| 89 | - `defaulted` bit(1) NOT NULL COMMENT '是否默认', | ||
| 90 | - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', | ||
| 91 | - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 92 | - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | ||
| 93 | - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 94 | - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 95 | - `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | ||
| 96 | - PRIMARY KEY (`id`) USING BTREE, | ||
| 97 | - INDEX `idx_userId`(`user_id` ASC) USING BTREE | 82 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '收件地址编号', |
| 83 | + `user_id` bigint NOT NULL COMMENT '用户编号', | ||
| 84 | + `name` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '收件人名称', | ||
| 85 | + `mobile` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '手机号', | ||
| 86 | + `area_id` bigint NOT NULL COMMENT '地区编码', | ||
| 87 | + `post_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '邮编', | ||
| 88 | + `detail_address` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '收件详细地址', | ||
| 89 | + `defaulted` bit(1) NOT NULL COMMENT '是否默认', | ||
| 90 | + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', | ||
| 91 | + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 92 | + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | ||
| 93 | + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 94 | + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 95 | + `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | ||
| 96 | + PRIMARY KEY (`id`) USING BTREE, | ||
| 97 | + INDEX `idx_userId`(`user_id` ASC) USING BTREE | ||
| 98 | ) ENGINE = InnoDB AUTO_INCREMENT = 21 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '用户收件地址'; | 98 | ) ENGINE = InnoDB AUTO_INCREMENT = 21 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '用户收件地址'; |
| 99 | 99 | ||
| 100 | -- ---------------------------- | 100 | -- ---------------------------- |
| 101 | -- Records of member_address | 101 | -- Records of member_address |
| 102 | -- ---------------------------- | 102 | -- ---------------------------- |
| 103 | BEGIN; | 103 | BEGIN; |
| 104 | -INSERT INTO `member_address` (`id`, `user_id`, `name`, `mobile`, `area_id`, `post_code`, `detail_address`, `defaulted`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (21, 1, 'yunai', '15601691300', 610632, '200000', '芋道源码 233 号 666 室', b'1', '1', '2022-08-01 22:46:35', '1', '2022-08-01 22:46:35', b'0', 1); | 104 | +INSERT INTO `ruoyi-vue-pro`.`member_address` (`id`, `user_id`, `name`, `mobile`, `area_id`, `post_code`, `detail_address`, `defaulted`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (21, 1, 'yunai', '15601691300', 610632, '200000', '芋道源码 233 号 666 室', b'1', '1', '2022-08-01 22:46:35', '1', '2022-08-01 22:46:35', b'0', 1); |
| 105 | COMMIT; | 105 | COMMIT; |
| 106 | 106 | ||
| 107 | -- ---------------------------- | 107 | -- ---------------------------- |
| @@ -109,26 +109,26 @@ COMMIT; | @@ -109,26 +109,26 @@ COMMIT; | ||
| 109 | -- ---------------------------- | 109 | -- ---------------------------- |
| 110 | DROP TABLE IF EXISTS `product_brand`; | 110 | DROP TABLE IF EXISTS `product_brand`; |
| 111 | CREATE TABLE `product_brand` ( | 111 | CREATE TABLE `product_brand` ( |
| 112 | - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '品牌编号', | ||
| 113 | - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '品牌名称', | ||
| 114 | - `pic_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '品牌图片', | ||
| 115 | - `sort` int NULL DEFAULT 0 COMMENT '品牌排序', | ||
| 116 | - `description` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '品牌描述', | ||
| 117 | - `status` tinyint NOT NULL COMMENT '状态', | ||
| 118 | - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', | ||
| 119 | - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 120 | - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | ||
| 121 | - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 122 | - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 123 | - `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | ||
| 124 | - PRIMARY KEY (`id`) USING BTREE | 112 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '品牌编号', |
| 113 | + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '品牌名称', | ||
| 114 | + `pic_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '品牌图片', | ||
| 115 | + `sort` int NULL DEFAULT 0 COMMENT '品牌排序', | ||
| 116 | + `description` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '品牌描述', | ||
| 117 | + `status` tinyint NOT NULL COMMENT '状态', | ||
| 118 | + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', | ||
| 119 | + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 120 | + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | ||
| 121 | + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 122 | + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 123 | + `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | ||
| 124 | + PRIMARY KEY (`id`) USING BTREE | ||
| 125 | ) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '商品品牌'; | 125 | ) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '商品品牌'; |
| 126 | 126 | ||
| 127 | -- ---------------------------- | 127 | -- ---------------------------- |
| 128 | -- Records of product_brand | 128 | -- Records of product_brand |
| 129 | -- ---------------------------- | 129 | -- ---------------------------- |
| 130 | BEGIN; | 130 | BEGIN; |
| 131 | -INSERT INTO `product_brand` (`id`, `name`, `pic_url`, `sort`, `description`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1, '苹果', 'http://test.yudao.iocoder.cn/e3726713fa56db5717c78c011762fcc7a251db12735c3581470638b8e1fa17e2.jpeg', 0, '是上市', 0, '1', '2022-07-30 22:12:18', '1', '2022-07-30 22:13:55', b'0', 1); | 131 | +INSERT INTO `ruoyi-vue-pro`.`product_brand` (`id`, `name`, `pic_url`, `sort`, `description`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1, '苹果', 'http://test.yudao.iocoder.cn/e3726713fa56db5717c78c011762fcc7a251db12735c3581470638b8e1fa17e2.jpeg', 0, '是上市', 0, '1', '2022-07-30 22:12:18', '1', '2022-07-30 22:13:55', b'0', 1); |
| 132 | COMMIT; | 132 | COMMIT; |
| 133 | 133 | ||
| 134 | -- ---------------------------- | 134 | -- ---------------------------- |
| @@ -136,27 +136,46 @@ COMMIT; | @@ -136,27 +136,46 @@ COMMIT; | ||
| 136 | -- ---------------------------- | 136 | -- ---------------------------- |
| 137 | DROP TABLE IF EXISTS `product_category`; | 137 | DROP TABLE IF EXISTS `product_category`; |
| 138 | CREATE TABLE `product_category` ( | 138 | CREATE TABLE `product_category` ( |
| 139 | - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '分类编号', | ||
| 140 | - `parent_id` bigint NOT NULL COMMENT '父分类编号', | ||
| 141 | - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '分类名称', | ||
| 142 | - `pic_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '分类图片', | ||
| 143 | - `sort` int NULL DEFAULT 0 COMMENT '分类排序', | ||
| 144 | - `description` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '分类描述', | ||
| 145 | - `status` tinyint NOT NULL COMMENT '开启状态', | ||
| 146 | - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', | ||
| 147 | - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 148 | - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | ||
| 149 | - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 150 | - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 151 | - `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | ||
| 152 | - PRIMARY KEY (`id`) USING BTREE | ||
| 153 | -) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '商品分类'; | 139 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '分类编号', |
| 140 | + `parent_id` bigint NOT NULL COMMENT '父分类编号', | ||
| 141 | + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '分类名称', | ||
| 142 | + `pic_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '移动端分类图', | ||
| 143 | + `big_pic_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'PC 端分类图', | ||
| 144 | + `sort` int DEFAULT '0' COMMENT '分类排序', | ||
| 145 | + `status` tinyint NOT NULL COMMENT '开启状态', | ||
| 146 | + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', | ||
| 147 | + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 148 | + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', | ||
| 149 | + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 150 | + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 151 | + `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号', | ||
| 152 | + PRIMARY KEY (`id`) USING BTREE | ||
| 153 | +) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商品分类'; | ||
| 154 | 154 | ||
| 155 | -- ---------------------------- | 155 | -- ---------------------------- |
| 156 | -- Records of product_category | 156 | -- Records of product_category |
| 157 | -- ---------------------------- | 157 | -- ---------------------------- |
| 158 | BEGIN; | 158 | BEGIN; |
| 159 | -INSERT INTO `product_category` (`id`, `parent_id`, `name`, `pic_url`, `sort`, `description`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1, 0, '电脑办公', 'http://test.yudao.iocoder.cn/122d548e1b3cd5dec72fe8075c6977a70f9cc13541a684ab3685f1b5df42f6bd.jpeg', 1, '1234', 0, '1', '2022-07-30 16:36:35', '1', '2022-07-30 20:27:16', b'0', 1), (2, 1, '笔记本', 'http://test.yudao.iocoder.cn/72713ac7b947600a019a18786ed0e6562e8692e253dbd35110a0a85c2469bbec.jpg', 1, '<p>测试一下</p>', 0, '1', '2022-07-30 16:38:09', '1', '2022-07-30 16:38:09', b'0', 1), (3, 1, '游戏本', 'http://test.yudao.iocoder.cn/287c50dd9f5f575f57329a0c57b2095be6d1aeba83867b905fe549f54a296feb.jpg', 2, '<p>测试一下</p>', 0, '1', '2022-07-30 16:39:09', '1', '2022-07-30 20:26:59', b'0', 1), (4, 0, '手机', 'http://test.yudao.iocoder.cn/e1b63900c78dbb661b3e383960cee5cfea7e1dd2fb22cff2e317ff025faaf8b2.jpeg', 2, '<p>123</p>', 0, '1', '2022-07-30 16:40:00', '1', '2022-07-30 16:40:09', b'0', 1), (5, 4, '5G手机', 'http://test.yudao.iocoder.cn/3af6557ac7def6423f046f5b2e920b644793420b466959aaa996a2e19068bbde.jpeg', 1, '<p><br></p>', 0, '1', '2022-07-30 16:43:00', '1', '2022-07-30 16:43:00', b'0', 1), (6, 4, '游戏手机', 'http://test.yudao.iocoder.cn/964fe9ccd1710d64ede261dc36d231918a017641986c15293c367f9f66d94d05.jpeg', 2, NULL, 0, '1', '2022-07-30 16:43:44', '1', '2022-07-30 16:43:44', b'0', 1), (7, 5, '厉害的 5G 手机', 'http://test.yudao.iocoder.cn/b287122f277838e8de368769b96217918605743bc45f3a29bda3cc7359dc66e1.png', 0, '123', 0, '1', '2022-07-30 20:38:09', '1', '2022-07-30 20:38:09', b'0', 1); | 159 | +INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1, 0, '电脑办公', 'http://test.yudao.iocoder.cn/122d548e1b3cd5dec72fe8075c6977a70f9cc13541a684ab3685f1b5df42f6bd.jpeg', '', 300, 0, '1', '2022-07-30 16:36:35', '1', '2022-07-30 20:27:16', b'0', 1); |
| 160 | +INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2, 1, '笔记本', 'http://test.yudao.iocoder.cn/72713ac7b947600a019a18786ed0e6562e8692e253dbd35110a0a85c2469bbec.jpg', '', 310, 0, '1', '2022-07-30 16:38:09', '1', '2022-07-30 16:38:09', b'0', 1); | ||
| 161 | +INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (3, 1, '游戏本', 'http://test.yudao.iocoder.cn/287c50dd9f5f575f57329a0c57b2095be6d1aeba83867b905fe549f54a296feb.jpg', '', 312, 0, '1', '2022-07-30 16:39:09', '1', '2022-07-30 20:26:59', b'0', 1); | ||
| 162 | +INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (4, 0, '手机', 'http://test.yudao.iocoder.cn/e1b63900c78dbb661b3e383960cee5cfea7e1dd2fb22cff2e317ff025faaf8b2.jpeg', '', 313, 0, '1', '2022-07-30 16:40:00', '1', '2022-07-30 16:40:09', b'0', 1); | ||
| 163 | +INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (5, 4, '5G手机', 'http://test.yudao.iocoder.cn/3af6557ac7def6423f046f5b2e920b644793420b466959aaa996a2e19068bbde.jpeg', '', 314, 0, '1', '2022-07-30 16:43:00', '1', '2022-07-30 16:43:00', b'0', 1); | ||
| 164 | +INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (6, 4, '游戏手机', 'http://test.yudao.iocoder.cn/964fe9ccd1710d64ede261dc36d231918a017641986c15293c367f9f66d94d05.jpeg', '', 315, 0, '1', '2022-07-30 16:43:44', '1', '2022-07-30 16:43:44', b'0', 1); | ||
| 165 | +INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (7, 5, '厉害的 5G 手机', 'http://test.yudao.iocoder.cn/b287122f277838e8de368769b96217918605743bc45f3a29bda3cc7359dc66e1.png', '', '123', 0, '1', '2022-07-30 20:38:09', '1', '2022-07-30 20:38:09', b'0', 1); | ||
| 166 | +INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (15, 0, '服装鞋包', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/a23f732db55e6adbc608f4b6cf2b0ab50db6d9147af0ee267a315805a596e175.jpg', '', 100, 0, '1', '2023-04-25 16:57:05', '1', '2023-04-25 17:08:26', b'0', 1); | ||
| 167 | +INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (16, 15, '时尚女装', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/aa8d5c44ac0390ab398bae0dc8883575e3cb57594f9ed00248febe8e3d7484d1.png', '', 200, 0, '1', '2023-04-25 17:09:00', '1', '2023-04-25 17:09:00', b'0', 1); | ||
| 168 | +INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (17, 15, '精品男装', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/b0c166c0846fa2280b4a02431e2ac2e2363f2d2a6b608598f34b067a5ccf1245.png', '', 100, 0, '1', '2023-04-25 17:09:33', '1', '2023-04-25 17:09:33', b'0', 1); | ||
| 169 | +INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (18, 15, '箱包', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/8682928caa2a5a49b380ac93059adc435099873cdf646084f31cea79d5c27f40.png', '', 80, 0, '1', '2023-04-25 17:09:51', '1', '2023-04-25 17:09:51', b'0', 1); | ||
| 170 | +INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (19, 15, '西服', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/c202fa79f2fbe188cfdf40b107c7eca89c548a5c4b0047e26b7a6445c470615a.jpg', '', 0, 0, '1', '2023-04-25 17:10:15', '1', '2023-04-25 17:10:15', b'0', 1); | ||
| 171 | +INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (20, 15, '配饰', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/51bf43fcad0b947f5fa377356fb7034b47223fdbcec241d50e6e60a9be498730.jpg', '', 0, 0, '1', '2023-04-25 17:10:56', '1', '2023-04-25 17:10:56', b'0', 1); | ||
| 172 | +INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (21, 15, '美妆工具', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/c3cd6735cf157c218bc32ece312fd90cb2130c437dc9ec61d4030681d6ba4efb.png', '', 0, 0, '1', '2023-04-25 17:11:15', '1', '2023-04-25 17:11:24', b'0', 1); | ||
| 173 | +INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (22, 0, '网络盒子', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/74656bb8bc988c0419e0dbc613eda24a03956b950452b3565527301a5782db3a.png', '', 50, 0, '1', '2023-04-25 17:12:13', '1', '2023-04-25 17:12:13', b'0', 1); | ||
| 174 | +INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (23, 22, '尿裤湿巾', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/20162f22d8f6b427f0d6f1678c9fbb7bf0c1b70768bdc86101bee8b5e13bec5a.jpeg', '', 0, 0, '1', '2023-04-25 17:12:42', '1', '2023-04-25 17:12:42', b'0', 1); | ||
| 175 | +INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (24, 15, '宠物主粮', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/383729ba05711c400f9e44db11a63603af0fdbc99e58cd7b40e9296ca4e0510e.jpg', '', 0, 0, '1', '2023-04-25 17:13:09', '1', '2023-04-25 17:13:09', b'0', 1); | ||
| 176 | +INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (25, 0, '家电电器', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/c8a34dc2688fd4d2c95b5f49888865db1c88fd3bde153e3f7f0bcd4ff9971c96.png', '', 50, 0, '1', '2023-04-25 17:13:43', '1', '2023-04-25 17:13:43', b'0', 1); | ||
| 177 | +INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (26, 25, '封口/封杯机', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/1c0c208cfcf871c146006d97f95ae4fcd14d8a2deb3eabe3696367af61cb5e69.png', '', 60, 0, '1', '2023-04-25 17:14:39', '1', '2023-04-25 17:14:39', b'0', 1); | ||
| 178 | +INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (27, 25, '空调', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/d578e1e60b2dc3efe70643d25a8b2150dabfecd658fdb2fafcdb786d525f66d1.png', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/34ed55f822ad25ab445e6b396dcd61a7d119882ef19f85f0e24742911d896959.jpeg', 60, 0, '1', '2023-04-25 17:15:12', '1', '2023-04-25 17:17:04', b'0', 1); | ||
| 160 | COMMIT; | 179 | COMMIT; |
| 161 | 180 | ||
| 162 | -- ---------------------------- | 181 | -- ---------------------------- |
| @@ -164,18 +183,18 @@ COMMIT; | @@ -164,18 +183,18 @@ COMMIT; | ||
| 164 | -- ---------------------------- | 183 | -- ---------------------------- |
| 165 | DROP TABLE IF EXISTS `product_property`; | 184 | DROP TABLE IF EXISTS `product_property`; |
| 166 | CREATE TABLE `product_property` ( | 185 | CREATE TABLE `product_property` ( |
| 167 | - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', | ||
| 168 | - `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '规格名称', | ||
| 169 | - `status` tinyint DEFAULT NULL COMMENT '状态: 0 开启 ,1 禁用', | ||
| 170 | - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 171 | - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 172 | - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人', | ||
| 173 | - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '更新人', | ||
| 174 | - `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号', | ||
| 175 | - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 176 | - `remark` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注', | ||
| 177 | - PRIMARY KEY (`id`) USING BTREE, | ||
| 178 | - KEY `idx_name` (`name`(32)) USING BTREE COMMENT '规格名称索引' | 186 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', |
| 187 | + `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '规格名称', | ||
| 188 | + `status` tinyint DEFAULT NULL COMMENT '状态: 0 开启 ,1 禁用', | ||
| 189 | + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 190 | + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 191 | + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人', | ||
| 192 | + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '更新人', | ||
| 193 | + `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号', | ||
| 194 | + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 195 | + `remark` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注', | ||
| 196 | + PRIMARY KEY (`id`) USING BTREE, | ||
| 197 | + KEY `idx_name` (`name`(32)) USING BTREE COMMENT '规格名称索引' | ||
| 179 | ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='规格名称'; | 198 | ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='规格名称'; |
| 180 | 199 | ||
| 181 | -- ---------------------------- | 200 | -- ---------------------------- |
| @@ -189,18 +208,18 @@ COMMIT; | @@ -189,18 +208,18 @@ COMMIT; | ||
| 189 | -- ---------------------------- | 208 | -- ---------------------------- |
| 190 | DROP TABLE IF EXISTS `product_property_value`; | 209 | DROP TABLE IF EXISTS `product_property_value`; |
| 191 | CREATE TABLE `product_property_value` ( | 210 | CREATE TABLE `product_property_value` ( |
| 192 | - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', | ||
| 193 | - `property_id` bigint DEFAULT NULL COMMENT '规格键id', | ||
| 194 | - `name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '规格值名字', | ||
| 195 | - `status` tinyint DEFAULT NULL COMMENT '状态: 1 开启 ,2 禁用', | ||
| 196 | - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 197 | - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 198 | - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人', | ||
| 199 | - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '更新人', | ||
| 200 | - `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号', | ||
| 201 | - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 202 | - `remark` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注', | ||
| 203 | - PRIMARY KEY (`id`) USING BTREE | 211 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', |
| 212 | + `property_id` bigint DEFAULT NULL COMMENT '规格键id', | ||
| 213 | + `name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '规格值名字', | ||
| 214 | + `status` tinyint DEFAULT NULL COMMENT '状态: 1 开启 ,2 禁用', | ||
| 215 | + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 216 | + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 217 | + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人', | ||
| 218 | + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '更新人', | ||
| 219 | + `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号', | ||
| 220 | + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 221 | + `remark` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注', | ||
| 222 | + PRIMARY KEY (`id`) USING BTREE | ||
| 204 | ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='规格值'; | 223 | ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='规格值'; |
| 205 | 224 | ||
| 206 | -- ---------------------------- | 225 | -- ---------------------------- |
| @@ -214,26 +233,26 @@ COMMIT; | @@ -214,26 +233,26 @@ COMMIT; | ||
| 214 | -- ---------------------------- | 233 | -- ---------------------------- |
| 215 | DROP TABLE IF EXISTS `product_sku`; | 234 | DROP TABLE IF EXISTS `product_sku`; |
| 216 | CREATE TABLE `product_sku` ( | 235 | CREATE TABLE `product_sku` ( |
| 217 | - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', | ||
| 218 | - `spu_id` bigint NOT NULL COMMENT 'spu编号', | ||
| 219 | - `properties` varchar(512) DEFAULT NULL COMMENT '属性数组,JSON 格式 [{propertId: , valueId: }, {propertId: , valueId: }]', | ||
| 220 | - `price` int NOT NULL DEFAULT '-1' COMMENT '商品价格,单位:分', | ||
| 221 | - `market_price` int DEFAULT NULL COMMENT '市场价,单位:分', | ||
| 222 | - `cost_price` int NOT NULL DEFAULT '-1' COMMENT '成本价,单位: 分', | ||
| 223 | - `bar_code` varchar(64) DEFAULT NULL COMMENT 'SKU 的条形码', | ||
| 224 | - `pic_url` varchar(256) NOT NULL COMMENT '图片地址', | ||
| 225 | - `stock` int DEFAULT NULL COMMENT '库存', | ||
| 226 | - `weight` double DEFAULT NULL COMMENT '商品重量,单位:kg 千克', | ||
| 227 | - `volume` double DEFAULT NULL COMMENT '商品体积,单位:m^3 平米', | ||
| 228 | - `sub_commission_first_price` int DEFAULT NULL COMMENT '一级分销的佣金,单位:分', | ||
| 229 | - `sub_commission_second_price` int DEFAULT NULL COMMENT '二级分销的佣金,单位:分', | ||
| 230 | - `sales_count` int DEFAULT NULL COMMENT '商品销量', | ||
| 231 | - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 232 | - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 233 | - `creator` varchar(64) DEFAULT NULL COMMENT '创建人', | ||
| 234 | - `updater` double(64,0) DEFAULT NULL COMMENT '更新人', | ||
| 235 | - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 236 | - `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号', | 236 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', |
| 237 | + `spu_id` bigint NOT NULL COMMENT 'spu编号', | ||
| 238 | + `properties` varchar(512) DEFAULT NULL COMMENT '属性数组,JSON 格式 [{propertId: , valueId: }, {propertId: , valueId: }]', | ||
| 239 | + `price` int NOT NULL DEFAULT '-1' COMMENT '商品价格,单位:分', | ||
| 240 | + `market_price` int DEFAULT NULL COMMENT '市场价,单位:分', | ||
| 241 | + `cost_price` int NOT NULL DEFAULT '-1' COMMENT '成本价,单位: 分', | ||
| 242 | + `bar_code` varchar(64) DEFAULT NULL COMMENT 'SKU 的条形码', | ||
| 243 | + `pic_url` varchar(256) NOT NULL COMMENT '图片地址', | ||
| 244 | + `stock` int DEFAULT NULL COMMENT '库存', | ||
| 245 | + `weight` double DEFAULT NULL COMMENT '商品重量,单位:kg 千克', | ||
| 246 | + `volume` double DEFAULT NULL COMMENT '商品体积,单位:m^3 平米', | ||
| 247 | + `sub_commission_first_price` int DEFAULT NULL COMMENT '一级分销的佣金,单位:分', | ||
| 248 | + `sub_commission_second_price` int DEFAULT NULL COMMENT '二级分销的佣金,单位:分', | ||
| 249 | + `sales_count` int DEFAULT NULL COMMENT '商品销量', | ||
| 250 | + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 251 | + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 252 | + `creator` varchar(64) DEFAULT NULL COMMENT '创建人', | ||
| 253 | + `updater` double(64,0) DEFAULT NULL COMMENT '更新人', | ||
| 254 | + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 255 | + `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号', | ||
| 237 | PRIMARY KEY (`id`) USING BTREE | 256 | PRIMARY KEY (`id`) USING BTREE |
| 238 | ) ENGINE=InnoDB COMMENT='商品sku'; | 257 | ) ENGINE=InnoDB COMMENT='商品sku'; |
| 239 | 258 | ||
| @@ -248,45 +267,45 @@ COMMIT; | @@ -248,45 +267,45 @@ COMMIT; | ||
| 248 | -- ---------------------------- | 267 | -- ---------------------------- |
| 249 | DROP TABLE IF EXISTS `product_spu`; | 268 | DROP TABLE IF EXISTS `product_spu`; |
| 250 | CREATE TABLE `product_spu` ( | 269 | CREATE TABLE `product_spu` ( |
| 251 | - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '商品 SPU 编号,自增', | ||
| 252 | - `name` varchar(128) NOT NULL COMMENT '商品名称', | ||
| 253 | - `keyword` varchar(256) DEFAULT NULL COMMENT '关键字', | ||
| 254 | - `introduction` varchar(256) COMMENT '商品简介', | ||
| 255 | - `description` text COMMENT '商品详情', | ||
| 256 | - `bar_code` varchar(64) DEFAULT NULL COMMENT '条形码', | ||
| 257 | - `category_id` bigint NOT NULL COMMENT '商品分类编号', | ||
| 258 | - `brand_id` int DEFAULT NULL COMMENT '商品品牌编号', | ||
| 259 | - `pic_url` varchar(256) NOT NULL COMMENT '商品封面图', | ||
| 260 | - `slider_pic_urls` varchar(2000) DEFAULT '' COMMENT '商品轮播图地址\n 数组,以逗号分隔\n 最多上传15张', | ||
| 261 | - `video_url` varchar(256) DEFAULT NULL COMMENT '商品视频', | ||
| 262 | - `unit` tinyint NOT NULL COMMENT '单位', | ||
| 263 | - `sort` int NOT NULL DEFAULT '0' COMMENT '排序字段', | ||
| 264 | - `status` tinyint NOT NULL COMMENT '商品状态: 0 上架(开启) 1 下架(禁用)-1 回收', | ||
| 265 | - `spec_type` bit(1) DEFAULT NULL COMMENT '规格类型:0 单规格 1 多规格', | ||
| 266 | - `price` int NOT NULL DEFAULT '-1' COMMENT '商品价格,单位使用:分', | ||
| 267 | - `market_price` int DEFAULT NULL COMMENT '市场价,单位使用:分', | ||
| 268 | - `cost_price` int NOT NULL DEFAULT '-1' COMMENT '成本价,单位: 分', | ||
| 269 | - `stock` int NOT NULL DEFAULT '0' COMMENT '库存', | ||
| 270 | - `delivery_template_id` bigint NOT NULL COMMENT '物流配置模板编号', | ||
| 271 | - `recommend_hot` bit(1) DEFAULT NULL COMMENT '是否热卖推荐: 0 默认 1 热卖', | ||
| 272 | - `recommend_benefit` bit(1) DEFAULT NULL COMMENT '是否优惠推荐: 0 默认 1 优选', | ||
| 273 | - `recommend_best` bit(1) DEFAULT NULL COMMENT '是否精品推荐: 0 默认 1 精品', | ||
| 274 | - `recommend_new` bit(1) DEFAULT NULL COMMENT '是否新品推荐: 0 默认 1 新品', | ||
| 275 | - `recommend_good` bit(1) DEFAULT NULL COMMENT '是否优品推荐', | ||
| 276 | - `give_integral` int NOT NULL COMMENT '赠送积分', | ||
| 277 | - `give_coupon_template_ids` varchar(512) DEFAULT '' COMMENT '赠送的优惠劵编号的数组', | ||
| 278 | - `sub_commission_type` bit(1) DEFAULT NULL COMMENT '分销类型', | ||
| 279 | - `activity_orders` varchar(16) NOT NULL DEFAULT '' COMMENT '活动显示排序0=默认, 1=秒杀,2=砍价,3=拼团', | ||
| 280 | - `sales_count` int DEFAULT '0' COMMENT '商品销量', | ||
| 281 | - `virtual_sales_count` int DEFAULT '0' COMMENT '虚拟销量', | ||
| 282 | - `browse_count` int DEFAULT '0' COMMENT '商品点击量', | ||
| 283 | - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 284 | - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 285 | - `creator` varchar(64) DEFAULT NULL COMMENT '创建人', | ||
| 286 | - `updater` varchar(64) DEFAULT NULL COMMENT '更新人', | ||
| 287 | - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 288 | - `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号', | ||
| 289 | - PRIMARY KEY (`id`) USING BTREE | 270 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '商品 SPU 编号,自增', |
| 271 | + `name` varchar(128) NOT NULL COMMENT '商品名称', | ||
| 272 | + `keyword` varchar(256) DEFAULT NULL COMMENT '关键字', | ||
| 273 | + `introduction` varchar(256) COMMENT '商品简介', | ||
| 274 | + `description` text COMMENT '商品详情', | ||
| 275 | + `bar_code` varchar(64) DEFAULT NULL COMMENT '条形码', | ||
| 276 | + `category_id` bigint NOT NULL COMMENT '商品分类编号', | ||
| 277 | + `brand_id` int DEFAULT NULL COMMENT '商品品牌编号', | ||
| 278 | + `pic_url` varchar(256) NOT NULL COMMENT '商品封面图', | ||
| 279 | + `slider_pic_urls` varchar(2000) DEFAULT '' COMMENT '商品轮播图地址\n 数组,以逗号分隔\n 最多上传15张', | ||
| 280 | + `video_url` varchar(256) DEFAULT NULL COMMENT '商品视频', | ||
| 281 | + `unit` tinyint NOT NULL COMMENT '单位', | ||
| 282 | + `sort` int NOT NULL DEFAULT '0' COMMENT '排序字段', | ||
| 283 | + `status` tinyint NOT NULL COMMENT '商品状态: 0 上架(开启) 1 下架(禁用)-1 回收', | ||
| 284 | + `spec_type` bit(1) DEFAULT NULL COMMENT '规格类型:0 单规格 1 多规格', | ||
| 285 | + `price` int NOT NULL DEFAULT '-1' COMMENT '商品价格,单位使用:分', | ||
| 286 | + `market_price` int DEFAULT NULL COMMENT '市场价,单位使用:分', | ||
| 287 | + `cost_price` int NOT NULL DEFAULT '-1' COMMENT '成本价,单位: 分', | ||
| 288 | + `stock` int NOT NULL DEFAULT '0' COMMENT '库存', | ||
| 289 | + `delivery_template_id` bigint NOT NULL COMMENT '物流配置模板编号', | ||
| 290 | + `recommend_hot` bit(1) DEFAULT NULL COMMENT '是否热卖推荐: 0 默认 1 热卖', | ||
| 291 | + `recommend_benefit` bit(1) DEFAULT NULL COMMENT '是否优惠推荐: 0 默认 1 优选', | ||
| 292 | + `recommend_best` bit(1) DEFAULT NULL COMMENT '是否精品推荐: 0 默认 1 精品', | ||
| 293 | + `recommend_new` bit(1) DEFAULT NULL COMMENT '是否新品推荐: 0 默认 1 新品', | ||
| 294 | + `recommend_good` bit(1) DEFAULT NULL COMMENT '是否优品推荐', | ||
| 295 | + `give_integral` int NOT NULL COMMENT '赠送积分', | ||
| 296 | + `give_coupon_template_ids` varchar(512) DEFAULT '' COMMENT '赠送的优惠劵编号的数组', | ||
| 297 | + `sub_commission_type` bit(1) DEFAULT NULL COMMENT '分销类型', | ||
| 298 | + `activity_orders` varchar(16) NOT NULL DEFAULT '' COMMENT '活动显示排序0=默认, 1=秒杀,2=砍价,3=拼团', | ||
| 299 | + `sales_count` int DEFAULT '0' COMMENT '商品销量', | ||
| 300 | + `virtual_sales_count` int DEFAULT '0' COMMENT '虚拟销量', | ||
| 301 | + `browse_count` int DEFAULT '0' COMMENT '商品点击量', | ||
| 302 | + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 303 | + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 304 | + `creator` varchar(64) DEFAULT NULL COMMENT '创建人', | ||
| 305 | + `updater` varchar(64) DEFAULT NULL COMMENT '更新人', | ||
| 306 | + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 307 | + `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号', | ||
| 308 | + PRIMARY KEY (`id`) USING BTREE | ||
| 290 | ) ENGINE=InnoDB COMMENT='商品spu'; | 309 | ) ENGINE=InnoDB COMMENT='商品spu'; |
| 291 | 310 | ||
| 292 | -- ---------------------------- | 311 | -- ---------------------------- |
| @@ -294,17 +313,17 @@ CREATE TABLE `product_spu` ( | @@ -294,17 +313,17 @@ CREATE TABLE `product_spu` ( | ||
| 294 | -- ---------------------------- | 313 | -- ---------------------------- |
| 295 | DROP TABLE IF EXISTS `product_favorite`; | 314 | DROP TABLE IF EXISTS `product_favorite`; |
| 296 | CREATE TABLE `product_favorite` ( | 315 | CREATE TABLE `product_favorite` ( |
| 297 | - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号,自增', | ||
| 298 | - `spu_id` bigint NOT NULL COMMENT '商品 SPU 编号', | ||
| 299 | - `user_id` bigint NOT NULL COMMENT '用户id', | ||
| 300 | - `type` int(10) NOT NULL DEFAULT 1 COMMENT '类型1:收藏 2:点赞', | ||
| 301 | - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', | ||
| 302 | - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 303 | - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | ||
| 304 | - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 305 | - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 306 | - `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | ||
| 307 | - PRIMARY KEY (`id`) USING BTREE | 316 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号,自增', |
| 317 | + `spu_id` bigint NOT NULL COMMENT '商品 SPU 编号', | ||
| 318 | + `user_id` bigint NOT NULL COMMENT '用户id', | ||
| 319 | + `type` int(10) NOT NULL DEFAULT 1 COMMENT '类型1:收藏 2:点赞', | ||
| 320 | + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', | ||
| 321 | + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 322 | + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | ||
| 323 | + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 324 | + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 325 | + `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | ||
| 326 | + PRIMARY KEY (`id`) USING BTREE | ||
| 308 | ) ENGINE=InnoDB COMMENT='商品收藏表'; | 327 | ) ENGINE=InnoDB COMMENT='商品收藏表'; |
| 309 | 328 | ||
| 310 | -- Table structure for trade_delivery_express_template | 329 | -- Table structure for trade_delivery_express_template |
| @@ -449,6 +468,7 @@ CREATE TABLE `trade_delivery_express` ( | @@ -449,6 +468,7 @@ CREATE TABLE `trade_delivery_express` ( | ||
| 449 | 468 | ||
| 450 | SET FOREIGN_KEY_CHECKS = 1; | 469 | SET FOREIGN_KEY_CHECKS = 1; |
| 451 | 470 | ||
| 471 | +BEGIN; | ||
| 452 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2000, '商品中心', '', 1, 60, 0, '/product', 'merchant', NULL, 0, b'1', b'1', '', '2022-07-29 15:53:53', '1', '2022-07-30 22:26:19', b'0'); | 472 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2000, '商品中心', '', 1, 60, 0, '/product', 'merchant', NULL, 0, b'1', b'1', '', '2022-07-29 15:53:53', '1', '2022-07-30 22:26:19', b'0'); |
| 453 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2002, '商品分类', '', 2, 2, 2000, 'category', 'dict', 'mall/product/category/index', 0, b'1', b'1', '', '2022-07-29 15:53:53', '1', '2022-07-30 22:23:37', b'0'); | 473 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2002, '商品分类', '', 2, 2, 2000, 'category', 'dict', 'mall/product/category/index', 0, b'1', b'1', '', '2022-07-29 15:53:53', '1', '2022-07-30 22:23:37', b'0'); |
| 454 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2003, '分类查询', 'product:category:query', 3, 1, 2002, '', '', '', 0, b'1', b'1', '', '2022-07-29 15:53:53', '', '2022-07-29 15:53:53', b'0'); | 474 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2003, '分类查询', 'product:category:query', 3, 1, 2002, '', '', '', 0, b'1', b'1', '', '2022-07-29 15:53:53', '', '2022-07-29 15:53:53', b'0'); |
| @@ -467,6 +487,7 @@ INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, ` | @@ -467,6 +487,7 @@ INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, ` | ||
| 467 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2016, '商品创建', 'product:spu:create', 3, 2, 2014, '', '', '', 0, b'1', b'1', '', '2022-07-30 14:22:58', '', '2022-07-30 14:22:58', b'0'); | 487 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2016, '商品创建', 'product:spu:create', 3, 2, 2014, '', '', '', 0, b'1', b'1', '', '2022-07-30 14:22:58', '', '2022-07-30 14:22:58', b'0'); |
| 468 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2017, '商品更新', 'product:spu:update', 3, 3, 2014, '', '', '', 0, b'1', b'1', '', '2022-07-30 14:22:58', '', '2022-07-30 14:22:58', b'0'); | 488 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2017, '商品更新', 'product:spu:update', 3, 3, 2014, '', '', '', 0, b'1', b'1', '', '2022-07-30 14:22:58', '', '2022-07-30 14:22:58', b'0'); |
| 469 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2018, '商品删除', 'product:spu:delete', 3, 4, 2014, '', '', '', 0, b'1', b'1', '', '2022-07-30 14:22:58', '', '2022-07-30 14:22:58', b'0'); | 489 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2018, '商品删除', 'product:spu:delete', 3, 4, 2014, '', '', '', 0, b'1', b'1', '', '2022-07-30 14:22:58', '', '2022-07-30 14:22:58', b'0'); |
| 490 | +INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2018, '商品导出', 'product:spu:export', 3, 5, 2014, '', '', '', 0, b'1', b'1', '', '2022-07-30 14:22:58', '', '2022-07-30 14:22:58', b'0'); | ||
| 470 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2019, '规格管理', '', 2, 3, 2000, 'property', '', 'mall/product/property/index', 0, b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-08-01 14:55:35', b'0'); | 491 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2019, '规格管理', '', 2, 3, 2000, 'property', '', 'mall/product/property/index', 0, b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-08-01 14:55:35', b'0'); |
| 471 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2020, '规格查询', 'product:property:query', 3, 1, 2019, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-08-01 14:55:35', b'0'); | 492 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2020, '规格查询', 'product:property:query', 3, 1, 2019, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-08-01 14:55:35', b'0'); |
| 472 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2021, '规格创建', 'product:property:create', 3, 2, 2019, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-08-01 14:55:35', b'0'); | 493 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2021, '规格创建', 'product:property:create', 3, 2, 2019, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-08-01 14:55:35', b'0'); |
| @@ -478,60 +499,45 @@ INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, ` | @@ -478,60 +499,45 @@ INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, ` | ||
| 478 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2027, 'Banner创建', 'market:banner:create', 3, 2, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0'); | 499 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2027, 'Banner创建', 'market:banner:create', 3, 2, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0'); |
| 479 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2028, 'Banner更新', 'market:banner:update', 3, 3, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0'); | 500 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2028, 'Banner更新', 'market:banner:update', 3, 3, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0'); |
| 480 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2029, 'Banner删除', 'market:banner:delete', 3, 4, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0'); | 501 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2029, 'Banner删除', 'market:banner:delete', 3, 4, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0'); |
| 481 | -INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2164, '配送管理', '', 1, 0, 2072, 'delivery', '', '', '', 0, b'1', b'1', b'1', '1', '2023-05-18 09:18:02', '1', '2023-05-18 09:48:48', b'0'); | ||
| 482 | -INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2165, '快递发货', '', 1, 0, 2164, 'express', '', '', '', 0, b'1', b'1', b'1', '1', '2023-05-18 09:22:06', '1', '2023-05-18 09:22:06', b'0'); | ||
| 483 | -INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2166, '门店自提', '', 1, 1, 2164, 'pick-up-store', '', '', '', 0, b'1', b'1', b'1', '1', '2023-05-18 09:23:14', '1', '2023-05-18 09:23:14', b'0'); | ||
| 484 | -INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2167, '快递公司', '', 2, 0, 2165, 'express', '', 'mall/trade/delivery/express/index', 'Express', 0, b'1', b'1', b'1', '1', '2023-05-18 09:27:21', '1', '2023-05-18 22:11:14', b'0'); | ||
| 485 | -INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2168, '快递公司查询', 'trade:delivery:express:query', 3, 1, 2167, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-18 09:37:53', '', '2023-05-18 09:37:53', b'0'); | ||
| 486 | -INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2169, '快递公司创建', 'trade:delivery:express:create', 3, 2, 2167, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-18 09:37:53', '', '2023-05-18 09:37:53', b'0'); | ||
| 487 | -INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2170, '快递公司更新', 'trade:delivery:express:update', 3, 3, 2167, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-18 09:37:53', '', '2023-05-18 09:37:53', b'0'); | ||
| 488 | -INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2171, '快递公司删除', 'trade:delivery:express:delete', 3, 4, 2167, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-18 09:37:53', '', '2023-05-18 09:37:53', b'0'); | ||
| 489 | -INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2172, '快递公司导出', 'trade:delivery:express:export', 3, 5, 2167, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-18 09:37:53', '', '2023-05-18 09:37:53', b'0'); | ||
| 490 | -INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2178, '快递运费模板导出', 'trade:delivery:express-template:export', 3, 5, 2173, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-20 06:49:53', '', '2023-05-20 06:49:53', b'0'); | ||
| 491 | -INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2177, '快递运费模板删除', 'trade:delivery:express-template:delete', 3, 4, 2173, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-20 06:49:53', '', '2023-05-20 06:49:53', b'0'); | ||
| 492 | -INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2176, '快递运费模板更新', 'trade:delivery:express-template:update', 3, 3, 2173, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-20 06:49:53', '', '2023-05-20 06:49:53', b'0'); | ||
| 493 | -INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2175, '快递运费模板创建', 'trade:delivery:express-template:create', 3, 2, 2173, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-20 06:49:53', '', '2023-05-20 06:49:53', b'0'); | ||
| 494 | -INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2174, '快递运费模板查询', 'trade:delivery:express-template:query', 3, 1, 2173, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-20 06:49:53', '', '2023-05-20 06:49:53', b'0'); | ||
| 495 | -INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2173, '运费模版', 'trade:delivery:express-template:query', 2, 1, 2165, 'express-template', '', 'mall/trade/delivery/expressTemplate/index', 'ExpressTemplate', 0, b'1', b'1', b'1', '1', '2023-05-20 06:48:10', '1', '2023-05-20 06:48:29', b'0'); | ||
| 496 | - | ||
| 497 | -INSERT INTO `system_dict_data`(`sort`,`label`,`value`,`dict_type`,`status`,`color_type`,`css_class`,`remark`,`creator`,`create_time`,`updater`,`update_time`,`deleted`) VALUES | ||
| 498 | - (1,'打',2,'product_unit',0,'','','',1, NOW(),1, NOW(),0), | ||
| 499 | - (1,'盒',3,'product_unit',0,'','','',1, NOW(),1, NOW(),0), | ||
| 500 | - (1,'袋',4,'product_unit',0,'','','',1, NOW(),1, NOW(),0), | ||
| 501 | - (1,'箱',5,'product_unit',0,'','','',1, NOW(),1, NOW(),0), | ||
| 502 | - (1,'套',6,'product_unit',0,'','','',1, NOW(),1, NOW(),0), | ||
| 503 | - (1,'包',7,'product_unit',0,'','','',1, NOW(),1, NOW(),0), | ||
| 504 | - (1,'双',8,'product_unit',0,'','','',1, NOW(),1, NOW(),0), | ||
| 505 | - (1,'卷',9,'product_unit',0,'','','',1, NOW(),1, NOW(),0), | ||
| 506 | - (1,'张',10,'product_unit',0,'','','',1, NOW(),1, NOW(),0), | ||
| 507 | - (1,'克',11,'product_unit',0,'','','',1, NOW(),1, NOW(),0), | ||
| 508 | - (1,'千克',12,'product_unit',0,'','','',1, NOW(),1, NOW(),0), | ||
| 509 | - (1,'毫克',13,'product_unit',0,'','','',1, NOW(),1, NOW(),0), | ||
| 510 | - (1,'微克',14,'product_unit',0,'','','',1, NOW(),1, NOW(),0), | ||
| 511 | - (1,'吨',15,'product_unit',0,'','','',1, NOW(),1, NOW(),0), | ||
| 512 | - (1,'升',16,'product_unit',0,'','','',1, NOW(),1, NOW(),0), | ||
| 513 | - (1,'毫升',17,'product_unit',0,'','','',1, NOW(),1, NOW(),0), | ||
| 514 | - (1, '平方米', 18, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), 0), | ||
| 515 | - (1, '平方千米', 19, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), 0), | ||
| 516 | - (1, '平方英里', 20, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), 0), | ||
| 517 | - (1, '平方码', 21, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), 0), | ||
| 518 | - (1, '平方英尺', 22, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), 0), | ||
| 519 | - (1, '立方米', 23, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), 0), | ||
| 520 | - (1, '立方厘米', 24, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), 0), | ||
| 521 | - (1, '立方英寸', 25, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), 0), | ||
| 522 | - (1, '米', 26, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), 0), | ||
| 523 | - (1, '千米', 27, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), 0), | ||
| 524 | - (1, '厘米', 28, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), 0), | ||
| 525 | - (1, '毫米', 29, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), 0), | ||
| 526 | - (1, '英寸', 30, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), 0), | ||
| 527 | - (1, '英尺', 31, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), 0), | ||
| 528 | - (1, '码', 32, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), 0), | ||
| 529 | - (1,'个',1,'product_unit',0,'','','',1, NOW(),1, NOW(),0); | 502 | +INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2164, '配送管理', '', 1, 0, 2072, 'delivery', '', '', '', 0, b'1', b'1', b'1', '1', '2023-05-18 09:18:02', '1', '2023-05-18 09:48:48', b'0'); |
| 503 | +INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2165, '快递发货', '', 1, 0, 2164, 'express', '', '', '', 0, b'1', b'1', b'1', '1', '2023-05-18 09:22:06', '1', '2023-05-18 09:22:06', b'0'); | ||
| 504 | +INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2166, '门店自提', '', 1, 1, 2164, 'pick-up-store', '', '', '', 0, b'1', b'1', b'1', '1', '2023-05-18 09:23:14', '1', '2023-05-18 09:23:14', b'0'); | ||
| 505 | +INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2167, '快递公司', '', 2, 0, 2165, 'express', '', 'mall/trade/delivery/express/index', 'Express', 0, b'1', b'1', b'1', '1', '2023-05-18 09:27:21', '1', '2023-05-18 22:11:14', b'0'); | ||
| 506 | +INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2168, '快递公司查询', 'trade:delivery:express:query', 3, 1, 2167, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-18 09:37:53', '', '2023-05-18 09:37:53', b'0'); | ||
| 507 | +INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2169, '快递公司创建', 'trade:delivery:express:create', 3, 2, 2167, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-18 09:37:53', '', '2023-05-18 09:37:53', b'0'); | ||
| 508 | +INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2170, '快递公司更新', 'trade:delivery:express:update', 3, 3, 2167, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-18 09:37:53', '', '2023-05-18 09:37:53', b'0'); | ||
| 509 | +INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2171, '快递公司删除', 'trade:delivery:express:delete', 3, 4, 2167, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-18 09:37:53', '', '2023-05-18 09:37:53', b'0'); | ||
| 510 | +INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2172, '快递公司导出', 'trade:delivery:express:export', 3, 5, 2167, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-18 09:37:53', '', '2023-05-18 09:37:53', b'0'); | ||
| 511 | +INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2178, '快递运费模板导出', 'trade:delivery:express-template:export', 3, 5, 2173, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-20 06:49:53', '', '2023-05-20 06:49:53', b'0'); | ||
| 512 | +INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2177, '快递运费模板删除', 'trade:delivery:express-template:delete', 3, 4, 2173, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-20 06:49:53', '', '2023-05-20 06:49:53', b'0'); | ||
| 513 | +INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2176, '快递运费模板更新', 'trade:delivery:express-template:update', 3, 3, 2173, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-20 06:49:53', '', '2023-05-20 06:49:53', b'0'); | ||
| 514 | +INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2175, '快递运费模板创建', 'trade:delivery:express-template:create', 3, 2, 2173, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-20 06:49:53', '', '2023-05-20 06:49:53', b'0'); | ||
| 515 | +INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2174, '快递运费模板查询', 'trade:delivery:express-template:query', 3, 1, 2173, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-20 06:49:53', '', '2023-05-20 06:49:53', b'0'); | ||
| 516 | +INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2173, '运费模版', 'trade:delivery:express-template:query', 2, 1, 2165, 'express-template', '', 'mall/trade/delivery/expressTemplate/index', 'ExpressTemplate', 0, b'1', b'1', b'1', '1', '2023-05-20 06:48:10', '1', '2023-05-20 06:48:29', b'0'); | ||
| 517 | +BEGIN; | ||
| 518 | + | ||
| 530 | -- ---------------------------- | 519 | -- ---------------------------- |
| 531 | --- 数字字典,快递计费方式 | 520 | +-- 字典管理,添加商品单位字典 product_unit |
| 532 | -- ---------------------------- | 521 | -- ---------------------------- |
| 533 | -INSERT INTO `ruoyi-vue-pro`.`system_dict_type`(`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (169, '快递计费方式', 'trade_delivery_express_charge_mode', 0, '用于商城交易模块配送管理', '1', '2023-05-21 22:45:03', '1', '2023-05-21 22:45:03', b'0', '1970-01-01 00:00:00'); | 522 | +BEGIN; |
| 523 | +INSERT INTO `ruoyi-vue-pro`.`system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (169, '商品单位', 'product_unit', 0, '', '1', '2023-05-21 22:45:03', '1', '2023-05-21 22:45:03', b'0', '1970-01-01 00:00:00'); | ||
| 524 | +INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '个', 1, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), b'0'); | ||
| 525 | +INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '件', 2, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), b'0'); | ||
| 526 | +INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '盒', 3, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), b'0'); | ||
| 527 | +INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '袋', 4, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), b'0'); | ||
| 528 | +INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '箱', 5, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), b'0'); | ||
| 529 | +INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '套', 6, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), b'0'); | ||
| 530 | +INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '包', 7, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), b'0'); | ||
| 531 | +INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '双', 8, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), b'0'); | ||
| 532 | +INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '卷', 9, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), b'0'); | ||
| 533 | +COMMIT; | ||
| 534 | 534 | ||
| 535 | -INSERT INTO `ruoyi-vue-pro`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1237, 2, '按体积', '3', 'trade_delivery_express_charge_mode', 0, '', '', '', '1', '2023-05-21 22:47:18', '1', '2023-05-21 22:47:18', b'0'); | ||
| 536 | -INSERT INTO `ruoyi-vue-pro`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1236, 1, '按重量', '2', 'trade_delivery_express_charge_mode', 0, '', '', '', '1', '2023-05-21 22:46:58', '1', '2023-05-21 22:46:58', b'0'); | ||
| 537 | -INSERT INTO `ruoyi-vue-pro`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1235, 0, '按件', '1', 'trade_delivery_express_charge_mode', 0, '', '', '', '1', '2023-05-21 22:46:40', '1', '2023-05-21 22:46:40', b'0'); | 535 | +-- ---------------------------- |
| 536 | +-- 数字字典,快递计费方式 | ||
| 537 | +-- ---------------------------- | ||
| 538 | +BEGIN; | ||
| 539 | +INSERT INTO `ruoyi-vue-pro`.`system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (169, '快递计费方式', 'trade_delivery_express_charge_mode', 0, '用于商城交易模块配送管理', '1', '2023-05-21 22:45:03', '1', '2023-05-21 22:45:03', b'0', '1970-01-01 00:00:00'); | ||
| 540 | +INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1237, 2, '按体积', '3', 'trade_delivery_express_charge_mode', 0, '', '', '', '1', '2023-05-21 22:47:18', '1', '2023-05-21 22:47:18', b'0'); | ||
| 541 | +INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1236, 1, '按重量', '2', 'trade_delivery_express_charge_mode', 0, '', '', '', '1', '2023-05-21 22:46:58', '1', '2023-05-21 22:46:58', b'0'); | ||
| 542 | +INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1235, 0, '按件', '1', 'trade_delivery_express_charge_mode', 0, '', '', '', '1', '2023-05-21 22:46:40', '1', '2023-05-21 22:46:40', b'0'); | ||
| 543 | +COMMIT; | ||
| 538 | \ No newline at end of file | 544 | \ No newline at end of file |
yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/DictTypeConstants.java
0 → 100644
yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/ErrorCodeConstants.java
| @@ -18,7 +18,7 @@ public interface ErrorCodeConstants { | @@ -18,7 +18,7 @@ public interface ErrorCodeConstants { | ||
| 18 | 18 | ||
| 19 | // ========== 商品品牌相关编号 1008002000 ========== | 19 | // ========== 商品品牌相关编号 1008002000 ========== |
| 20 | ErrorCode BRAND_NOT_EXISTS = new ErrorCode(1008002000, "品牌不存在"); | 20 | ErrorCode BRAND_NOT_EXISTS = new ErrorCode(1008002000, "品牌不存在"); |
| 21 | - ErrorCode BRAND_DISABLED = new ErrorCode(1008002001, "品牌不存在"); | 21 | + ErrorCode BRAND_DISABLED = new ErrorCode(1008002001, "品牌已禁用"); |
| 22 | ErrorCode BRAND_NAME_EXISTS = new ErrorCode(1008002002, "品牌名称已存在"); | 22 | ErrorCode BRAND_NAME_EXISTS = new ErrorCode(1008002002, "品牌名称已存在"); |
| 23 | 23 | ||
| 24 | // ========== 商品属性项 1008003000 ========== | 24 | // ========== 商品属性项 1008003000 ========== |
| @@ -32,8 +32,9 @@ public interface ErrorCodeConstants { | @@ -32,8 +32,9 @@ public interface ErrorCodeConstants { | ||
| 32 | 32 | ||
| 33 | // ========== 商品 SPU 1008005000 ========== | 33 | // ========== 商品 SPU 1008005000 ========== |
| 34 | ErrorCode SPU_NOT_EXISTS = new ErrorCode(1008005000, "商品 SPU 不存在"); | 34 | ErrorCode SPU_NOT_EXISTS = new ErrorCode(1008005000, "商品 SPU 不存在"); |
| 35 | - ErrorCode SPU_SAVE_FAIL_CATEGORY_LEVEL_ERROR = new ErrorCode(1008005001, "商品分类不正确,原因:必须使用第三级的商品分类下"); | 35 | + ErrorCode SPU_SAVE_FAIL_CATEGORY_LEVEL_ERROR = new ErrorCode(1008005001, "商品分类不正确,原因:必须使用第二级的商品分类及以下"); |
| 36 | ErrorCode SPU_NOT_ENABLE = new ErrorCode(1008005002, "商品 SPU 不处于上架状态"); | 36 | ErrorCode SPU_NOT_ENABLE = new ErrorCode(1008005002, "商品 SPU 不处于上架状态"); |
| 37 | + ErrorCode SPU_NOT_RECYCLE = new ErrorCode(1008005003, "商品 SPU 不处于回收站状态"); | ||
| 37 | 38 | ||
| 38 | // ========== 商品 SKU 1008006000 ========== | 39 | // ========== 商品 SKU 1008006000 ========== |
| 39 | ErrorCode SKU_NOT_EXISTS = new ErrorCode(1008006000, "商品 SKU 不存在"); | 40 | ErrorCode SKU_NOT_EXISTS = new ErrorCode(1008006000, "商品 SKU 不存在"); |
yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/ProductConstants.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.product.enums; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * Product 常量 TODO 把使用到的常量收拢到一块定义替换魔法值 | ||
| 5 | + * | ||
| 6 | + * @author HUIHUI | ||
| 7 | + */ | ||
| 8 | + | ||
| 9 | +public interface ProductConstants { | ||
| 10 | + /** | ||
| 11 | + * 父分类编号 - 根分类 | ||
| 12 | + */ | ||
| 13 | + Long PARENT_ID_NULL = 0L; | ||
| 14 | + /** | ||
| 15 | + * 限定分类层级 | ||
| 16 | + */ | ||
| 17 | + int CATEGORY_LEVEL = 2; | ||
| 18 | + /** | ||
| 19 | + * SPU 分页 tab 个数 | ||
| 20 | + */ | ||
| 21 | + int SPU_TAB_COUNTS = 5; | ||
| 22 | + /** | ||
| 23 | + * 警戒库存 TODO 警戒库存暂时为 10,后期需要使用常量或者数据库配置替换 | ||
| 24 | + */ | ||
| 25 | + int ALERT_STOCK = 10; | ||
| 26 | + /** | ||
| 27 | + * 默认商品销量 TODO 默认商品销量为零 | ||
| 28 | + */ | ||
| 29 | + Integer SALES_COUNT = 0; | ||
| 30 | + /** | ||
| 31 | + * 默认善品浏览量 TODO 默认浏览量为零 | ||
| 32 | + */ | ||
| 33 | + Integer BROWSE_COUNT = 0; | ||
| 34 | +} |
yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/spu/ProductSpuTabTypeEnum.java renamed to yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/spu/ProductSpuPageTabEnum.java
| 1 | package cn.iocoder.yudao.module.product.enums.spu; | 1 | package cn.iocoder.yudao.module.product.enums.spu; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.common.core.IntArrayValuable; | ||
| 3 | import lombok.AllArgsConstructor; | 4 | import lombok.AllArgsConstructor; |
| 4 | import lombok.Getter; | 5 | import lombok.Getter; |
| 5 | 6 | ||
| 7 | +import java.util.Arrays; | ||
| 8 | + | ||
| 6 | // TODO @puhui999:中英文之间要有空格; 商品 spu Tab 标签枚举;这个类可以改成 ProductSpuPageTabEnum 会更好一点哈;分页 Tab 的意思; | 9 | // TODO @puhui999:中英文之间要有空格; 商品 spu Tab 标签枚举;这个类可以改成 ProductSpuPageTabEnum 会更好一点哈;分页 Tab 的意思; |
| 7 | /** | 10 | /** |
| 8 | - * 商品spu标签枚举类型 | 11 | + * 商品 spu Tabs 标签枚举类型 |
| 9 | * | 12 | * |
| 10 | * @author HUIHUI | 13 | * @author HUIHUI |
| 11 | */ | 14 | */ |
| 12 | @Getter | 15 | @Getter |
| 13 | @AllArgsConstructor | 16 | @AllArgsConstructor |
| 14 | -public enum ProductSpuTabTypeEnum { | 17 | +public enum ProductSpuPageTabEnum implements IntArrayValuable { |
| 15 | 18 | ||
| 16 | FOR_SALE(0,"出售中商品"), | 19 | FOR_SALE(0,"出售中商品"), |
| 17 | IN_WAREHOUSE(1,"仓库中商品"), | 20 | IN_WAREHOUSE(1,"仓库中商品"), |
| 18 | SOLD_OUT(2,"已售空商品"), | 21 | SOLD_OUT(2,"已售空商品"), |
| 19 | ALERT_STOCK(3,"警戒库存"), | 22 | ALERT_STOCK(3,"警戒库存"), |
| 20 | RECYCLE_BIN(4,"商品回收站"); | 23 | RECYCLE_BIN(4,"商品回收站"); |
| 21 | - | 24 | + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ProductSpuPageTabEnum::getType).toArray(); |
| 22 | /** | 25 | /** |
| 23 | * 状态 | 26 | * 状态 |
| 24 | */ | 27 | */ |
| @@ -28,4 +31,8 @@ public enum ProductSpuTabTypeEnum { | @@ -28,4 +31,8 @@ public enum ProductSpuTabTypeEnum { | ||
| 28 | */ | 31 | */ |
| 29 | private final String name; | 32 | private final String name; |
| 30 | 33 | ||
| 34 | + @Override | ||
| 35 | + public int[] array() { | ||
| 36 | + return ARRAYS; | ||
| 37 | + } | ||
| 31 | } | 38 | } |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/brand/ProductBrandController.java
| 1 | package cn.iocoder.yudao.module.product.controller.admin.brand; | 1 | package cn.iocoder.yudao.module.product.controller.admin.brand; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | import cn.iocoder.yudao.module.product.controller.admin.brand.vo.*; | 6 | import cn.iocoder.yudao.module.product.controller.admin.brand.vo.*; |
| @@ -61,7 +62,14 @@ public class ProductBrandController { | @@ -61,7 +62,14 @@ public class ProductBrandController { | ||
| 61 | ProductBrandDO brand = brandService.getBrand(id); | 62 | ProductBrandDO brand = brandService.getBrand(id); |
| 62 | return success(ProductBrandConvert.INSTANCE.convert(brand)); | 63 | return success(ProductBrandConvert.INSTANCE.convert(brand)); |
| 63 | } | 64 | } |
| 64 | - | 65 | + @GetMapping("/list-all-simple") |
| 66 | + @Operation(summary = "获取品牌精简信息列表", description = "主要用于前端的下拉选项") | ||
| 67 | + public CommonResult<List<ProductBrandSimpleRespVO>> getSimpleUserList() { | ||
| 68 | + // 获取品牌列表,只要开启状态的 | ||
| 69 | + List<ProductBrandDO> list = brandService.getBrandListByStatus(CommonStatusEnum.ENABLE.getStatus()); | ||
| 70 | + // 排序后,返回给前端 | ||
| 71 | + return success(ProductBrandConvert.INSTANCE.convertList1(list)); | ||
| 72 | + } | ||
| 65 | @GetMapping("/page") | 73 | @GetMapping("/page") |
| 66 | @Operation(summary = "获得品牌分页") | 74 | @Operation(summary = "获得品牌分页") |
| 67 | @PreAuthorize("@ss.hasPermission('product:brand:query')") | 75 | @PreAuthorize("@ss.hasPermission('product:brand:query')") |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/brand/vo/ProductBrandSimpleRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.product.controller.admin.brand.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.AllArgsConstructor; | ||
| 5 | +import lombok.Data; | ||
| 6 | +import lombok.NoArgsConstructor; | ||
| 7 | + | ||
| 8 | +@Schema(description = "管理后台 - 品牌精简信息 Response VO") | ||
| 9 | +@Data | ||
| 10 | +@NoArgsConstructor | ||
| 11 | +@AllArgsConstructor | ||
| 12 | +public class ProductBrandSimpleRespVO { | ||
| 13 | + @Schema(description = "品牌编号", required = true, example = "1024") | ||
| 14 | + private Long id; | ||
| 15 | + @Schema(description = "品牌名称", required = true, example = "芋道") | ||
| 16 | + private String name; | ||
| 17 | +} |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuBaseVO.java
| 1 | package cn.iocoder.yudao.module.product.controller.admin.sku.vo; | 1 | package cn.iocoder.yudao.module.product.controller.admin.sku.vo; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO; | ||
| 4 | +import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyValueDO; | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 6 | +import lombok.AllArgsConstructor; | ||
| 4 | import lombok.Data; | 7 | import lombok.Data; |
| 8 | +import lombok.NoArgsConstructor; | ||
| 5 | 9 | ||
| 6 | import javax.validation.constraints.NotEmpty; | 10 | import javax.validation.constraints.NotEmpty; |
| 7 | import javax.validation.constraints.NotNull; | 11 | import javax.validation.constraints.NotNull; |
| @@ -41,20 +45,51 @@ public class ProductSkuBaseVO { | @@ -41,20 +45,51 @@ public class ProductSkuBaseVO { | ||
| 41 | @Schema(description = "预警预存", example = "1") | 45 | @Schema(description = "预警预存", example = "1") |
| 42 | private Integer warnStock; | 46 | private Integer warnStock; |
| 43 | 47 | ||
| 44 | - @Schema(description = "商品重量", example = "1") // 单位:kg 千克 | 48 | + @Schema(description = "商品重量,单位:kg 千克", example = "1") |
| 45 | private Double weight; | 49 | private Double weight; |
| 46 | 50 | ||
| 47 | - @Schema(description = "商品体积", example = "1024") // 单位:m^3 平米 | 51 | + @Schema(description = "商品体积,单位:m^3 平米", example = "1024") |
| 48 | private Double volume; | 52 | private Double volume; |
| 49 | - // TODO @pitui999:注释可以去掉,VO 使用 @Schema 作为注释 | ||
| 50 | - /** | ||
| 51 | - * 一级分销的佣金,单位:分 | ||
| 52 | - */ | ||
| 53 | - @Schema(description = "一级分销的佣金", example = "1024") | 53 | + |
| 54 | + @Schema(description = "一级分销的佣金,单位:分", example = "1024") | ||
| 54 | private Integer subCommissionFirstPrice; | 55 | private Integer subCommissionFirstPrice; |
| 56 | + | ||
| 57 | + @Schema(description = "二级分销的佣金,单位:分", example = "1024") | ||
| 58 | + private Integer subCommissionSecondPrice; | ||
| 59 | + | ||
| 55 | /** | 60 | /** |
| 56 | - * 二级分销的佣金,单位:分 | 61 | + * 商品属性 |
| 57 | */ | 62 | */ |
| 58 | - @Schema(description = "二级分销的佣金", example = "1024") | ||
| 59 | - private Integer subCommissionSecondPrice; | 63 | + @Data |
| 64 | + @NoArgsConstructor | ||
| 65 | + @AllArgsConstructor | ||
| 66 | + public static class Property { | ||
| 67 | + | ||
| 68 | + /** | ||
| 69 | + * 属性编号 | ||
| 70 | + * 关联 {@link ProductPropertyDO#getId()} | ||
| 71 | + */ | ||
| 72 | + private Long propertyId; | ||
| 73 | + /** | ||
| 74 | + * 属性名字 | ||
| 75 | + * 冗余 {@link ProductPropertyDO#getName()} | ||
| 76 | + * | ||
| 77 | + * 注意:每次属性名字发生变化时,需要更新该冗余 | ||
| 78 | + */ | ||
| 79 | + private String propertyName; | ||
| 80 | + | ||
| 81 | + /** | ||
| 82 | + * 属性值编号 | ||
| 83 | + * 关联 {@link ProductPropertyValueDO#getId()} | ||
| 84 | + */ | ||
| 85 | + private Long valueId; | ||
| 86 | + /** | ||
| 87 | + * 属性值名字 | ||
| 88 | + * 冗余 {@link ProductPropertyValueDO#getName()} | ||
| 89 | + * | ||
| 90 | + * 注意:每次属性值名字发生变化时,需要更新该冗余 | ||
| 91 | + */ | ||
| 92 | + private String valueName; | ||
| 93 | + | ||
| 94 | + } | ||
| 60 | } | 95 | } |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuCreateOrUpdateReqVO.java
| @@ -12,22 +12,6 @@ import java.util.List; | @@ -12,22 +12,6 @@ import java.util.List; | ||
| 12 | @ToString(callSuper = true) | 12 | @ToString(callSuper = true) |
| 13 | public class ProductSkuCreateOrUpdateReqVO extends ProductSkuBaseVO { | 13 | public class ProductSkuCreateOrUpdateReqVO extends ProductSkuBaseVO { |
| 14 | 14 | ||
| 15 | - @Schema(description = "商品属性") | ||
| 16 | - @Data | ||
| 17 | - @AllArgsConstructor | ||
| 18 | - @NoArgsConstructor | ||
| 19 | - public static class Property { | ||
| 20 | - | ||
| 21 | - @Schema(description = "属性编号", required = true, example = "1") | ||
| 22 | - @NotNull(message = "属性编号不能为空") | ||
| 23 | - private Long propertyId; | ||
| 24 | - | ||
| 25 | - @Schema(description = "属性值编号", required = true, example = "1024") | ||
| 26 | - @NotNull(message = "属性值编号不能为空") | ||
| 27 | - private Long valueId; | ||
| 28 | - | ||
| 29 | - } | ||
| 30 | - | ||
| 31 | /** | 15 | /** |
| 32 | * 属性数组 | 16 | * 属性数组 |
| 33 | */ | 17 | */ |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuRespVO.java
| @@ -15,27 +15,6 @@ public class ProductSkuRespVO extends ProductSkuBaseVO { | @@ -15,27 +15,6 @@ public class ProductSkuRespVO extends ProductSkuBaseVO { | ||
| 15 | @Schema(description = "主键", required = true, example = "1024") | 15 | @Schema(description = "主键", required = true, example = "1024") |
| 16 | private Long id; | 16 | private Long id; |
| 17 | 17 | ||
| 18 | - @Schema(description = "商品属性") | ||
| 19 | - @Data | ||
| 20 | - @AllArgsConstructor | ||
| 21 | - @NoArgsConstructor | ||
| 22 | - public static class Property { | ||
| 23 | - | ||
| 24 | - @Schema(description = "属性编号", required = true, example = "1") | ||
| 25 | - @NotNull(message = "属性编号不能为空") | ||
| 26 | - private Long propertyId; | ||
| 27 | - | ||
| 28 | - // TODO @puhui999:propertyName 是不是也返回下 | ||
| 29 | - | ||
| 30 | - @Schema(description = "属性值编号", required = true, example = "1024") | ||
| 31 | - @NotNull(message = "属性值编号不能为空") | ||
| 32 | - private Long valueId; | ||
| 33 | - | ||
| 34 | - @Schema(description = "属性值", example = "1024") | ||
| 35 | - private String valueName; | ||
| 36 | - | ||
| 37 | - } | ||
| 38 | - | ||
| 39 | /** | 18 | /** |
| 40 | * 属性数组 | 19 | * 属性数组 |
| 41 | */ | 20 | */ |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/ProductSpuController.java
| @@ -2,6 +2,9 @@ package cn.iocoder.yudao.module.product.controller.admin.spu; | @@ -2,6 +2,9 @@ package cn.iocoder.yudao.module.product.controller.admin.spu; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | ||
| 6 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | ||
| 7 | +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | ||
| 5 | import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; | 8 | import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; |
| 6 | import cn.iocoder.yudao.module.product.convert.spu.ProductSpuConvert; | 9 | import cn.iocoder.yudao.module.product.convert.spu.ProductSpuConvert; |
| 7 | import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; | 10 | import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; |
| @@ -16,12 +19,24 @@ import org.springframework.validation.annotation.Validated; | @@ -16,12 +19,24 @@ import org.springframework.validation.annotation.Validated; | ||
| 16 | import org.springframework.web.bind.annotation.*; | 19 | import org.springframework.web.bind.annotation.*; |
| 17 | 20 | ||
| 18 | import javax.annotation.Resource; | 21 | import javax.annotation.Resource; |
| 22 | +import javax.servlet.http.HttpServletResponse; | ||
| 19 | import javax.validation.Valid; | 23 | import javax.validation.Valid; |
| 24 | +import java.io.IOException; | ||
| 25 | +import java.util.ArrayList; | ||
| 26 | +import java.util.Collection; | ||
| 20 | import java.util.List; | 27 | import java.util.List; |
| 21 | import java.util.Map; | 28 | import java.util.Map; |
| 22 | 29 | ||
| 23 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 30 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 31 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; | ||
| 32 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | ||
| 33 | +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | ||
| 24 | 34 | ||
| 35 | +/** | ||
| 36 | + * 商品 SPU 相关接口 | ||
| 37 | + * | ||
| 38 | + * @author HUIHUI | ||
| 39 | + */ | ||
| 25 | @Tag(name = "管理后台 - 商品 SPU") | 40 | @Tag(name = "管理后台 - 商品 SPU") |
| 26 | @RestController | 41 | @RestController |
| 27 | @RequestMapping("/product/spu") | 42 | @RequestMapping("/product/spu") |
| @@ -30,10 +45,6 @@ public class ProductSpuController { | @@ -30,10 +45,6 @@ public class ProductSpuController { | ||
| 30 | 45 | ||
| 31 | @Resource | 46 | @Resource |
| 32 | private ProductSpuService productSpuService; | 47 | private ProductSpuService productSpuService; |
| 33 | - @Resource | ||
| 34 | - private ProductSkuService productSkuService; | ||
| 35 | - @Resource | ||
| 36 | - private ProductPropertyValueService productPropertyValueService; | ||
| 37 | 48 | ||
| 38 | @PostMapping("/create") | 49 | @PostMapping("/create") |
| 39 | @Operation(summary = "创建商品 SPU") | 50 | @Operation(summary = "创建商品 SPU") |
| @@ -50,7 +61,7 @@ public class ProductSpuController { | @@ -50,7 +61,7 @@ public class ProductSpuController { | ||
| 50 | return success(true); | 61 | return success(true); |
| 51 | } | 62 | } |
| 52 | 63 | ||
| 53 | - @PutMapping("/updateStatus") | 64 | + @PutMapping("/update-status") |
| 54 | @Operation(summary = "更新商品 SPU Status") | 65 | @Operation(summary = "更新商品 SPU Status") |
| 55 | @PreAuthorize("@ss.hasPermission('product:spu:update')") | 66 | @PreAuthorize("@ss.hasPermission('product:spu:update')") |
| 56 | public CommonResult<Boolean> updateStatus(@Valid @RequestBody ProductSpuUpdateStatusReqVO updateReqVO) { | 67 | public CommonResult<Boolean> updateStatus(@Valid @RequestBody ProductSpuUpdateStatusReqVO updateReqVO) { |
| @@ -86,16 +97,27 @@ public class ProductSpuController { | @@ -86,16 +97,27 @@ public class ProductSpuController { | ||
| 86 | @GetMapping("/page") | 97 | @GetMapping("/page") |
| 87 | @Operation(summary = "获得商品 SPU 分页") | 98 | @Operation(summary = "获得商品 SPU 分页") |
| 88 | @PreAuthorize("@ss.hasPermission('product:spu:query')") | 99 | @PreAuthorize("@ss.hasPermission('product:spu:query')") |
| 89 | - public CommonResult<PageResult<ProductSpuPageRespVO>> getSpuPage(@Valid ProductSpuPageReqVO pageVO) { | 100 | + public CommonResult<PageResult<ProductSpuRespVO>> getSpuPage(@Valid ProductSpuPageReqVO pageVO) { |
| 90 | return success(ProductSpuConvert.INSTANCE.convertPage(productSpuService.getSpuPage(pageVO))); | 101 | return success(ProductSpuConvert.INSTANCE.convertPage(productSpuService.getSpuPage(pageVO))); |
| 91 | } | 102 | } |
| 92 | - | ||
| 93 | - // TODO @tuihui999:get-count;另外,url 使用 - 拆分 | ||
| 94 | - @GetMapping("/tabsCount") | ||
| 95 | - @Operation(summary = "获得商品 SPU tabsCount") | 103 | + |
| 104 | + // TODO @tuihui999:get-count;另外,url 使用 - 拆分 fix | ||
| 105 | + @GetMapping("/get-count") | ||
| 106 | + @Operation(summary = "获得商品 SPU 分页 tab count") | ||
| 96 | @PreAuthorize("@ss.hasPermission('product:spu:query')") | 107 | @PreAuthorize("@ss.hasPermission('product:spu:query')") |
| 97 | public CommonResult<Map<Integer, Long>> getTabsCount() { | 108 | public CommonResult<Map<Integer, Long>> getTabsCount() { |
| 98 | return success(productSpuService.getTabsCount()); | 109 | return success(productSpuService.getTabsCount()); |
| 99 | } | 110 | } |
| 100 | 111 | ||
| 112 | + @GetMapping("/export") | ||
| 113 | + @Operation(summary = "导出用户") | ||
| 114 | + @PreAuthorize("@ss.hasPermission('product:spu:export')") | ||
| 115 | + @OperateLog(type = EXPORT) | ||
| 116 | + public void exportUserList(@Validated ProductSpuExportReqVO reqVO, | ||
| 117 | + HttpServletResponse response) throws IOException { | ||
| 118 | + List<ProductSpuDO> spuList = productSpuService.getSpuList(reqVO); | ||
| 119 | + // 导出 Excel | ||
| 120 | + List<ProductSpuExcelVO> datas = ProductSpuConvert.INSTANCE.convertList03(spuList); | ||
| 121 | + ExcelUtils.write(response, "商品spu.xls", "数据", ProductSpuExcelVO.class, datas); | ||
| 122 | + } | ||
| 101 | } | 123 | } |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuBaseVO.java
| 1 | package cn.iocoder.yudao.module.product.controller.admin.spu.vo; | 1 | package cn.iocoder.yudao.module.product.controller.admin.spu.vo; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum; | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | import lombok.Data; | 5 | import lombok.Data; |
| 5 | 6 | ||
| @@ -10,7 +11,9 @@ import java.util.List; | @@ -10,7 +11,9 @@ import java.util.List; | ||
| 10 | /** | 11 | /** |
| 11 | * 商品 SPU Base VO,提供给添加、修改、详细的子 VO 使用 | 12 | * 商品 SPU Base VO,提供给添加、修改、详细的子 VO 使用 |
| 12 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | 13 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 |
| 13 | -*/ | 14 | + * |
| 15 | + * @author HUIHUI | ||
| 16 | + */ | ||
| 14 | @Data | 17 | @Data |
| 15 | public class ProductSpuBaseVO { | 18 | public class ProductSpuBaseVO { |
| 16 | 19 | ||
| @@ -30,11 +33,12 @@ public class ProductSpuBaseVO { | @@ -30,11 +33,12 @@ public class ProductSpuBaseVO { | ||
| 30 | @NotEmpty(message = "商品详情不能为空") | 33 | @NotEmpty(message = "商品详情不能为空") |
| 31 | private String description; | 34 | private String description; |
| 32 | 35 | ||
| 33 | - @Schema(description = "商品分类编号", required = true, example = "芋道") | ||
| 34 | - @NotNull(message = "商品分类编号不能为空") | 36 | + @Schema(description = "商品分类编号", required = true, example = "1") |
| 37 | + @NotNull(message = "商品分类不能为空") | ||
| 35 | private Long categoryId; | 38 | private Long categoryId; |
| 36 | 39 | ||
| 37 | - @Schema(description = "商品品牌编号", required = true, example = "芋道") | 40 | + @Schema(description = "商品品牌编号", required = true, example = "1") |
| 41 | + @NotNull(message = "商品品牌不能为空") | ||
| 38 | private Long brandId; | 42 | private Long brandId; |
| 39 | 43 | ||
| 40 | @Schema(description = "商品封面图", required = true, example = "芋道") | 44 | @Schema(description = "商品封面图", required = true, example = "芋道") |
| @@ -96,16 +100,16 @@ public class ProductSpuBaseVO { | @@ -96,16 +100,16 @@ public class ProductSpuBaseVO { | ||
| 96 | @Schema(description = "赠送的优惠劵编号的数组") // TODO 这块前端还未实现 | 100 | @Schema(description = "赠送的优惠劵编号的数组") // TODO 这块前端还未实现 |
| 97 | private List<Long> giveCouponTemplateIds; | 101 | private List<Long> giveCouponTemplateIds; |
| 98 | 102 | ||
| 99 | - @Schema(description = "分销类型") | 103 | + @Schema(description = "分销类型", example = "true") |
| 100 | @NotNull(message = "商品分销类型不能为空") | 104 | @NotNull(message = "商品分销类型不能为空") |
| 101 | private Boolean subCommissionType; | 105 | private Boolean subCommissionType; |
| 102 | 106 | ||
| 103 | - @Schema(description = "活动展示顺序") // TODO 这块前端还未实现 | 107 | + @Schema(description = "活动展示顺序", example = "[1、3、2、4、5]") // TODO 这块前端还未实现 |
| 104 | private List<Integer> activityOrders; | 108 | private List<Integer> activityOrders; |
| 105 | 109 | ||
| 106 | // ========== 统计相关字段 ========= | 110 | // ========== 统计相关字段 ========= |
| 107 | 111 | ||
| 108 | - @Schema(description = "虚拟销量", required = true, example = "芋道") | 112 | + @Schema(description = "虚拟销量", example = "芋道") |
| 109 | private Integer virtualSalesCount; | 113 | private Integer virtualSalesCount; |
| 110 | 114 | ||
| 111 | } | 115 | } |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuCreateReqVO.java
| @@ -9,15 +9,20 @@ import lombok.ToString; | @@ -9,15 +9,20 @@ import lombok.ToString; | ||
| 9 | import javax.validation.Valid; | 9 | import javax.validation.Valid; |
| 10 | import java.util.List; | 10 | import java.util.List; |
| 11 | 11 | ||
| 12 | +/** | ||
| 13 | + * 商品 SPU 创建 Request VO | ||
| 14 | + * | ||
| 15 | + * @author HUIHUI | ||
| 16 | + */ | ||
| 12 | @Schema(description = "管理后台 - 商品 SPU 创建 Request VO") | 17 | @Schema(description = "管理后台 - 商品 SPU 创建 Request VO") |
| 13 | @Data | 18 | @Data |
| 14 | @EqualsAndHashCode(callSuper = true) | 19 | @EqualsAndHashCode(callSuper = true) |
| 15 | @ToString(callSuper = true) | 20 | @ToString(callSuper = true) |
| 16 | public class ProductSpuCreateReqVO extends ProductSpuBaseVO { | 21 | public class ProductSpuCreateReqVO extends ProductSpuBaseVO { |
| 17 | 22 | ||
| 18 | - /** | ||
| 19 | - * SKU 数组 | ||
| 20 | - */ | 23 | + // ========== SKU 相关字段 ========= |
| 24 | + | ||
| 25 | + @Schema(description = "SKU 数组") | ||
| 21 | @Valid | 26 | @Valid |
| 22 | private List<ProductSkuCreateOrUpdateReqVO> skus; | 27 | private List<ProductSkuCreateOrUpdateReqVO> skus; |
| 23 | 28 |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuDetailRespVO.java
| @@ -6,20 +6,36 @@ import lombok.Data; | @@ -6,20 +6,36 @@ import lombok.Data; | ||
| 6 | import lombok.EqualsAndHashCode; | 6 | import lombok.EqualsAndHashCode; |
| 7 | import lombok.ToString; | 7 | import lombok.ToString; |
| 8 | 8 | ||
| 9 | +import java.time.LocalDateTime; | ||
| 9 | import java.util.List; | 10 | import java.util.List; |
| 10 | 11 | ||
| 11 | -@Schema(description = "管理后台 - 商品 SPU 详细 Response VO") // 包括关联的 SKU 等信息 | 12 | +/** |
| 13 | + * 商品 SPU 详细 Response VO | ||
| 14 | + * 包括关联的 SKU 等信息 | ||
| 15 | + * | ||
| 16 | + * @author HUIHUI | ||
| 17 | + */ | ||
| 18 | +@Schema(description = "管理后台 - 商品 SPU 详细 Response VO") | ||
| 12 | @Data | 19 | @Data |
| 13 | @EqualsAndHashCode(callSuper = true) | 20 | @EqualsAndHashCode(callSuper = true) |
| 14 | @ToString(callSuper = true) | 21 | @ToString(callSuper = true) |
| 15 | public class ProductSpuDetailRespVO extends ProductSpuBaseVO { | 22 | public class ProductSpuDetailRespVO extends ProductSpuBaseVO { |
| 16 | 23 | ||
| 17 | - @Schema(description = "商品编号", example = "1") | 24 | + @Schema(description = "spuId") |
| 18 | private Long id; | 25 | private Long id; |
| 19 | 26 | ||
| 27 | + @Schema(description = "商品销量") | ||
| 28 | + private Integer salesCount; | ||
| 29 | + | ||
| 30 | + @Schema(description = "浏览量") | ||
| 31 | + private Integer browseCount; | ||
| 32 | + | ||
| 33 | + @Schema(description = "商品状态") | ||
| 34 | + private Integer status; | ||
| 35 | + | ||
| 20 | // ========== SKU 相关字段 ========= | 36 | // ========== SKU 相关字段 ========= |
| 21 | 37 | ||
| 22 | - @Schema(description = "SKU 数组", example = "1") | 38 | + @Schema(description = "SKU 数组") |
| 23 | private List<ProductSkuRespVO> skus; | 39 | private List<ProductSkuRespVO> skus; |
| 24 | 40 | ||
| 25 | } | 41 | } |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuExcelVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.product.controller.admin.spu.vo; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | ||
| 4 | +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | ||
| 5 | +import cn.iocoder.yudao.module.product.enums.DictTypeConstants; | ||
| 6 | +import com.alibaba.excel.annotation.ExcelProperty; | ||
| 7 | +import lombok.Data; | ||
| 8 | + | ||
| 9 | + | ||
| 10 | +import java.time.LocalDateTime; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * 商品 Spu Excel 导出 VO TODO 暂定 | ||
| 14 | + * | ||
| 15 | + * @author HUIHUI | ||
| 16 | + */ | ||
| 17 | +@Data | ||
| 18 | +public class ProductSpuExcelVO { | ||
| 19 | + @ExcelProperty("商品编号") | ||
| 20 | + private Long id; | ||
| 21 | + | ||
| 22 | + @ExcelProperty("商品名称") | ||
| 23 | + private String name; | ||
| 24 | + | ||
| 25 | + @ExcelProperty("关键字") | ||
| 26 | + private String keyword; | ||
| 27 | + | ||
| 28 | + @ExcelProperty("商品简介") | ||
| 29 | + private String introduction; | ||
| 30 | + | ||
| 31 | + @ExcelProperty("商品详情") | ||
| 32 | + private String description; | ||
| 33 | + | ||
| 34 | + @ExcelProperty("条形码") | ||
| 35 | + private String barCode; | ||
| 36 | + | ||
| 37 | + @ExcelProperty("商品分类编号") | ||
| 38 | + private Long categoryId; | ||
| 39 | + | ||
| 40 | + @ExcelProperty("商品品牌编号") | ||
| 41 | + private Long brandId; | ||
| 42 | + | ||
| 43 | + @ExcelProperty("商品封面图") | ||
| 44 | + private String picUrl; | ||
| 45 | + | ||
| 46 | + @ExcelProperty("商品轮播图地址") | ||
| 47 | + private String sliderPicUrls; | ||
| 48 | + | ||
| 49 | + @ExcelProperty("商品视频") | ||
| 50 | + private String videoUrl; | ||
| 51 | + | ||
| 52 | + @ExcelProperty(value = "商品单位", converter = DictConvert.class) | ||
| 53 | + @DictFormat(DictTypeConstants.PRODUCT_UNIT) | ||
| 54 | + private Integer unit; | ||
| 55 | + | ||
| 56 | + @ExcelProperty("排序字段") | ||
| 57 | + private Integer sort; | ||
| 58 | + | ||
| 59 | + @ExcelProperty(value = "商品状态", converter = DictConvert.class) | ||
| 60 | + @DictFormat(DictTypeConstants.PRODUCT_SPU_STATUS) | ||
| 61 | + private Integer status; | ||
| 62 | + | ||
| 63 | + @ExcelProperty("规格类型") | ||
| 64 | + private Boolean specType; | ||
| 65 | + | ||
| 66 | + @ExcelProperty("商品价格") | ||
| 67 | + private Integer price; | ||
| 68 | + | ||
| 69 | + @ExcelProperty("市场价") | ||
| 70 | + private Integer marketPrice; | ||
| 71 | + | ||
| 72 | + @ExcelProperty("成本价") | ||
| 73 | + private Integer costPrice; | ||
| 74 | + | ||
| 75 | + @ExcelProperty("库存") | ||
| 76 | + private Integer stock; | ||
| 77 | + | ||
| 78 | + @ExcelProperty("物流配置模板编号") | ||
| 79 | + private Long deliveryTemplateId; | ||
| 80 | + | ||
| 81 | + @ExcelProperty("是否热卖推荐") | ||
| 82 | + private Boolean recommendHot; | ||
| 83 | + | ||
| 84 | + @ExcelProperty("是否优惠推荐") | ||
| 85 | + private Boolean recommendBenefit; | ||
| 86 | + | ||
| 87 | + @ExcelProperty("是否精品推荐") | ||
| 88 | + private Boolean recommendBest; | ||
| 89 | + | ||
| 90 | + @ExcelProperty("是否新品推荐") | ||
| 91 | + private Boolean recommendNew; | ||
| 92 | + | ||
| 93 | + @ExcelProperty("是否优品推荐") | ||
| 94 | + private Boolean recommendGood; | ||
| 95 | + | ||
| 96 | + @ExcelProperty("赠送积分") | ||
| 97 | + private Integer giveIntegral; | ||
| 98 | + | ||
| 99 | + @ExcelProperty("赠送的优惠劵编号的数组") | ||
| 100 | + private String giveCouponTemplateIds; | ||
| 101 | + | ||
| 102 | + @ExcelProperty("分销类型") | ||
| 103 | + private Boolean subCommissionType; | ||
| 104 | + | ||
| 105 | + @ExcelProperty("活动显示排序") | ||
| 106 | + private String activityOrders; | ||
| 107 | + | ||
| 108 | + @ExcelProperty("商品销量") | ||
| 109 | + private Integer salesCount; | ||
| 110 | + | ||
| 111 | + @ExcelProperty("虚拟销量") | ||
| 112 | + private Integer virtualSalesCount; | ||
| 113 | + | ||
| 114 | + @ExcelProperty("商品点击量") | ||
| 115 | + private Integer browseCount; | ||
| 116 | + | ||
| 117 | + @ExcelProperty("创建时间") | ||
| 118 | + private LocalDateTime createTime; | ||
| 119 | +} |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuExportReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.product.controller.admin.spu.vo; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | ||
| 4 | +import cn.iocoder.yudao.module.product.enums.spu.ProductSpuPageTabEnum; | ||
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 6 | +import lombok.AllArgsConstructor; | ||
| 7 | +import lombok.Data; | ||
| 8 | +import lombok.NoArgsConstructor; | ||
| 9 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 10 | + | ||
| 11 | +import java.time.LocalDateTime; | ||
| 12 | + | ||
| 13 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 14 | +@Schema(description = "管理后台 - 商品Spu导出 Request VO,参数和 ProductSpuPageReqVO 是一致的") | ||
| 15 | +@Data | ||
| 16 | +@NoArgsConstructor | ||
| 17 | +@AllArgsConstructor | ||
| 18 | +public class ProductSpuExportReqVO { | ||
| 19 | + @Schema(description = "商品名称", example = "yutou") | ||
| 20 | + private String name; | ||
| 21 | + | ||
| 22 | + @Schema(description = "前端请求的tab类型", example = "1") | ||
| 23 | + @InEnum(ProductSpuPageTabEnum.class) | ||
| 24 | + private Integer tabType; | ||
| 25 | + | ||
| 26 | + @Schema(description = "商品分类编号") | ||
| 27 | + private Long categoryId; | ||
| 28 | + | ||
| 29 | + @Schema(description = "创建时间", example = "[2022-07-01 00:00:00,2022-07-01 23:59:59]") | ||
| 30 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 31 | + private LocalDateTime[] createTime; | ||
| 32 | +} |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuPageReqVO.java
| 1 | package cn.iocoder.yudao.module.product.controller.admin.spu.vo; | 1 | package cn.iocoder.yudao.module.product.controller.admin.spu.vo; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageParam; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 4 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | ||
| 5 | +import cn.iocoder.yudao.module.product.enums.spu.ProductSpuPageTabEnum; | ||
| 4 | import io.swagger.v3.oas.annotations.media.Schema; | 6 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | import lombok.Data; | 7 | import lombok.Data; |
| 6 | import lombok.EqualsAndHashCode; | 8 | import lombok.EqualsAndHashCode; |
| 7 | import lombok.ToString; | 9 | import lombok.ToString; |
| 8 | import org.springframework.format.annotation.DateTimeFormat; | 10 | import org.springframework.format.annotation.DateTimeFormat; |
| 9 | 11 | ||
| 12 | +import javax.validation.constraints.NotNull; | ||
| 10 | import java.time.LocalDateTime; | 13 | import java.time.LocalDateTime; |
| 11 | 14 | ||
| 12 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | 15 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 13 | 16 | ||
| 17 | +/** | ||
| 18 | + * 商品 SPU 分页 Request VO | ||
| 19 | + * | ||
| 20 | + * @author HUIHUI | ||
| 21 | + */ | ||
| 14 | @Schema(description = "管理后台 - 商品 SPU 分页 Request VO") | 22 | @Schema(description = "管理后台 - 商品 SPU 分页 Request VO") |
| 15 | @Data | 23 | @Data |
| 16 | @EqualsAndHashCode(callSuper = true) | 24 | @EqualsAndHashCode(callSuper = true) |
| @@ -20,10 +28,13 @@ public class ProductSpuPageReqVO extends PageParam { | @@ -20,10 +28,13 @@ public class ProductSpuPageReqVO extends PageParam { | ||
| 20 | @Schema(description = "商品名称", example = "yutou") | 28 | @Schema(description = "商品名称", example = "yutou") |
| 21 | private String name; | 29 | private String name; |
| 22 | 30 | ||
| 23 | - // TODO @puhui999:加下 @InEnum 校验 | ||
| 24 | @Schema(description = "前端请求的tab类型", example = "1") | 31 | @Schema(description = "前端请求的tab类型", example = "1") |
| 32 | + @InEnum(ProductSpuPageTabEnum.class) | ||
| 25 | private Integer tabType; | 33 | private Integer tabType; |
| 26 | 34 | ||
| 35 | + @Schema(description = "商品分类编号") | ||
| 36 | + private Long categoryId; | ||
| 37 | + | ||
| 27 | @Schema(description = "创建时间", example = "[2022-07-01 00:00:00,2022-07-01 23:59:59]") | 38 | @Schema(description = "创建时间", example = "[2022-07-01 00:00:00,2022-07-01 23:59:59]") |
| 28 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | 39 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| 29 | private LocalDateTime[] createTime; | 40 | private LocalDateTime[] createTime; |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuPageRespVO.java deleted
| 1 | -package cn.iocoder.yudao.module.product.controller.admin.spu.vo; | ||
| 2 | - | ||
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | -import lombok.Data; | ||
| 5 | - | ||
| 6 | -import java.time.LocalDateTime; | ||
| 7 | - | ||
| 8 | -// TODO @puhui999:可以直接继承 ProductSpuRespVO 么?一般情况下,多返回一些字段问题不大的;另外,是不是使用 ProductSpuRespVO 替代 | ||
| 9 | -@Schema(description = "管理后台 - 商品 SPU 分页 response VO") | ||
| 10 | -@Data | ||
| 11 | -public class ProductSpuPageRespVO { | ||
| 12 | - | ||
| 13 | - @Schema(description = "spuId", example = "1") | ||
| 14 | - private Long id; | ||
| 15 | - @Schema(description = "商品封面图", example = "1") | ||
| 16 | - private String picUrl; | ||
| 17 | - @Schema(description = "商品名称", example = "1") | ||
| 18 | - private String name; | ||
| 19 | - @Schema(description = "商品价格", example = "1") | ||
| 20 | - private Integer price; | ||
| 21 | - @Schema(description = "商品销量", example = "1") | ||
| 22 | - private Integer salesCount; | ||
| 23 | - @Schema(description = "商品排序", example = "1") | ||
| 24 | - private Integer stock; | ||
| 25 | - @Schema(description = "商品封面图", example = "1") | ||
| 26 | - private Integer sort; | ||
| 27 | - @Schema(description = "商品创建时间", example = "1") | ||
| 28 | - private LocalDateTime createTime; | ||
| 29 | - @Schema(description = "商品状态", example = "1") | ||
| 30 | - private Integer status; | ||
| 31 | - | ||
| 32 | -} |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuRespVO.java
| 1 | package cn.iocoder.yudao.module.product.controller.admin.spu.vo; | 1 | package cn.iocoder.yudao.module.product.controller.admin.spu.vo; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | import lombok.Data; | 5 | import lombok.Data; |
| 5 | import lombok.EqualsAndHashCode; | 6 | import lombok.EqualsAndHashCode; |
| @@ -7,16 +8,39 @@ import lombok.ToString; | @@ -7,16 +8,39 @@ import lombok.ToString; | ||
| 7 | 8 | ||
| 8 | import java.time.LocalDateTime; | 9 | import java.time.LocalDateTime; |
| 9 | 10 | ||
| 11 | +/** | ||
| 12 | + * 商品 SPU Response VO | ||
| 13 | + * TODO 移除ProductSpuPageRespVO相关应用跟换为ProductSpuRespVO已继承ProductSpuBaseVO 补全表格展示所需属性 | ||
| 14 | + * @author HUIHUI | ||
| 15 | + */ | ||
| 10 | @Schema(description = "管理后台 - 商品 SPU Response VO") | 16 | @Schema(description = "管理后台 - 商品 SPU Response VO") |
| 11 | @Data | 17 | @Data |
| 12 | @EqualsAndHashCode(callSuper = true) | 18 | @EqualsAndHashCode(callSuper = true) |
| 13 | @ToString(callSuper = true) | 19 | @ToString(callSuper = true) |
| 14 | public class ProductSpuRespVO extends ProductSpuBaseVO { | 20 | public class ProductSpuRespVO extends ProductSpuBaseVO { |
| 15 | 21 | ||
| 16 | - @Schema(description = "主键", required = true, example = "1") | 22 | + @Schema(description = "spuId") |
| 17 | private Long id; | 23 | private Long id; |
| 18 | 24 | ||
| 19 | - @Schema(description = "创建时间") | 25 | + @Schema(description = "商品价格") |
| 26 | + private Integer price; | ||
| 27 | + | ||
| 28 | + @Schema(description = "商品销量") | ||
| 29 | + private Integer salesCount; | ||
| 30 | + | ||
| 31 | + @Schema(description = "市场价,单位使用:分") | ||
| 32 | + private Integer marketPrice; | ||
| 33 | + | ||
| 34 | + @Schema(description = "成本价,单位使用:分") | ||
| 35 | + private Integer costPrice; | ||
| 36 | + | ||
| 37 | + @Schema(description = "商品库存") | ||
| 38 | + private Integer stock; | ||
| 39 | + | ||
| 40 | + @Schema(description = "商品创建时间") | ||
| 20 | private LocalDateTime createTime; | 41 | private LocalDateTime createTime; |
| 21 | 42 | ||
| 43 | + @Schema(description = "商品状态") | ||
| 44 | + private Integer status; | ||
| 45 | + | ||
| 22 | } | 46 | } |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuSimpleRespVO.java
| 1 | package cn.iocoder.yudao.module.product.controller.admin.spu.vo; | 1 | package cn.iocoder.yudao.module.product.controller.admin.spu.vo; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | import lombok.Data; | 5 | import lombok.Data; |
| 5 | import lombok.EqualsAndHashCode; | 6 | import lombok.EqualsAndHashCode; |
| 6 | import lombok.ToString; | 7 | import lombok.ToString; |
| 7 | 8 | ||
| 9 | +/** | ||
| 10 | + * 商品 SPU 精简 Response VO | ||
| 11 | + * TODO 商品 SPU 精简 VO 暂时没有使用到,用到的时候再按需添加\修改属性 | ||
| 12 | + * @author HUIHUI | ||
| 13 | + */ | ||
| 8 | @Schema(description = "管理后台 - 商品 SPU 精简 Response VO") | 14 | @Schema(description = "管理后台 - 商品 SPU 精简 Response VO") |
| 9 | @Data | 15 | @Data |
| 10 | -@EqualsAndHashCode(callSuper = true) | ||
| 11 | @ToString(callSuper = true) | 16 | @ToString(callSuper = true) |
| 12 | -public class ProductSpuSimpleRespVO extends ProductSpuBaseVO { | 17 | +public class ProductSpuSimpleRespVO { |
| 13 | 18 | ||
| 14 | - @Schema(description = "主键", required = true, example = "1") | 19 | + @Schema(description = "主键") |
| 15 | private Long id; | 20 | private Long id; |
| 16 | 21 | ||
| 17 | - @Schema(description = "商品名称", required = true, example = "芋道") | 22 | + @Schema(description = "商品名称") |
| 18 | private String name; | 23 | private String name; |
| 19 | 24 | ||
| 20 | - @Schema(description = " 最小价格,单位使用:分", required = true, example = "1024") | ||
| 21 | - private Integer minPrice; | 25 | + @Schema(description = "商品价格,单位使用:分") |
| 26 | + private Integer price; | ||
| 22 | 27 | ||
| 23 | - @Schema(description = "最大价格,单位使用:分", required = true, example = "1024") | ||
| 24 | - private Integer maxPrice; | 28 | + @Schema(description = "商品市场价,单位使用:分") |
| 29 | + private Integer marketPrice; | ||
| 30 | + | ||
| 31 | + @Schema(description = "商品成本价,单位使用:分") | ||
| 32 | + private Integer costPrice; | ||
| 33 | + | ||
| 34 | + @Schema(description = "商品库存") | ||
| 35 | + private Integer stock; | ||
| 36 | + | ||
| 37 | + // ========== 统计相关字段 ========= | ||
| 38 | + | ||
| 39 | + @Schema(description = "商品销量") | ||
| 40 | + private Integer salesCount; | ||
| 41 | + | ||
| 42 | + @Schema(description = "商品虚拟销量") | ||
| 43 | + private Integer virtualSalesCount; | ||
| 44 | + | ||
| 45 | + @Schema(description = "商品浏览量") | ||
| 46 | + private Integer browseCount; | ||
| 25 | 47 | ||
| 26 | } | 48 | } |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuUpdateReqVO.java
| 1 | package cn.iocoder.yudao.module.product.controller.admin.spu.vo; | 1 | package cn.iocoder.yudao.module.product.controller.admin.spu.vo; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | ||
| 3 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuCreateOrUpdateReqVO; | 4 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuCreateOrUpdateReqVO; |
| 5 | +import cn.iocoder.yudao.module.product.enums.spu.ProductSpuPageTabEnum; | ||
| 6 | +import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum; | ||
| 4 | import io.swagger.v3.oas.annotations.media.Schema; | 7 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | import lombok.Data; | 8 | import lombok.Data; |
| 6 | import lombok.EqualsAndHashCode; | 9 | import lombok.EqualsAndHashCode; |
| @@ -8,8 +11,14 @@ import lombok.ToString; | @@ -8,8 +11,14 @@ import lombok.ToString; | ||
| 8 | 11 | ||
| 9 | import javax.validation.Valid; | 12 | import javax.validation.Valid; |
| 10 | import javax.validation.constraints.NotNull; | 13 | import javax.validation.constraints.NotNull; |
| 14 | +import java.time.LocalDateTime; | ||
| 11 | import java.util.List; | 15 | import java.util.List; |
| 12 | 16 | ||
| 17 | +/** | ||
| 18 | + * 商品 SPU 更新 Request VO | ||
| 19 | + * | ||
| 20 | + * @author HUIHUI | ||
| 21 | + */ | ||
| 13 | @Schema(description = "管理后台 - 商品 SPU 更新 Request VO") | 22 | @Schema(description = "管理后台 - 商品 SPU 更新 Request VO") |
| 14 | @Data | 23 | @Data |
| 15 | @EqualsAndHashCode(callSuper = true) | 24 | @EqualsAndHashCode(callSuper = true) |
| @@ -20,9 +29,19 @@ public class ProductSpuUpdateReqVO extends ProductSpuBaseVO { | @@ -20,9 +29,19 @@ public class ProductSpuUpdateReqVO extends ProductSpuBaseVO { | ||
| 20 | @NotNull(message = "商品编号不能为空") | 29 | @NotNull(message = "商品编号不能为空") |
| 21 | private Long id; | 30 | private Long id; |
| 22 | 31 | ||
| 23 | - /** | ||
| 24 | - * SKU 数组 | ||
| 25 | - */ | 32 | + @Schema(description = "商品销量") |
| 33 | + private Integer salesCount; | ||
| 34 | + | ||
| 35 | + @Schema(description = "浏览量") | ||
| 36 | + private Integer browseCount; | ||
| 37 | + | ||
| 38 | + @Schema(description = "商品状态") | ||
| 39 | + @InEnum(ProductSpuStatusEnum.class) | ||
| 40 | + private Integer status; | ||
| 41 | + | ||
| 42 | + // ========== SKU 相关字段 ========= | ||
| 43 | + | ||
| 44 | + @Schema(description = "SKU 数组") | ||
| 26 | @Valid | 45 | @Valid |
| 27 | private List<ProductSkuCreateOrUpdateReqVO> skus; | 46 | private List<ProductSkuCreateOrUpdateReqVO> skus; |
| 28 | 47 |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuUpdateStatusReqVO.java
| 1 | package cn.iocoder.yudao.module.product.controller.admin.spu.vo; | 1 | package cn.iocoder.yudao.module.product.controller.admin.spu.vo; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | ||
| 3 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuCreateOrUpdateReqVO; | 4 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuCreateOrUpdateReqVO; |
| 5 | +import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum; | ||
| 4 | import io.swagger.v3.oas.annotations.media.Schema; | 6 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | import lombok.Data; | 7 | import lombok.Data; |
| 6 | import lombok.EqualsAndHashCode; | 8 | import lombok.EqualsAndHashCode; |
| @@ -10,6 +12,11 @@ import javax.validation.Valid; | @@ -10,6 +12,11 @@ import javax.validation.Valid; | ||
| 10 | import javax.validation.constraints.NotNull; | 12 | import javax.validation.constraints.NotNull; |
| 11 | import java.util.List; | 13 | import java.util.List; |
| 12 | 14 | ||
| 15 | +/** | ||
| 16 | + * 商品 SPU Status 更新 Request VO | ||
| 17 | + * | ||
| 18 | + * @author HUIHUI | ||
| 19 | + */ | ||
| 13 | @Schema(description = "管理后台 - 商品 SPU Status 更新 Request VO") | 20 | @Schema(description = "管理后台 - 商品 SPU Status 更新 Request VO") |
| 14 | @Data | 21 | @Data |
| 15 | public class ProductSpuUpdateStatusReqVO{ | 22 | public class ProductSpuUpdateStatusReqVO{ |
| @@ -20,7 +27,7 @@ public class ProductSpuUpdateStatusReqVO{ | @@ -20,7 +27,7 @@ public class ProductSpuUpdateStatusReqVO{ | ||
| 20 | 27 | ||
| 21 | @Schema(description = "商品状态", required = true, example = "1") | 28 | @Schema(description = "商品状态", required = true, example = "1") |
| 22 | @NotNull(message = "商品状态不能为空") | 29 | @NotNull(message = "商品状态不能为空") |
| 30 | + @InEnum(ProductSpuStatusEnum.class) | ||
| 23 | private Integer status; | 31 | private Integer status; |
| 24 | 32 | ||
| 25 | - | ||
| 26 | } | 33 | } |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/brand/ProductBrandConvert.java
| @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.product.convert.brand; | @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.product.convert.brand; | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.module.product.controller.admin.brand.vo.ProductBrandCreateReqVO; | 4 | import cn.iocoder.yudao.module.product.controller.admin.brand.vo.ProductBrandCreateReqVO; |
| 5 | import cn.iocoder.yudao.module.product.controller.admin.brand.vo.ProductBrandRespVO; | 5 | import cn.iocoder.yudao.module.product.controller.admin.brand.vo.ProductBrandRespVO; |
| 6 | +import cn.iocoder.yudao.module.product.controller.admin.brand.vo.ProductBrandSimpleRespVO; | ||
| 6 | import cn.iocoder.yudao.module.product.controller.admin.brand.vo.ProductBrandUpdateReqVO; | 7 | import cn.iocoder.yudao.module.product.controller.admin.brand.vo.ProductBrandUpdateReqVO; |
| 7 | import cn.iocoder.yudao.module.product.dal.dataobject.brand.ProductBrandDO; | 8 | import cn.iocoder.yudao.module.product.dal.dataobject.brand.ProductBrandDO; |
| 8 | import org.mapstruct.Mapper; | 9 | import org.mapstruct.Mapper; |
| @@ -25,7 +26,7 @@ public interface ProductBrandConvert { | @@ -25,7 +26,7 @@ public interface ProductBrandConvert { | ||
| 25 | ProductBrandDO convert(ProductBrandUpdateReqVO bean); | 26 | ProductBrandDO convert(ProductBrandUpdateReqVO bean); |
| 26 | 27 | ||
| 27 | ProductBrandRespVO convert(ProductBrandDO bean); | 28 | ProductBrandRespVO convert(ProductBrandDO bean); |
| 28 | - | 29 | + List<ProductBrandSimpleRespVO> convertList1(List<ProductBrandDO> list); |
| 29 | List<ProductBrandRespVO> convertList(List<ProductBrandDO> list); | 30 | List<ProductBrandRespVO> convertList(List<ProductBrandDO> list); |
| 30 | 31 | ||
| 31 | PageResult<ProductBrandRespVO> convertPage(PageResult<ProductBrandDO> page); | 32 | PageResult<ProductBrandRespVO> convertPage(PageResult<ProductBrandDO> page); |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/ProductSpuConvert.java
| 1 | package cn.iocoder.yudao.module.product.convert.spu; | 1 | package cn.iocoder.yudao.module.product.convert.spu; |
| 2 | +import java.time.LocalDateTime; | ||
| 2 | 3 | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 4 | import cn.hutool.core.collection.CollUtil; |
| 5 | +import cn.hutool.core.util.StrUtil; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; | 7 | import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; |
| 6 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueDetailRespVO; | 8 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueDetailRespVO; |
| @@ -10,6 +12,7 @@ import cn.iocoder.yudao.module.product.controller.app.property.vo.value.AppProdu | @@ -10,6 +12,7 @@ import cn.iocoder.yudao.module.product.controller.app.property.vo.value.AppProdu | ||
| 10 | import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuDetailRespVO; | 12 | import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuDetailRespVO; |
| 11 | import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageReqVO; | 13 | import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageReqVO; |
| 12 | import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageItemRespVO; | 14 | import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageItemRespVO; |
| 15 | +import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert; | ||
| 13 | import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; | 16 | import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; |
| 14 | import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; | 17 | import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; |
| 15 | import cn.iocoder.yudao.module.product.service.property.bo.ProductPropertyValueDetailRespBO; | 18 | import cn.iocoder.yudao.module.product.service.property.bo.ProductPropertyValueDetailRespBO; |
| @@ -19,6 +22,9 @@ import org.mapstruct.factory.Mappers; | @@ -19,6 +22,9 @@ import org.mapstruct.factory.Mappers; | ||
| 19 | import java.util.ArrayList; | 22 | import java.util.ArrayList; |
| 20 | import java.util.List; | 23 | import java.util.List; |
| 21 | import java.util.Map; | 24 | import java.util.Map; |
| 25 | +import java.util.Set; | ||
| 26 | +import java.util.function.Function; | ||
| 27 | +import java.util.stream.Collectors; | ||
| 22 | 28 | ||
| 23 | import static cn.hutool.core.util.ObjectUtil.defaultIfNull; | 29 | import static cn.hutool.core.util.ObjectUtil.defaultIfNull; |
| 24 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | 30 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; |
| @@ -34,46 +40,63 @@ public interface ProductSpuConvert { | @@ -34,46 +40,63 @@ public interface ProductSpuConvert { | ||
| 34 | ProductSpuConvert INSTANCE = Mappers.getMapper(ProductSpuConvert.class); | 40 | ProductSpuConvert INSTANCE = Mappers.getMapper(ProductSpuConvert.class); |
| 35 | 41 | ||
| 36 | ProductSpuDO convert(ProductSpuCreateReqVO bean); | 42 | ProductSpuDO convert(ProductSpuCreateReqVO bean); |
| 37 | - // TODO 还是使用convert,重命名改动太多 | 43 | + |
| 38 | ProductSpuDO convert(ProductSpuUpdateReqVO bean); | 44 | ProductSpuDO convert(ProductSpuUpdateReqVO bean); |
| 39 | 45 | ||
| 40 | List<ProductSpuDO> convertList(List<ProductSpuDO> list); | 46 | List<ProductSpuDO> convertList(List<ProductSpuDO> list); |
| 41 | 47 | ||
| 42 | - PageResult<ProductSpuPageRespVO> convertPage(PageResult<ProductSpuDO> page); | 48 | + PageResult<ProductSpuRespVO> convertPage(PageResult<ProductSpuDO> page); |
| 43 | 49 | ||
| 44 | ProductSpuPageReqVO convert(AppProductSpuPageReqVO bean); | 50 | ProductSpuPageReqVO convert(AppProductSpuPageReqVO bean); |
| 45 | 51 | ||
| 46 | List<ProductSpuRespDTO> convertList2(List<ProductSpuDO> list); | 52 | List<ProductSpuRespDTO> convertList2(List<ProductSpuDO> list); |
| 47 | 53 | ||
| 48 | List<ProductSpuSimpleRespVO> convertList02(List<ProductSpuDO> list); | 54 | List<ProductSpuSimpleRespVO> convertList02(List<ProductSpuDO> list); |
| 49 | - | ||
| 50 | - // TODO @puhui999:是不是可以删除啦 | ||
| 51 | - default ProductSpuDetailRespVO convert03(ProductSpuDO spu, List<ProductSkuDO> skus, | ||
| 52 | - List<ProductPropertyValueDetailRespBO> propertyValues) { | ||
| 53 | - ProductSpuDetailRespVO spuVO = convert03(spu); | ||
| 54 | - spuVO.setSkus(convertList04(skus)); | ||
| 55 | - // 处理商品属性 | ||
| 56 | - Map<Long, ProductPropertyValueDetailRespBO> propertyValueMap = convertMap(propertyValues, ProductPropertyValueDetailRespBO::getValueId); | ||
| 57 | - for (int i = 0; i < skus.size(); i++) { | ||
| 58 | - List<ProductSkuDO.Property> properties = skus.get(i).getProperties(); | ||
| 59 | - if (CollUtil.isEmpty(properties)) { | ||
| 60 | - continue; | ||
| 61 | - } | ||
| 62 | - ProductSkuRespVO sku = spuVO.getSkus().get(i); | ||
| 63 | - sku.setProperties(new ArrayList<>(properties.size())); | ||
| 64 | - // 遍历每个 properties,设置到 AppSpuDetailRespVO.Sku 中 | ||
| 65 | - properties.forEach(property -> { | ||
| 66 | - ProductPropertyValueDetailRespBO propertyValue = propertyValueMap.get(property.getValueId()); | ||
| 67 | - if (propertyValue == null) { | ||
| 68 | - return; | ||
| 69 | - } | ||
| 70 | - //sku.getProperties().add(convert04(propertyValue)); TODO 需要重写 | ||
| 71 | - }); | ||
| 72 | - } | ||
| 73 | - return spuVO; | 55 | + default List<ProductSpuExcelVO> convertList03(List<ProductSpuDO> list){ |
| 56 | + ArrayList<ProductSpuExcelVO> spuExcelVOs = new ArrayList<>(); | ||
| 57 | + list.forEach((spu)->{ | ||
| 58 | + ProductSpuExcelVO spuExcelVO = new ProductSpuExcelVO(); | ||
| 59 | + spuExcelVO.setId(spu.getId()); | ||
| 60 | + spuExcelVO.setName(spu.getName()); | ||
| 61 | + spuExcelVO.setKeyword(spu.getKeyword()); | ||
| 62 | + spuExcelVO.setIntroduction(spu.getIntroduction()); | ||
| 63 | + spuExcelVO.setDescription(spu.getDescription()); | ||
| 64 | + spuExcelVO.setBarCode(spu.getBarCode()); | ||
| 65 | + spuExcelVO.setCategoryId(spu.getCategoryId()); | ||
| 66 | + spuExcelVO.setBrandId(spu.getBrandId()); | ||
| 67 | + spuExcelVO.setPicUrl(spu.getPicUrl()); | ||
| 68 | + spuExcelVO.setSliderPicUrls(StrUtil.toString(spu.getSliderPicUrls())); | ||
| 69 | + spuExcelVO.setVideoUrl(spu.getVideoUrl()); | ||
| 70 | + spuExcelVO.setUnit(spu.getUnit()); | ||
| 71 | + spuExcelVO.setSort(spu.getSort()); | ||
| 72 | + spuExcelVO.setStatus(spu.getStatus()); | ||
| 73 | + spuExcelVO.setSpecType(spu.getSpecType()); | ||
| 74 | + spuExcelVO.setPrice(spu.getPrice()/100); | ||
| 75 | + spuExcelVO.setMarketPrice(spu.getMarketPrice()/100); | ||
| 76 | + spuExcelVO.setCostPrice(spu.getCostPrice()/100); | ||
| 77 | + spuExcelVO.setStock(spu.getStock()); | ||
| 78 | + spuExcelVO.setDeliveryTemplateId(spu.getDeliveryTemplateId()); | ||
| 79 | + spuExcelVO.setRecommendHot(spu.getRecommendHot()); | ||
| 80 | + spuExcelVO.setRecommendBenefit(spu.getRecommendBenefit()); | ||
| 81 | + spuExcelVO.setRecommendBest(spu.getRecommendBest()); | ||
| 82 | + spuExcelVO.setRecommendNew(spu.getRecommendNew()); | ||
| 83 | + spuExcelVO.setRecommendGood(spu.getRecommendGood()); | ||
| 84 | + spuExcelVO.setGiveIntegral(spu.getGiveIntegral()); | ||
| 85 | + spuExcelVO.setGiveCouponTemplateIds(StrUtil.toString(spu.getGiveCouponTemplateIds())); // TODO 暂定 | ||
| 86 | + spuExcelVO.setSubCommissionType(spu.getSubCommissionType()); | ||
| 87 | + spuExcelVO.setActivityOrders(StrUtil.toString(spu.getActivityOrders())); // TODO 暂定 | ||
| 88 | + spuExcelVO.setSalesCount(spu.getSalesCount()); | ||
| 89 | + spuExcelVO.setVirtualSalesCount(spu.getVirtualSalesCount()); | ||
| 90 | + spuExcelVO.setBrowseCount(spu.getBrowseCount()); | ||
| 91 | + spuExcelVO.setCreateTime(spu.getCreateTime()); | ||
| 92 | + spuExcelVOs.add(spuExcelVO); | ||
| 93 | + }); | ||
| 94 | + return spuExcelVOs; | ||
| 74 | } | 95 | } |
| 75 | ProductSpuDetailRespVO convert03(ProductSpuDO spu); | 96 | ProductSpuDetailRespVO convert03(ProductSpuDO spu); |
| 97 | + | ||
| 76 | List<ProductSkuRespVO> convertList04(List<ProductSkuDO> skus); | 98 | List<ProductSkuRespVO> convertList04(List<ProductSkuDO> skus); |
| 99 | + | ||
| 77 | ProductPropertyValueDetailRespVO convert04(ProductPropertyValueDetailRespBO propertyValue); | 100 | ProductPropertyValueDetailRespVO convert04(ProductPropertyValueDetailRespBO propertyValue); |
| 78 | 101 | ||
| 79 | // ========== 用户 App 相关 ========== | 102 | // ========== 用户 App 相关 ========== |
| @@ -84,6 +107,7 @@ public interface ProductSpuConvert { | @@ -84,6 +107,7 @@ public interface ProductSpuConvert { | ||
| 84 | // 然后进行转换 | 107 | // 然后进行转换 |
| 85 | return convertPageForGetSpuPage0(page); | 108 | return convertPageForGetSpuPage0(page); |
| 86 | } | 109 | } |
| 110 | + | ||
| 87 | PageResult<AppProductSpuPageItemRespVO> convertPageForGetSpuPage0(PageResult<ProductSpuDO> page); | 111 | PageResult<AppProductSpuPageItemRespVO> convertPageForGetSpuPage0(PageResult<ProductSpuDO> page); |
| 88 | 112 | ||
| 89 | default AppProductSpuDetailRespVO convertForGetSpuDetail(ProductSpuDO spu, List<ProductSkuDO> skus, | 113 | default AppProductSpuDetailRespVO convertForGetSpuDetail(ProductSpuDO spu, List<ProductSkuDO> skus, |
| @@ -111,8 +135,32 @@ public interface ProductSpuConvert { | @@ -111,8 +135,32 @@ public interface ProductSpuConvert { | ||
| 111 | } | 135 | } |
| 112 | return spuVO; | 136 | return spuVO; |
| 113 | } | 137 | } |
| 138 | + | ||
| 114 | AppProductSpuDetailRespVO convertForGetSpuDetail(ProductSpuDO spu); | 139 | AppProductSpuDetailRespVO convertForGetSpuDetail(ProductSpuDO spu); |
| 140 | + | ||
| 115 | List<AppProductSpuDetailRespVO.Sku> convertListForGetSpuDetail(List<ProductSkuDO> skus); | 141 | List<AppProductSpuDetailRespVO.Sku> convertListForGetSpuDetail(List<ProductSkuDO> skus); |
| 142 | + | ||
| 116 | AppProductPropertyValueDetailRespVO convertForGetSpuDetail(ProductPropertyValueDetailRespBO propertyValue); | 143 | AppProductPropertyValueDetailRespVO convertForGetSpuDetail(ProductPropertyValueDetailRespBO propertyValue); |
| 117 | 144 | ||
| 145 | + default ProductSpuDetailRespVO convertForSpuDetailRespVO(ProductSpuDO spu, List<ProductSkuDO> skus, Function<Set<Long>, List<ProductPropertyValueDetailRespBO>> func) { | ||
| 146 | + ProductSpuDetailRespVO productSpuDetailRespVO = convert03(spu); | ||
| 147 | + if (CollUtil.isNotEmpty(skus)) { | ||
| 148 | + List<ProductSkuRespVO> skuVOs = ProductSkuConvert.INSTANCE.convertList(skus); | ||
| 149 | + // fix:统一模型,即使是单规格,也查询下,如若Properties为空报错则为单属性不做处理 | ||
| 150 | + try { | ||
| 151 | + // 获取所有的属性值 id | ||
| 152 | + Set<Long> valueIds = skus.stream().flatMap(p -> p.getProperties().stream()) | ||
| 153 | + .map(ProductSkuDO.Property::getValueId) | ||
| 154 | + .collect(Collectors.toSet()); | ||
| 155 | + List<ProductPropertyValueDetailRespBO> valueDetailList = func.apply(valueIds); | ||
| 156 | + Map<Long, String> stringMap = valueDetailList.stream().collect(Collectors.toMap(ProductPropertyValueDetailRespBO::getValueId, ProductPropertyValueDetailRespBO::getValueName)); | ||
| 157 | + // 设置属性值名称 | ||
| 158 | + skuVOs.stream().flatMap(p -> p.getProperties().stream()).forEach(item -> item.setValueName(stringMap.get(item.getValueId()))); | ||
| 159 | + } catch (Exception ignored) { | ||
| 160 | + } | ||
| 161 | + productSpuDetailRespVO.setSkus(skuVOs); | ||
| 162 | + } | ||
| 163 | + return productSpuDetailRespVO; | ||
| 164 | + } | ||
| 165 | + | ||
| 118 | } | 166 | } |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/category/ProductCategoryDO.java
| @@ -19,12 +19,6 @@ import lombok.*; | @@ -19,12 +19,6 @@ import lombok.*; | ||
| 19 | @NoArgsConstructor | 19 | @NoArgsConstructor |
| 20 | @AllArgsConstructor | 20 | @AllArgsConstructor |
| 21 | public class ProductCategoryDO extends BaseDO { | 21 | public class ProductCategoryDO extends BaseDO { |
| 22 | - | ||
| 23 | - /** | ||
| 24 | - * 父分类编号 - 根分类 | ||
| 25 | - */ | ||
| 26 | - public static final Long PARENT_ID_NULL = 0L; | ||
| 27 | - | ||
| 28 | /** | 22 | /** |
| 29 | * 分类编号 | 23 | * 分类编号 |
| 30 | */ | 24 | */ |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/ProductPropertyDO.java
| 1 | package cn.iocoder.yudao.module.product.dal.dataobject.property; | 1 | package cn.iocoder.yudao.module.product.dal.dataobject.property; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 3 | import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; | 4 | import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; |
| 4 | import com.baomidou.mybatisplus.annotation.KeySequence; | 5 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 5 | import com.baomidou.mybatisplus.annotation.TableId; | 6 | import com.baomidou.mybatisplus.annotation.TableId; |
| @@ -19,7 +20,7 @@ import lombok.*; | @@ -19,7 +20,7 @@ import lombok.*; | ||
| 19 | @Builder | 20 | @Builder |
| 20 | @NoArgsConstructor | 21 | @NoArgsConstructor |
| 21 | @AllArgsConstructor | 22 | @AllArgsConstructor |
| 22 | -public class ProductPropertyDO extends TenantBaseDO { // TODO @puhui999:这里是不是用 BaseDO 就可以了? | 23 | +public class ProductPropertyDO extends BaseDO { |
| 23 | 24 | ||
| 24 | /** | 25 | /** |
| 25 | * 主键 | 26 | * 主键 |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/ProductPropertyValueDO.java
| 1 | package cn.iocoder.yudao.module.product.dal.dataobject.property; | 1 | package cn.iocoder.yudao.module.product.dal.dataobject.property; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 3 | import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; | 4 | import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; |
| 4 | import com.baomidou.mybatisplus.annotation.KeySequence; | 5 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 5 | import com.baomidou.mybatisplus.annotation.TableId; | 6 | import com.baomidou.mybatisplus.annotation.TableId; |
| @@ -20,7 +21,7 @@ import lombok.*; | @@ -20,7 +21,7 @@ import lombok.*; | ||
| 20 | @Builder | 21 | @Builder |
| 21 | @NoArgsConstructor | 22 | @NoArgsConstructor |
| 22 | @AllArgsConstructor | 23 | @AllArgsConstructor |
| 23 | -public class ProductPropertyValueDO extends TenantBaseDO { // TODO @puhui999:这里是不是用 BaseDO 就可以了? | 24 | +public class ProductPropertyValueDO extends BaseDO { |
| 24 | 25 | ||
| 25 | /** | 26 | /** |
| 26 | * 主键 | 27 | * 主键 |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/ProductSkuDO.java
| 1 | package cn.iocoder.yudao.module.product.dal.dataobject.sku; | 1 | package cn.iocoder.yudao.module.product.dal.dataobject.sku; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | 3 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| 4 | -import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; | 4 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 5 | import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO; | 5 | import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO; |
| 6 | import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyValueDO; | 6 | import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyValueDO; |
| 7 | import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; | 7 | import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; |
| @@ -27,7 +27,7 @@ import java.util.List; | @@ -27,7 +27,7 @@ import java.util.List; | ||
| 27 | @Builder | 27 | @Builder |
| 28 | @NoArgsConstructor | 28 | @NoArgsConstructor |
| 29 | @AllArgsConstructor | 29 | @AllArgsConstructor |
| 30 | -public class ProductSkuDO extends TenantBaseDO { // TODO @puhui999:这里是不是用 BaseDO 就可以了? | 30 | +public class ProductSkuDO extends BaseDO { |
| 31 | 31 | ||
| 32 | /** | 32 | /** |
| 33 | * 商品 SKU 编号,自增 | 33 | * 商品 SKU 编号,自增 |
| @@ -105,33 +105,29 @@ public class ProductSkuDO extends TenantBaseDO { // TODO @puhui999:这里是 | @@ -105,33 +105,29 @@ public class ProductSkuDO extends TenantBaseDO { // TODO @puhui999:这里是 | ||
| 105 | 105 | ||
| 106 | /** | 106 | /** |
| 107 | * 属性编号 | 107 | * 属性编号 |
| 108 | - * | ||
| 109 | * 关联 {@link ProductPropertyDO#getId()} | 108 | * 关联 {@link ProductPropertyDO#getId()} |
| 110 | */ | 109 | */ |
| 111 | private Long propertyId; | 110 | private Long propertyId; |
| 112 | - ///** | ||
| 113 | - // * 属性名字 | ||
| 114 | - // * | ||
| 115 | - // * 冗余 {@link ProductPropertyDO#getName()} | ||
| 116 | - // * | ||
| 117 | - // * 注意:每次属性名字发生变化时,需要更新该冗余 | ||
| 118 | - // */ TODO @puhui999:与已有代码逻辑存在冲突;芋艿:冲突点是啥呀? | ||
| 119 | - //private String propertyName; | 111 | + /** |
| 112 | + * 属性名字 | ||
| 113 | + * 冗余 {@link ProductPropertyDO#getName()} | ||
| 114 | + * | ||
| 115 | + * 注意:每次属性名字发生变化时,需要更新该冗余 | ||
| 116 | + */ | ||
| 117 | + private String propertyName; | ||
| 120 | 118 | ||
| 121 | /** | 119 | /** |
| 122 | * 属性值编号 | 120 | * 属性值编号 |
| 123 | - * | ||
| 124 | * 关联 {@link ProductPropertyValueDO#getId()} | 121 | * 关联 {@link ProductPropertyValueDO#getId()} |
| 125 | */ | 122 | */ |
| 126 | private Long valueId; | 123 | private Long valueId; |
| 127 | - ///** | ||
| 128 | - // * 属性值名字 | ||
| 129 | - // * | ||
| 130 | - // * 冗余 {@link ProductPropertyValueDO#getName()} | ||
| 131 | - // * | ||
| 132 | - // * 注意:每次属性值名字发生变化时,需要更新该冗余 | ||
| 133 | - // */ TODO @puhui999:与已有代码逻辑存在冲突;芋艿:冲突点是啥呀? | ||
| 134 | - //private String valueName; | 124 | + /** |
| 125 | + * 属性值名字 | ||
| 126 | + * 冗余 {@link ProductPropertyValueDO#getName()} | ||
| 127 | + * | ||
| 128 | + * 注意:每次属性值名字发生变化时,需要更新该冗余 | ||
| 129 | + */ | ||
| 130 | + private String valueName; | ||
| 135 | 131 | ||
| 136 | } | 132 | } |
| 137 | 133 |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/ProductSpuDO.java
| 1 | package cn.iocoder.yudao.module.product.dal.dataobject.spu; | 1 | package cn.iocoder.yudao.module.product.dal.dataobject.spu; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; | 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | import cn.iocoder.yudao.module.product.dal.dataobject.brand.ProductBrandDO; | 4 | import cn.iocoder.yudao.module.product.dal.dataobject.brand.ProductBrandDO; |
| 5 | import cn.iocoder.yudao.module.product.dal.dataobject.category.ProductCategoryDO; | 5 | import cn.iocoder.yudao.module.product.dal.dataobject.category.ProductCategoryDO; |
| 6 | import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; | 6 | import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; |
| @@ -27,7 +27,7 @@ import java.util.List; | @@ -27,7 +27,7 @@ import java.util.List; | ||
| 27 | @Builder | 27 | @Builder |
| 28 | @NoArgsConstructor | 28 | @NoArgsConstructor |
| 29 | @AllArgsConstructor | 29 | @AllArgsConstructor |
| 30 | -public class ProductSpuDO extends TenantBaseDO { | 30 | +public class ProductSpuDO extends BaseDO { |
| 31 | 31 | ||
| 32 | /** | 32 | /** |
| 33 | * 商品 SPU 编号,自增 | 33 | * 商品 SPU 编号,自增 |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/brand/ProductBrandMapper.java
| @@ -31,4 +31,7 @@ public interface ProductBrandMapper extends BaseMapperX<ProductBrandDO> { | @@ -31,4 +31,7 @@ public interface ProductBrandMapper extends BaseMapperX<ProductBrandDO> { | ||
| 31 | return selectOne(ProductBrandDO::getName, name); | 31 | return selectOne(ProductBrandDO::getName, name); |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | + default List<ProductBrandDO> selectListByStatus(Integer status){ | ||
| 35 | + return selectList(ProductBrandDO::getStatus,status); | ||
| 36 | + } | ||
| 34 | } | 37 | } |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/ProductSpuMapper.java
| 1 | package cn.iocoder.yudao.module.product.dal.mysql.spu; | 1 | package cn.iocoder.yudao.module.product.dal.mysql.spu; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.util.ObjUtil; | 3 | import cn.hutool.core.util.ObjUtil; |
| 4 | +import cn.hutool.core.util.ObjectUtil; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 6 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 6 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | 7 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 8 | +import cn.iocoder.yudao.module.product.controller.admin.spu.vo.ProductSpuExportReqVO; | ||
| 7 | import cn.iocoder.yudao.module.product.controller.admin.spu.vo.ProductSpuPageReqVO; | 9 | import cn.iocoder.yudao.module.product.controller.admin.spu.vo.ProductSpuPageReqVO; |
| 8 | import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageReqVO; | 10 | import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageReqVO; |
| 9 | import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; | 11 | import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; |
| 12 | +import cn.iocoder.yudao.module.product.enums.ProductConstants; | ||
| 10 | import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum; | 13 | import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum; |
| 11 | -import cn.iocoder.yudao.module.product.enums.spu.ProductSpuTabTypeEnum; | 14 | +import cn.iocoder.yudao.module.product.enums.spu.ProductSpuPageTabEnum; |
| 15 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
| 12 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | 16 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| 17 | +import com.baomidou.mybatisplus.core.toolkit.support.SFunction; | ||
| 13 | import org.apache.ibatis.annotations.Mapper; | 18 | import org.apache.ibatis.annotations.Mapper; |
| 19 | +import org.apache.poi.ss.formula.functions.T; | ||
| 14 | 20 | ||
| 21 | +import java.util.List; | ||
| 15 | import java.util.Objects; | 22 | import java.util.Objects; |
| 16 | import java.util.Set; | 23 | import java.util.Set; |
| 17 | 24 | ||
| 18 | @Mapper | 25 | @Mapper |
| 19 | public interface ProductSpuMapper extends BaseMapperX<ProductSpuDO> { | 26 | public interface ProductSpuMapper extends BaseMapperX<ProductSpuDO> { |
| 20 | 27 | ||
| 28 | + /** | ||
| 29 | + * 获取 商品 SPU 分页列表数据 | ||
| 30 | + * | ||
| 31 | + * @param reqVO 分页请求参数 | ||
| 32 | + * @return 商品 SPU 分页列表数据 | ||
| 33 | + */ | ||
| 21 | default PageResult<ProductSpuDO> selectPage(ProductSpuPageReqVO reqVO) { | 34 | default PageResult<ProductSpuDO> selectPage(ProductSpuPageReqVO reqVO) { |
| 22 | - // TODO @puhui999:多个 tab,写 if else 去补条件,可阅读性会好点哈 | ||
| 23 | - return selectPage(reqVO, new LambdaQueryWrapperX<ProductSpuDO>() | ||
| 24 | - // 商品名称 | 35 | + Integer tabType = reqVO.getTabType(); |
| 36 | + LambdaQueryWrapperX<ProductSpuDO> queryWrapper = new LambdaQueryWrapperX<ProductSpuDO>() | ||
| 25 | .likeIfPresent(ProductSpuDO::getName, reqVO.getName()) | 37 | .likeIfPresent(ProductSpuDO::getName, reqVO.getName()) |
| 38 | + .eqIfPresent(ProductSpuDO::getCategoryId, reqVO.getCategoryId()) | ||
| 26 | .betweenIfPresent(ProductSpuDO::getCreateTime, reqVO.getCreateTime()) | 39 | .betweenIfPresent(ProductSpuDO::getCreateTime, reqVO.getCreateTime()) |
| 27 | - // 出售中商品 | ||
| 28 | - .eq(ProductSpuTabTypeEnum.FOR_SALE.getType().equals(reqVO.getTabType()),ProductSpuDO::getStatus,ProductSpuStatusEnum.ENABLE.getStatus()) | ||
| 29 | - // 仓储中商品 | ||
| 30 | - .eq(ProductSpuTabTypeEnum.IN_WAREHOUSE.getType().equals(reqVO.getTabType()),ProductSpuDO::getStatus,ProductSpuStatusEnum.DISABLE.getStatus()) | ||
| 31 | - // 已售空商品 | ||
| 32 | - .eq(ProductSpuTabTypeEnum.SOLD_OUT.getType().equals(reqVO.getTabType()),ProductSpuDO::getStock,0) | ||
| 33 | - // TODO @phuui999:警戒库存暂时为 10,后期需要使用常量或者数据库配置替换 | ||
| 34 | - .le(ProductSpuTabTypeEnum.ALERT_STOCK.getType().equals(reqVO.getTabType()),ProductSpuDO::getStock,10) | ||
| 35 | - // 回收站 | ||
| 36 | - .eq(ProductSpuTabTypeEnum.RECYCLE_BIN.getType().equals(reqVO.getTabType()),ProductSpuDO::getStatus,ProductSpuStatusEnum.RECYCLE.getStatus()) | ||
| 37 | - .orderByDesc(ProductSpuDO::getSort)); | 40 | + .orderByDesc(ProductSpuDO::getSort); |
| 41 | + validateTabType(tabType, queryWrapper); | ||
| 42 | + return selectPage(reqVO, queryWrapper); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * 获取库存小于value且状态不等于status的的个数 | ||
| 47 | + */ | ||
| 48 | + default Long selectCountByStockAndStatus() { | ||
| 49 | + LambdaQueryWrapperX<ProductSpuDO> queryWrapper = new LambdaQueryWrapperX<>(); | ||
| 50 | + queryWrapper.le(ProductSpuDO::getStock, ProductConstants.ALERT_STOCK) | ||
| 51 | + // 如果库存触发警戒库存且状态为回收站的话则不计入触发警戒库存的个数 | ||
| 52 | + .and(q -> q.ne(ProductSpuDO::getStatus, ProductSpuStatusEnum.RECYCLE.getStatus())); | ||
| 53 | + return selectCount(queryWrapper); | ||
| 38 | } | 54 | } |
| 39 | 55 | ||
| 40 | /** | 56 | /** |
| @@ -42,10 +58,12 @@ public interface ProductSpuMapper extends BaseMapperX<ProductSpuDO> { | @@ -42,10 +58,12 @@ public interface ProductSpuMapper extends BaseMapperX<ProductSpuDO> { | ||
| 42 | */ | 58 | */ |
| 43 | default PageResult<ProductSpuDO> selectPage(AppProductSpuPageReqVO pageReqVO, Set<Long> categoryIds) { | 59 | default PageResult<ProductSpuDO> selectPage(AppProductSpuPageReqVO pageReqVO, Set<Long> categoryIds) { |
| 44 | LambdaQueryWrapperX<ProductSpuDO> query = new LambdaQueryWrapperX<ProductSpuDO>() | 60 | LambdaQueryWrapperX<ProductSpuDO> query = new LambdaQueryWrapperX<ProductSpuDO>() |
| 45 | - .likeIfPresent(ProductSpuDO::getName, pageReqVO.getKeyword()) // 关键字匹配,目前只匹配商品名 | ||
| 46 | - .inIfPresent(ProductSpuDO::getCategoryId, categoryIds); // 分类 | ||
| 47 | - query.eq(ProductSpuDO::getStatus, ProductSpuStatusEnum.ENABLE.getStatus()) // 上架状态 | ||
| 48 | - .gt(ProductSpuDO::getStock, 0); // 有库存 | 61 | + // 关键字匹配,目前只匹配商品名 |
| 62 | + .likeIfPresent(ProductSpuDO::getName, pageReqVO.getKeyword()) | ||
| 63 | + // 分类 | ||
| 64 | + .inIfPresent(ProductSpuDO::getCategoryId, categoryIds); | ||
| 65 | + // 上架状态 且有库存 | ||
| 66 | + query.eq(ProductSpuDO::getStatus, ProductSpuStatusEnum.ENABLE.getStatus()).gt(ProductSpuDO::getStock, 0); | ||
| 49 | // 推荐类型的过滤条件 | 67 | // 推荐类型的过滤条件 |
| 50 | if (ObjUtil.equal(pageReqVO.getRecommendType(), AppProductSpuPageReqVO.RECOMMEND_TYPE_HOT)) { | 68 | if (ObjUtil.equal(pageReqVO.getRecommendType(), AppProductSpuPageReqVO.RECOMMEND_TYPE_HOT)) { |
| 51 | query.eq(ProductSpuDO::getRecommendHot, true); | 69 | query.eq(ProductSpuDO::getRecommendHot, true); |
| @@ -66,14 +84,60 @@ public interface ProductSpuMapper extends BaseMapperX<ProductSpuDO> { | @@ -66,14 +84,60 @@ public interface ProductSpuMapper extends BaseMapperX<ProductSpuDO> { | ||
| 66 | /** | 84 | /** |
| 67 | * 更新商品 SPU 库存 | 85 | * 更新商品 SPU 库存 |
| 68 | * | 86 | * |
| 69 | - * @param id 商品 SPU 编号 | 87 | + * @param id 商品 SPU 编号 |
| 70 | * @param incrCount 增加的库存数量 | 88 | * @param incrCount 增加的库存数量 |
| 71 | */ | 89 | */ |
| 72 | default void updateStock(Long id, Integer incrCount) { | 90 | default void updateStock(Long id, Integer incrCount) { |
| 73 | LambdaUpdateWrapper<ProductSpuDO> updateWrapper = new LambdaUpdateWrapper<ProductSpuDO>() | 91 | LambdaUpdateWrapper<ProductSpuDO> updateWrapper = new LambdaUpdateWrapper<ProductSpuDO>() |
| 74 | - .setSql(" total_stock = total_stock +" + incrCount) // 负数,所以使用 + 号 | 92 | + // 负数,所以使用 + 号 |
| 93 | + .setSql(" stock = stock +" + incrCount) | ||
| 75 | .eq(ProductSpuDO::getId, id); | 94 | .eq(ProductSpuDO::getId, id); |
| 76 | update(null, updateWrapper); | 95 | update(null, updateWrapper); |
| 77 | } | 96 | } |
| 78 | 97 | ||
| 98 | + /** | ||
| 99 | + * 获得 Spu 列表 | ||
| 100 | + * | ||
| 101 | + * @param reqVO 查询条件 | ||
| 102 | + * @return Spu 列表 | ||
| 103 | + */ | ||
| 104 | + default List<ProductSpuDO> selectList(ProductSpuExportReqVO reqVO){ | ||
| 105 | + Integer tabType = reqVO.getTabType(); | ||
| 106 | + LambdaQueryWrapperX<ProductSpuDO> queryWrapper = new LambdaQueryWrapperX<>(); | ||
| 107 | + queryWrapper.eqIfPresent(ProductSpuDO::getName,reqVO.getName()); | ||
| 108 | + queryWrapper.eqIfPresent(ProductSpuDO::getCategoryId,reqVO.getCategoryId()); | ||
| 109 | + queryWrapper.betweenIfPresent(ProductSpuDO::getCreateTime,reqVO.getCreateTime()); | ||
| 110 | + validateTabType(tabType, queryWrapper); | ||
| 111 | + return selectList(queryWrapper); | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + /** | ||
| 115 | + * 验证选项卡类型构建条件 | ||
| 116 | + * | ||
| 117 | + * @param tabType 标签类型 | ||
| 118 | + * @param queryWrapper 查询条件 | ||
| 119 | + */ | ||
| 120 | + static void validateTabType(Integer tabType, LambdaQueryWrapperX<ProductSpuDO> queryWrapper) { | ||
| 121 | + if (ObjectUtil.equals(ProductSpuPageTabEnum.FOR_SALE.getType(), tabType)) { | ||
| 122 | + // 出售中商品 | ||
| 123 | + queryWrapper.eqIfPresent(ProductSpuDO::getStatus, ProductSpuStatusEnum.ENABLE.getStatus()); | ||
| 124 | + } | ||
| 125 | + if (ObjectUtil.equals(ProductSpuPageTabEnum.IN_WAREHOUSE.getType(), tabType)) { | ||
| 126 | + // 仓储中商品 | ||
| 127 | + queryWrapper.eqIfPresent(ProductSpuDO::getStatus, ProductSpuStatusEnum.DISABLE.getStatus()); | ||
| 128 | + } | ||
| 129 | + if (ObjectUtil.equals(ProductSpuPageTabEnum.SOLD_OUT.getType(), tabType)) { | ||
| 130 | + // 已售空商品 | ||
| 131 | + queryWrapper.eqIfPresent(ProductSpuDO::getStock, 0); | ||
| 132 | + } | ||
| 133 | + if (ObjectUtil.equals(ProductSpuPageTabEnum.ALERT_STOCK.getType(), tabType)) { | ||
| 134 | + queryWrapper.le(ProductSpuDO::getStock, ProductConstants.ALERT_STOCK) | ||
| 135 | + // 如果库存触发警戒库存且状态为回收站的话则不在警戒库存列表展示 | ||
| 136 | + .and(q -> q.ne(ProductSpuDO::getStatus, ProductSpuStatusEnum.RECYCLE.getStatus())); | ||
| 137 | + } | ||
| 138 | + if (ObjectUtil.equals(ProductSpuPageTabEnum.RECYCLE_BIN.getType(), tabType)) { | ||
| 139 | + // 回收站 | ||
| 140 | + queryWrapper.eqIfPresent(ProductSpuDO::getStatus, ProductSpuStatusEnum.RECYCLE.getStatus()); | ||
| 141 | + } | ||
| 142 | + } | ||
| 79 | } | 143 | } |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/brand/ProductBrandService.java
| @@ -76,4 +76,11 @@ public interface ProductBrandService { | @@ -76,4 +76,11 @@ public interface ProductBrandService { | ||
| 76 | */ | 76 | */ |
| 77 | PageResult<ProductBrandDO> getBrandPage(ProductBrandPageReqVO pageReqVO); | 77 | PageResult<ProductBrandDO> getBrandPage(ProductBrandPageReqVO pageReqVO); |
| 78 | 78 | ||
| 79 | + /** | ||
| 80 | + * 获取指定状态的品牌列表 | ||
| 81 | + * | ||
| 82 | + * @param status 状态 | ||
| 83 | + * @return 返回品牌列表 | ||
| 84 | + */ | ||
| 85 | + List<ProductBrandDO> getBrandListByStatus(Integer status); | ||
| 79 | } | 86 | } |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/brand/ProductBrandServiceImpl.java
| @@ -114,4 +114,9 @@ public class ProductBrandServiceImpl implements ProductBrandService { | @@ -114,4 +114,9 @@ public class ProductBrandServiceImpl implements ProductBrandService { | ||
| 114 | return brandMapper.selectPage(pageReqVO); | 114 | return brandMapper.selectPage(pageReqVO); |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | + @Override | ||
| 118 | + public List<ProductBrandDO> getBrandListByStatus(Integer status) { | ||
| 119 | + return brandMapper.selectListByStatus(status); | ||
| 120 | + } | ||
| 121 | + | ||
| 117 | } | 122 | } |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/category/ProductCategoryServiceImpl.java
| @@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.product.controller.admin.category.vo.ProductCateg | @@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.product.controller.admin.category.vo.ProductCateg | ||
| 7 | import cn.iocoder.yudao.module.product.convert.category.ProductCategoryConvert; | 7 | import cn.iocoder.yudao.module.product.convert.category.ProductCategoryConvert; |
| 8 | import cn.iocoder.yudao.module.product.dal.dataobject.category.ProductCategoryDO; | 8 | import cn.iocoder.yudao.module.product.dal.dataobject.category.ProductCategoryDO; |
| 9 | import cn.iocoder.yudao.module.product.dal.mysql.category.ProductCategoryMapper; | 9 | import cn.iocoder.yudao.module.product.dal.mysql.category.ProductCategoryMapper; |
| 10 | +import cn.iocoder.yudao.module.product.enums.ProductConstants; | ||
| 10 | import org.springframework.stereotype.Service; | 11 | import org.springframework.stereotype.Service; |
| 11 | import org.springframework.validation.annotation.Validated; | 12 | import org.springframework.validation.annotation.Validated; |
| 12 | 13 | ||
| @@ -68,7 +69,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService { | @@ -68,7 +69,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService { | ||
| 68 | 69 | ||
| 69 | private void validateParentProductCategory(Long id) { | 70 | private void validateParentProductCategory(Long id) { |
| 70 | // 如果是根分类,无需验证 | 71 | // 如果是根分类,无需验证 |
| 71 | - if (Objects.equals(id, ProductCategoryDO.PARENT_ID_NULL)) { | 72 | + if (Objects.equals(id, ProductConstants.PARENT_ID_NULL)) { |
| 72 | return; | 73 | return; |
| 73 | } | 74 | } |
| 74 | // 父分类不存在 | 75 | // 父分类不存在 |
| @@ -77,7 +78,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService { | @@ -77,7 +78,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService { | ||
| 77 | throw exception(CATEGORY_PARENT_NOT_EXISTS); | 78 | throw exception(CATEGORY_PARENT_NOT_EXISTS); |
| 78 | } | 79 | } |
| 79 | // 父分类不能是二级分类 | 80 | // 父分类不能是二级分类 |
| 80 | - if (!Objects.equals(category.getParentId(), ProductCategoryDO.PARENT_ID_NULL)) { | 81 | + if (!Objects.equals(category.getParentId(), ProductConstants.PARENT_ID_NULL)) { |
| 81 | throw exception(CATEGORY_PARENT_NOT_FIRST_LEVEL); | 82 | throw exception(CATEGORY_PARENT_NOT_FIRST_LEVEL); |
| 82 | } | 83 | } |
| 83 | } | 84 | } |
| @@ -107,15 +108,16 @@ public class ProductCategoryServiceImpl implements ProductCategoryService { | @@ -107,15 +108,16 @@ public class ProductCategoryServiceImpl implements ProductCategoryService { | ||
| 107 | 108 | ||
| 108 | @Override | 109 | @Override |
| 109 | public Integer getCategoryLevel(Long id) { | 110 | public Integer getCategoryLevel(Long id) { |
| 110 | - if (Objects.equals(id, ProductCategoryDO.PARENT_ID_NULL)) { | 111 | + if (Objects.equals(id, ProductConstants.PARENT_ID_NULL)) { |
| 111 | return 0; | 112 | return 0; |
| 112 | } | 113 | } |
| 113 | int level = 1; | 114 | int level = 1; |
| 114 | - for (int i = 0; i < 100; i++) { | 115 | + // fix: 循环次数不确定改为while循环 |
| 116 | + while (true){ | ||
| 115 | ProductCategoryDO category = productCategoryMapper.selectById(id); | 117 | ProductCategoryDO category = productCategoryMapper.selectById(id); |
| 116 | // 如果没有父节点,break 结束 | 118 | // 如果没有父节点,break 结束 |
| 117 | if (category == null | 119 | if (category == null |
| 118 | - || Objects.equals(category.getParentId(), ProductCategoryDO.PARENT_ID_NULL)) { | 120 | + || Objects.equals(category.getParentId(), ProductConstants.PARENT_ID_NULL)) { |
| 119 | break; | 121 | break; |
| 120 | } | 122 | } |
| 121 | // 继续递归父节点 | 123 | // 继续递归父节点 |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuServiceImpl.java
| @@ -176,7 +176,6 @@ public class ProductSkuServiceImpl implements ProductSkuService { | @@ -176,7 +176,6 @@ public class ProductSkuServiceImpl implements ProductSkuService { | ||
| 176 | Long existsSkuId = existsSkuMap.remove(propertiesKey); | 176 | Long existsSkuId = existsSkuMap.remove(propertiesKey); |
| 177 | if (existsSkuId != null) { | 177 | if (existsSkuId != null) { |
| 178 | sku.setId(existsSkuId); | 178 | sku.setId(existsSkuId); |
| 179 | - // TODO 那spuId岂不是为null了 | ||
| 180 | updateSkus.add(sku); | 179 | updateSkus.add(sku); |
| 181 | return; | 180 | return; |
| 182 | } | 181 | } |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuService.java
| @@ -75,6 +75,14 @@ public interface ProductSpuService { | @@ -75,6 +75,14 @@ public interface ProductSpuService { | ||
| 75 | List<ProductSpuDO> getSpuList(); | 75 | List<ProductSpuDO> getSpuList(); |
| 76 | 76 | ||
| 77 | /** | 77 | /** |
| 78 | + * 获得所有商品 SPU 列表 | ||
| 79 | + * | ||
| 80 | + * @param reqVO 导出条件 | ||
| 81 | + * @return 商品 SPU 列表 | ||
| 82 | + */ | ||
| 83 | + List<ProductSpuDO> getSpuList(ProductSpuExportReqVO reqVO); | ||
| 84 | + | ||
| 85 | + /** | ||
| 78 | * 获得商品 SPU 分页,提供给挂你兰后台使用 | 86 | * 获得商品 SPU 分页,提供给挂你兰后台使用 |
| 79 | * | 87 | * |
| 80 | * @param pageReqVO 分页查询 | 88 | * @param pageReqVO 分页查询 |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java
| @@ -17,8 +17,9 @@ import cn.iocoder.yudao.module.product.dal.dataobject.category.ProductCategoryDO | @@ -17,8 +17,9 @@ import cn.iocoder.yudao.module.product.dal.dataobject.category.ProductCategoryDO | ||
| 17 | import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; | 17 | import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; |
| 18 | import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; | 18 | import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; |
| 19 | import cn.iocoder.yudao.module.product.dal.mysql.spu.ProductSpuMapper; | 19 | import cn.iocoder.yudao.module.product.dal.mysql.spu.ProductSpuMapper; |
| 20 | +import cn.iocoder.yudao.module.product.enums.ProductConstants; | ||
| 20 | import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum; | 21 | import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum; |
| 21 | -import cn.iocoder.yudao.module.product.enums.spu.ProductSpuTabTypeEnum; | 22 | +import cn.iocoder.yudao.module.product.enums.spu.ProductSpuPageTabEnum; |
| 22 | import cn.iocoder.yudao.module.product.service.brand.ProductBrandService; | 23 | import cn.iocoder.yudao.module.product.service.brand.ProductBrandService; |
| 23 | import cn.iocoder.yudao.module.product.service.category.ProductCategoryService; | 24 | import cn.iocoder.yudao.module.product.service.category.ProductCategoryService; |
| 24 | import cn.iocoder.yudao.module.product.service.property.ProductPropertyValueService; | 25 | import cn.iocoder.yudao.module.product.service.property.ProductPropertyValueService; |
| @@ -35,8 +36,7 @@ import java.util.stream.Collectors; | @@ -35,8 +36,7 @@ import java.util.stream.Collectors; | ||
| 35 | 36 | ||
| 36 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | 37 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 37 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.getSumValue; | 38 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.getSumValue; |
| 38 | -import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.SPU_NOT_EXISTS; | ||
| 39 | -import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.SPU_SAVE_FAIL_CATEGORY_LEVEL_ERROR; | 39 | +import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.*; |
| 40 | 40 | ||
| 41 | /** | 41 | /** |
| 42 | * 商品 SPU Service 实现类 | 42 | * 商品 SPU Service 实现类 |
| @@ -63,11 +63,9 @@ public class ProductSpuServiceImpl implements ProductSpuService { | @@ -63,11 +63,9 @@ public class ProductSpuServiceImpl implements ProductSpuService { | ||
| 63 | @Override | 63 | @Override |
| 64 | @Transactional(rollbackFor = Exception.class) | 64 | @Transactional(rollbackFor = Exception.class) |
| 65 | public Long createSpu(ProductSpuCreateReqVO createReqVO) { | 65 | public Long createSpu(ProductSpuCreateReqVO createReqVO) { |
| 66 | - // 校验分类 TODO puhui999:暂不清楚为什么只能选择第三层的结点;芋艿:改成二级分类,因为商品只能放在叶子节点级别; | ||
| 67 | - //validateCategory(createReqVO.getCategoryId()); | ||
| 68 | - // 校验品牌 TODO puhui999:暂不校验,前端没有做品牌选择;芋艿:可以加下哈 | ||
| 69 | - //brandService.validateProductBrand(createReqVO.getBrandId()); | ||
| 70 | - | 66 | + // 校验分类 TODO puhui999:暂不清楚为什么只能选择第三层的结点;芋艿:改成二级分类,因为商品只能放在叶子节点级别;fix |
| 67 | + validateCategory(createReqVO.getCategoryId()); | ||
| 68 | + brandService.validateProductBrand(createReqVO.getBrandId()); | ||
| 71 | List<ProductSkuCreateOrUpdateReqVO> skuSaveReqList = createReqVO.getSkus(); | 69 | List<ProductSkuCreateOrUpdateReqVO> skuSaveReqList = createReqVO.getSkus(); |
| 72 | // 校验 SKU | 70 | // 校验 SKU |
| 73 | productSkuService.validateSkuList(skuSaveReqList, createReqVO.getSpecType()); | 71 | productSkuService.validateSkuList(skuSaveReqList, createReqVO.getSpecType()); |
| @@ -88,10 +86,10 @@ public class ProductSpuServiceImpl implements ProductSpuService { | @@ -88,10 +86,10 @@ public class ProductSpuServiceImpl implements ProductSpuService { | ||
| 88 | public void updateSpu(ProductSpuUpdateReqVO updateReqVO) { | 86 | public void updateSpu(ProductSpuUpdateReqVO updateReqVO) { |
| 89 | // 校验 SPU 是否存在 | 87 | // 校验 SPU 是否存在 |
| 90 | validateSpuExists(updateReqVO.getId()); | 88 | validateSpuExists(updateReqVO.getId()); |
| 91 | - // 校验分类 TODO 暂不清楚为什么只能选择第三层的结点 | ||
| 92 | - //validateCategory(updateReqVO.getCategoryId()); | ||
| 93 | - // 校验品牌 TODO 暂不校验,前端没有做品牌选择 | ||
| 94 | - //brandService.validateProductBrand(updateReqVO.getBrandId()); | 89 | + // 校验分类 |
| 90 | + validateCategory(updateReqVO.getCategoryId()); | ||
| 91 | + // 校验品牌 | ||
| 92 | + brandService.validateProductBrand(updateReqVO.getBrandId()); | ||
| 95 | // 校验SKU | 93 | // 校验SKU |
| 96 | List<ProductSkuCreateOrUpdateReqVO> skuSaveReqList = updateReqVO.getSkus(); | 94 | List<ProductSkuCreateOrUpdateReqVO> skuSaveReqList = updateReqVO.getSkus(); |
| 97 | productSkuService.validateSkuList(skuSaveReqList, updateReqVO.getSpecType()); | 95 | productSkuService.validateSkuList(skuSaveReqList, updateReqVO.getSpecType()); |
| @@ -107,7 +105,7 @@ public class ProductSpuServiceImpl implements ProductSpuService { | @@ -107,7 +105,7 @@ public class ProductSpuServiceImpl implements ProductSpuService { | ||
| 107 | * 基于 SKU 的信息,初始化 SPU 的信息 | 105 | * 基于 SKU 的信息,初始化 SPU 的信息 |
| 108 | * 主要是计数相关的字段,例如说市场价、最大最小价、库存等等 | 106 | * 主要是计数相关的字段,例如说市场价、最大最小价、库存等等 |
| 109 | * | 107 | * |
| 110 | - * @param spu 商品 SPU | 108 | + * @param spu 商品 SPU |
| 111 | * @param skus 商品 SKU 数组 | 109 | * @param skus 商品 SKU 数组 |
| 112 | */ | 110 | */ |
| 113 | private void initSpuFromSkus(ProductSpuDO spu, List<ProductSkuCreateOrUpdateReqVO> skus) { | 111 | private void initSpuFromSkus(ProductSpuDO spu, List<ProductSkuCreateOrUpdateReqVO> skus) { |
| @@ -123,13 +121,17 @@ public class ProductSpuServiceImpl implements ProductSpuService { | @@ -123,13 +121,17 @@ public class ProductSpuServiceImpl implements ProductSpuService { | ||
| 123 | spu.setCostPrice(vo.getCostPrice()); | 121 | spu.setCostPrice(vo.getCostPrice()); |
| 124 | // sku单价最低的商品的条形码 | 122 | // sku单价最低的商品的条形码 |
| 125 | spu.setBarCode(vo.getBarCode()); | 123 | spu.setBarCode(vo.getBarCode()); |
| 126 | - // 默认状态为上架 | ||
| 127 | - spu.setStatus(ProductSpuStatusEnum.ENABLE.getStatus()); | ||
| 128 | - // TODO 默认商品销量和浏览量为零 | ||
| 129 | - spu.setSalesCount(0); | ||
| 130 | - spu.setBrowseCount(0); | ||
| 131 | // skus库存总数 | 124 | // skus库存总数 |
| 132 | spu.setStock(getSumValue(skus, ProductSkuCreateOrUpdateReqVO::getStock, Integer::sum)); | 125 | spu.setStock(getSumValue(skus, ProductSkuCreateOrUpdateReqVO::getStock, Integer::sum)); |
| 126 | + // 若是 spu 已有状态则不处理 | ||
| 127 | + if (spu.getStatus() == null) { | ||
| 128 | + // 默认状态为上架 | ||
| 129 | + spu.setStatus(ProductSpuStatusEnum.ENABLE.getStatus()); | ||
| 130 | + // 默认商品销量 | ||
| 131 | + spu.setSalesCount(ProductConstants.SALES_COUNT); | ||
| 132 | + // 默认商品浏览量 | ||
| 133 | + spu.setBrowseCount(ProductConstants.BROWSE_COUNT); | ||
| 134 | + } | ||
| 133 | } | 135 | } |
| 134 | 136 | ||
| 135 | /** | 137 | /** |
| @@ -140,7 +142,7 @@ public class ProductSpuServiceImpl implements ProductSpuService { | @@ -140,7 +142,7 @@ public class ProductSpuServiceImpl implements ProductSpuService { | ||
| 140 | private void validateCategory(Long id) { | 142 | private void validateCategory(Long id) { |
| 141 | categoryService.validateCategory(id); | 143 | categoryService.validateCategory(id); |
| 142 | // 校验层级 | 144 | // 校验层级 |
| 143 | - if (categoryService.getCategoryLevel(id) != 3) { | 145 | + if (categoryService.getCategoryLevel(id) != ProductConstants.CATEGORY_LEVEL) { |
| 144 | throw exception(SPU_SAVE_FAIL_CATEGORY_LEVEL_ERROR); | 146 | throw exception(SPU_SAVE_FAIL_CATEGORY_LEVEL_ERROR); |
| 145 | } | 147 | } |
| 146 | } | 148 | } |
| @@ -150,6 +152,8 @@ public class ProductSpuServiceImpl implements ProductSpuService { | @@ -150,6 +152,8 @@ public class ProductSpuServiceImpl implements ProductSpuService { | ||
| 150 | public void deleteSpu(Long id) { | 152 | public void deleteSpu(Long id) { |
| 151 | // 校验存在 | 153 | // 校验存在 |
| 152 | validateSpuExists(id); | 154 | validateSpuExists(id); |
| 155 | + // 校验商品状态不是回收站不能删除 | ||
| 156 | + validateSpuStatus(id); | ||
| 153 | // 删除 SPU | 157 | // 删除 SPU |
| 154 | productSpuMapper.deleteById(id); | 158 | productSpuMapper.deleteById(id); |
| 155 | // 删除关联的 SKU | 159 | // 删除关联的 SKU |
| @@ -162,6 +166,19 @@ public class ProductSpuServiceImpl implements ProductSpuService { | @@ -162,6 +166,19 @@ public class ProductSpuServiceImpl implements ProductSpuService { | ||
| 162 | } | 166 | } |
| 163 | } | 167 | } |
| 164 | 168 | ||
| 169 | + /** | ||
| 170 | + * 验证 SPU 状态是否为回收站 | ||
| 171 | + * | ||
| 172 | + * @param id id | ||
| 173 | + */ | ||
| 174 | + private void validateSpuStatus(Long id) { | ||
| 175 | + ProductSpuDO spuDO = productSpuMapper.selectById(id); | ||
| 176 | + // 判断 SPU 状态是否为回收站 | ||
| 177 | + if (ObjectUtil.notEqual(spuDO.getStatus(), ProductSpuStatusEnum.RECYCLE.getStatus())) { | ||
| 178 | + throw exception(SPU_NOT_RECYCLE); | ||
| 179 | + } | ||
| 180 | + } | ||
| 181 | + | ||
| 165 | @Override | 182 | @Override |
| 166 | public ProductSpuDO getSpu(Long id) { | 183 | public ProductSpuDO getSpu(Long id) { |
| 167 | return productSpuMapper.selectById(id); | 184 | return productSpuMapper.selectById(id); |
| @@ -178,6 +195,11 @@ public class ProductSpuServiceImpl implements ProductSpuService { | @@ -178,6 +195,11 @@ public class ProductSpuServiceImpl implements ProductSpuService { | ||
| 178 | } | 195 | } |
| 179 | 196 | ||
| 180 | @Override | 197 | @Override |
| 198 | + public List<ProductSpuDO> getSpuList(ProductSpuExportReqVO reqVO) { | ||
| 199 | + return productSpuMapper.selectList(reqVO); | ||
| 200 | + } | ||
| 201 | + | ||
| 202 | + @Override | ||
| 181 | public PageResult<ProductSpuDO> getSpuPage(ProductSpuPageReqVO pageReqVO) { | 203 | public PageResult<ProductSpuDO> getSpuPage(ProductSpuPageReqVO pageReqVO) { |
| 182 | return productSpuMapper.selectPage(pageReqVO); | 204 | return productSpuMapper.selectPage(pageReqVO); |
| 183 | } | 205 | } |
| @@ -202,7 +224,6 @@ public class ProductSpuServiceImpl implements ProductSpuService { | @@ -202,7 +224,6 @@ public class ProductSpuServiceImpl implements ProductSpuService { | ||
| 202 | stockIncrCounts.forEach((id, incCount) -> productSpuMapper.updateStock(id, incCount)); | 224 | stockIncrCounts.forEach((id, incCount) -> productSpuMapper.updateStock(id, incCount)); |
| 203 | } | 225 | } |
| 204 | 226 | ||
| 205 | - // TODO @puhui999:Service 尽量不做一些跟 VO 相关的拼接逻辑,目的是让 Service 更加简洁一点哈。 | ||
| 206 | @Override | 227 | @Override |
| 207 | public ProductSpuDetailRespVO getSpuDetail(Long id) { | 228 | public ProductSpuDetailRespVO getSpuDetail(Long id) { |
| 208 | // 获得商品 SPU | 229 | // 获得商品 SPU |
| @@ -210,28 +231,9 @@ public class ProductSpuServiceImpl implements ProductSpuService { | @@ -210,28 +231,9 @@ public class ProductSpuServiceImpl implements ProductSpuService { | ||
| 210 | if (spu == null) { | 231 | if (spu == null) { |
| 211 | throw exception(SPU_NOT_EXISTS); | 232 | throw exception(SPU_NOT_EXISTS); |
| 212 | } | 233 | } |
| 213 | - ProductSpuDetailRespVO productSpuDetailRespVO = ProductSpuConvert.INSTANCE.convert03(spu); | ||
| 214 | // 查询商品 SKU | 234 | // 查询商品 SKU |
| 215 | List<ProductSkuDO> skus = productSkuService.getSkuListBySpuId(spu.getId()); | 235 | List<ProductSkuDO> skus = productSkuService.getSkuListBySpuId(spu.getId()); |
| 216 | - if (CollUtil.isNotEmpty(skus)){ | ||
| 217 | - // TODO @puhui999:skuVOs 更简洁一点。然后大小写要注释哈。RespVOs;因为 VO 是缩写,s 是复数 | ||
| 218 | - List<ProductSkuRespVO> skuRespVoS = ProductSkuConvert.INSTANCE.convertList(skus); | ||
| 219 | - // 非多规格,不需要处理 | ||
| 220 | - // TODO @puhui999:统一模型,即使是单规格,也查询下,问题不大的 | ||
| 221 | - if (ObjectUtil.equal(productSpuDetailRespVO.getSpecType(), true)) { | ||
| 222 | - // 获取所有的属性值 id | ||
| 223 | - Set<Long> valueIds = skus.stream().flatMap(p -> p.getProperties().stream()) | ||
| 224 | - .map(ProductSkuDO.Property::getValueId) | ||
| 225 | - .collect(Collectors.toSet()); | ||
| 226 | - List<ProductPropertyValueDetailRespBO> valueDetailList = productPropertyValueService.getPropertyValueDetailList(valueIds); | ||
| 227 | - // TODO @puhui999:拼接的逻辑,最好查询好后,丢到 convert 里面统一处理;这样 Service or Controller 也可以更简洁;原则上,Controller 去组合;Service 写逻辑;Convert 转换 | ||
| 228 | - Map<Long, String> stringMap = valueDetailList.stream().collect(Collectors.toMap(ProductPropertyValueDetailRespBO::getValueId, ProductPropertyValueDetailRespBO::getValueName)); | ||
| 229 | - // 设置属性值名称 | ||
| 230 | - skuRespVoS.stream().flatMap(p -> p.getProperties().stream()).forEach(item ->item.setValueName(stringMap.get(item.getValueId()))); | ||
| 231 | - } | ||
| 232 | - productSpuDetailRespVO.setSkus(skuRespVoS); | ||
| 233 | - } | ||
| 234 | - return productSpuDetailRespVO; | 236 | + return ProductSpuConvert.INSTANCE.convertForSpuDetailRespVO(spu, skus, productPropertyValueService::getPropertyValueDetailList); |
| 235 | } | 237 | } |
| 236 | 238 | ||
| 237 | @Override | 239 | @Override |
| @@ -247,21 +249,21 @@ public class ProductSpuServiceImpl implements ProductSpuService { | @@ -247,21 +249,21 @@ public class ProductSpuServiceImpl implements ProductSpuService { | ||
| 247 | 249 | ||
| 248 | @Override | 250 | @Override |
| 249 | public Map<Integer, Long> getTabsCount() { | 251 | public Map<Integer, Long> getTabsCount() { |
| 250 | - // TODO @puhui999:map =》counts;尽量避免出现 map 这种命名,无命名含义哈 | ||
| 251 | - Map<Integer, Long> map = new HashMap<>(); | 252 | + // TODO @puhui999:map =》;尽量避免出现 map 这种命名,无命名含义哈 fix |
| 253 | + Map<Integer, Long> counts = new HashMap<>(ProductConstants.SPU_TAB_COUNTS); | ||
| 252 | // 查询销售中的商品数量 | 254 | // 查询销售中的商品数量 |
| 253 | - map.put(ProductSpuTabTypeEnum.FOR_SALE.getType(), productSpuMapper.selectCount(ProductSpuDO::getStatus, ProductSpuStatusEnum.ENABLE.getStatus())); | 255 | + counts.put(ProductSpuPageTabEnum.FOR_SALE.getType(), productSpuMapper.selectCount(ProductSpuDO::getStatus, ProductSpuStatusEnum.ENABLE.getStatus())); |
| 254 | // 查询仓库中的商品数量 | 256 | // 查询仓库中的商品数量 |
| 255 | - map.put(ProductSpuTabTypeEnum.IN_WAREHOUSE.getType(),productSpuMapper.selectCount(ProductSpuDO::getStatus, ProductSpuStatusEnum.DISABLE.getStatus())); | 257 | + counts.put(ProductSpuPageTabEnum.IN_WAREHOUSE.getType(), productSpuMapper.selectCount(ProductSpuDO::getStatus, ProductSpuStatusEnum.DISABLE.getStatus())); |
| 256 | // 查询售空的商品数量 | 258 | // 查询售空的商品数量 |
| 257 | - map.put(ProductSpuTabTypeEnum.SOLD_OUT.getType(),productSpuMapper.selectCount(ProductSpuDO::getStock, 0)); | ||
| 258 | - // 查询触发警戒库存的商品数量 TODO 警戒库存暂时为 10,后期需要使用常量或者数据库配置替换 | ||
| 259 | - // TODO @puhui999:要有空格;, productSpuMapper | ||
| 260 | - // TODO @puhui999:Service 不要有 Mapper 的逻辑;想想咋抽象一下哈 | ||
| 261 | - map.put(ProductSpuTabTypeEnum.ALERT_STOCK.getType(),productSpuMapper.selectCount(new LambdaQueryWrapperX<ProductSpuDO>().le(ProductSpuDO::getStock, 10))); | 259 | + counts.put(ProductSpuPageTabEnum.SOLD_OUT.getType(), productSpuMapper.selectCount(ProductSpuDO::getStock, 0)); |
| 260 | + // 查询触发警戒库存的商品数量 | ||
| 261 | + // TODO @puhui999:要有空格;, productSpuMapper fix | ||
| 262 | + // TODO @puhui999:Service 不要有 Mapper 的逻辑;想想咋抽象一下哈 fix:调整为在 productSpuMapper 中书写逻辑 | ||
| 263 | + counts.put(ProductSpuPageTabEnum.ALERT_STOCK.getType(), productSpuMapper.selectCountByStockAndStatus()); | ||
| 262 | // 查询回收站中的商品数量 | 264 | // 查询回收站中的商品数量 |
| 263 | - map.put(ProductSpuTabTypeEnum.RECYCLE_BIN.getType(),productSpuMapper.selectCount(ProductSpuDO::getStatus, ProductSpuStatusEnum.RECYCLE.getStatus())); | ||
| 264 | - return map; | 265 | + counts.put(ProductSpuPageTabEnum.RECYCLE_BIN.getType(), productSpuMapper.selectCount(ProductSpuDO::getStatus, ProductSpuStatusEnum.RECYCLE.getStatus())); |
| 266 | + return counts; | ||
| 265 | } | 267 | } |
| 266 | 268 | ||
| 267 | } | 269 | } |
yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/category/ProductCategoryServiceImplTest.java
| @@ -18,8 +18,9 @@ import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEq | @@ -18,8 +18,9 @@ import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEq | ||
| 18 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; | 18 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; |
| 19 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; | 19 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; |
| 20 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; | 20 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; |
| 21 | -import static cn.iocoder.yudao.module.product.dal.dataobject.category.ProductCategoryDO.PARENT_ID_NULL; | 21 | + |
| 22 | import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.CATEGORY_NOT_EXISTS; | 22 | import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.CATEGORY_NOT_EXISTS; |
| 23 | +import static cn.iocoder.yudao.module.product.enums.ProductConstants.PARENT_ID_NULL; | ||
| 23 | import static org.junit.jupiter.api.Assertions.*; | 24 | import static org.junit.jupiter.api.Assertions.*; |
| 24 | 25 | ||
| 25 | /** | 26 | /** |
yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuServiceTest.java
| 1 | package cn.iocoder.yudao.module.product.service.sku; | 1 | package cn.iocoder.yudao.module.product.service.sku; |
| 2 | 2 | ||
| 3 | +import cn.hutool.core.util.RandomUtil; | ||
| 3 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | 4 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 4 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | 5 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 5 | import cn.iocoder.yudao.framework.test.core.util.AssertUtils; | 6 | import cn.iocoder.yudao.framework.test.core.util.AssertUtils; |
| @@ -49,23 +50,26 @@ public class ProductSkuServiceTest extends BaseDbUnitTest { | @@ -49,23 +50,26 @@ public class ProductSkuServiceTest extends BaseDbUnitTest { | ||
| 49 | @MockBean | 50 | @MockBean |
| 50 | private ProductPropertyValueService productPropertyValueService; | 51 | private ProductPropertyValueService productPropertyValueService; |
| 51 | 52 | ||
| 53 | + public Long generateId() { | ||
| 54 | + return RandomUtil.randomLong(100000, 999999); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + public int generaInt(){return RandomUtil.randomInt(1,9999999);} | ||
| 58 | + | ||
| 52 | @Test | 59 | @Test |
| 53 | public void testUpdateSkuList() { | 60 | public void testUpdateSkuList() { |
| 54 | // mock 数据 | 61 | // mock 数据 |
| 55 | ProductSkuDO sku01 = randomPojo(ProductSkuDO.class, o -> { // 测试更新 | 62 | ProductSkuDO sku01 = randomPojo(ProductSkuDO.class, o -> { // 测试更新 |
| 56 | o.setSpuId(1L); | 63 | o.setSpuId(1L); |
| 57 | - //o.setProperties(singletonList(new ProductSkuDO.Property( | ||
| 58 | - // 10L, "颜色", 20L, "红色"))); TODO 新增字段已注释 | ||
| 59 | o.setProperties(singletonList(new ProductSkuDO.Property( | 64 | o.setProperties(singletonList(new ProductSkuDO.Property( |
| 60 | - 10L, 20L))); | 65 | + 10L, "颜色", 20L, "红色"))); |
| 61 | }); | 66 | }); |
| 62 | productSkuMapper.insert(sku01); | 67 | productSkuMapper.insert(sku01); |
| 63 | ProductSkuDO sku02 = randomPojo(ProductSkuDO.class, o -> { // 测试删除 | 68 | ProductSkuDO sku02 = randomPojo(ProductSkuDO.class, o -> { // 测试删除 |
| 64 | o.setSpuId(1L); | 69 | o.setSpuId(1L); |
| 65 | - //o.setProperties(singletonList(new ProductSkuDO.Property( | ||
| 66 | - // 10L, "颜色", 30L, "蓝色"))); TODO 新增字段已注释 | ||
| 67 | o.setProperties(singletonList(new ProductSkuDO.Property( | 70 | o.setProperties(singletonList(new ProductSkuDO.Property( |
| 68 | - 10L, 30L))); | 71 | + 10L, "颜色", 30L, "蓝色"))); |
| 72 | + | ||
| 69 | }); | 73 | }); |
| 70 | productSkuMapper.insert(sku02); | 74 | productSkuMapper.insert(sku02); |
| 71 | // 准备参数 | 75 | // 准备参数 |
| @@ -73,10 +77,12 @@ public class ProductSkuServiceTest extends BaseDbUnitTest { | @@ -73,10 +77,12 @@ public class ProductSkuServiceTest extends BaseDbUnitTest { | ||
| 73 | String spuName = "测试商品"; | 77 | String spuName = "测试商品"; |
| 74 | List<ProductSkuCreateOrUpdateReqVO> skus = Arrays.asList( | 78 | List<ProductSkuCreateOrUpdateReqVO> skus = Arrays.asList( |
| 75 | randomPojo(ProductSkuCreateOrUpdateReqVO.class, o -> { // 测试更新 | 79 | randomPojo(ProductSkuCreateOrUpdateReqVO.class, o -> { // 测试更新 |
| 76 | - o.setProperties(singletonList(new ProductSkuCreateOrUpdateReqVO.Property(10L, 20L))); | 80 | + o.setProperties(singletonList(new ProductSkuCreateOrUpdateReqVO.Property( |
| 81 | + 10L, "颜色", 20L, "红色"))); | ||
| 77 | }), | 82 | }), |
| 78 | randomPojo(ProductSkuCreateOrUpdateReqVO.class, o -> { // 测试新增 | 83 | randomPojo(ProductSkuCreateOrUpdateReqVO.class, o -> { // 测试新增 |
| 79 | - o.setProperties(singletonList(new ProductSkuCreateOrUpdateReqVO.Property(10L, 40L))); | 84 | + o.setProperties(singletonList(new ProductSkuCreateOrUpdateReqVO.Property( |
| 85 | + 10L, "颜色", 20L, "红色"))); | ||
| 80 | }) | 86 | }) |
| 81 | ); | 87 | ); |
| 82 | 88 |
yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImplTest.java
| @@ -6,15 +6,16 @@ import cn.hutool.core.util.RandomUtil; | @@ -6,15 +6,16 @@ import cn.hutool.core.util.RandomUtil; | ||
| 6 | import cn.iocoder.yudao.framework.common.exception.ServiceException; | 6 | import cn.iocoder.yudao.framework.common.exception.ServiceException; |
| 7 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 7 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 8 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | 8 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 9 | -import cn.iocoder.yudao.module.product.controller.admin.spu.vo.ProductSpuCreateReqVO; | ||
| 10 | -import cn.iocoder.yudao.module.product.controller.admin.spu.vo.ProductSpuPageReqVO; | ||
| 11 | -import cn.iocoder.yudao.module.product.controller.admin.spu.vo.ProductSpuPageRespVO; | ||
| 12 | -import cn.iocoder.yudao.module.product.controller.admin.spu.vo.ProductSpuUpdateReqVO; | 9 | +import cn.iocoder.yudao.module.product.controller.admin.category.vo.ProductCategoryCreateReqVO; |
| 10 | +import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuCreateOrUpdateReqVO; | ||
| 11 | +import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; | ||
| 13 | import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageReqVO; | 12 | import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageReqVO; |
| 14 | import cn.iocoder.yudao.module.product.convert.spu.ProductSpuConvert; | 13 | import cn.iocoder.yudao.module.product.convert.spu.ProductSpuConvert; |
| 14 | +import cn.iocoder.yudao.module.product.dal.dataobject.category.ProductCategoryDO; | ||
| 15 | import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; | 15 | import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; |
| 16 | import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; | 16 | import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; |
| 17 | import cn.iocoder.yudao.module.product.dal.mysql.spu.ProductSpuMapper; | 17 | import cn.iocoder.yudao.module.product.dal.mysql.spu.ProductSpuMapper; |
| 18 | +import cn.iocoder.yudao.module.product.enums.spu.ProductSpuPageTabEnum; | ||
| 18 | import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum; | 19 | import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum; |
| 19 | import cn.iocoder.yudao.module.product.service.brand.ProductBrandServiceImpl; | 20 | import cn.iocoder.yudao.module.product.service.brand.ProductBrandServiceImpl; |
| 20 | import cn.iocoder.yudao.module.product.service.category.ProductCategoryServiceImpl; | 21 | import cn.iocoder.yudao.module.product.service.category.ProductCategoryServiceImpl; |
| @@ -22,6 +23,7 @@ import cn.iocoder.yudao.module.product.service.property.ProductPropertyService; | @@ -22,6 +23,7 @@ import cn.iocoder.yudao.module.product.service.property.ProductPropertyService; | ||
| 22 | import cn.iocoder.yudao.module.product.service.property.ProductPropertyValueService; | 23 | import cn.iocoder.yudao.module.product.service.property.ProductPropertyValueService; |
| 23 | import cn.iocoder.yudao.module.product.service.sku.ProductSkuServiceImpl; | 24 | import cn.iocoder.yudao.module.product.service.sku.ProductSkuServiceImpl; |
| 24 | import com.google.common.collect.Lists; | 25 | import com.google.common.collect.Lists; |
| 26 | +import org.apache.poi.ss.formula.functions.T; | ||
| 25 | import org.junit.jupiter.api.Assertions; | 27 | import org.junit.jupiter.api.Assertions; |
| 26 | import org.junit.jupiter.api.Disabled; | 28 | import org.junit.jupiter.api.Disabled; |
| 27 | import org.junit.jupiter.api.Test; | 29 | import org.junit.jupiter.api.Test; |
| @@ -30,14 +32,19 @@ import org.springframework.boot.test.mock.mockito.MockBean; | @@ -30,14 +32,19 @@ import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 30 | import org.springframework.context.annotation.Import; | 32 | import org.springframework.context.annotation.Import; |
| 31 | 33 | ||
| 32 | import javax.annotation.Resource; | 34 | import javax.annotation.Resource; |
| 35 | +import java.math.RoundingMode; | ||
| 33 | import java.util.*; | 36 | import java.util.*; |
| 34 | import java.util.stream.Collectors; | 37 | import java.util.stream.Collectors; |
| 35 | import java.util.stream.Stream; | 38 | import java.util.stream.Stream; |
| 36 | 39 | ||
| 40 | +import static cn.iocoder.yudao.framework.common.util.collection.SetUtils.asSet; | ||
| 37 | import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; | 41 | import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; |
| 38 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; | 42 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; |
| 39 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; | 43 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; |
| 44 | +import static org.assertj.core.util.Lists.newArrayList; | ||
| 40 | import static org.junit.jupiter.api.Assertions.assertEquals; | 45 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 46 | +import static org.mockito.ArgumentMatchers.eq; | ||
| 47 | +import static org.mockito.Mockito.when; | ||
| 41 | 48 | ||
| 42 | // TODO @芋艿:review 下单元测试 | 49 | // TODO @芋艿:review 下单元测试 |
| 43 | 50 | ||
| @@ -47,7 +54,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; | @@ -47,7 +54,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; | ||
| 47 | * @author 芋道源码 | 54 | * @author 芋道源码 |
| 48 | */ | 55 | */ |
| 49 | @Import(ProductSpuServiceImpl.class) | 56 | @Import(ProductSpuServiceImpl.class) |
| 50 | -@Disabled // TODO 芋艿:临时去掉 | ||
| 51 | public class ProductSpuServiceImplTest extends BaseDbUnitTest { | 57 | public class ProductSpuServiceImplTest extends BaseDbUnitTest { |
| 52 | 58 | ||
| 53 | @Resource | 59 | @Resource |
| @@ -75,10 +81,35 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { | @@ -75,10 +81,35 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { | ||
| 75 | return RandomUtil.randomLong(100000, 999999); | 81 | return RandomUtil.randomLong(100000, 999999); |
| 76 | } | 82 | } |
| 77 | 83 | ||
| 84 | + public int generaInt(){return RandomUtil.randomInt(1,9999999);} | ||
| 85 | + | ||
| 78 | @Test | 86 | @Test |
| 79 | public void testCreateSpu_success() { | 87 | public void testCreateSpu_success() { |
| 80 | // 准备参数 | 88 | // 准备参数 |
| 81 | - ProductSpuCreateReqVO createReqVO = randomPojo(ProductSpuCreateReqVO.class); | 89 | + ProductSkuCreateOrUpdateReqVO skuCreateOrUpdateReqVO = randomPojo(ProductSkuCreateOrUpdateReqVO.class,o->{ |
| 90 | + // 限制范围为正整数 | ||
| 91 | + o.setCostPrice(generaInt()); | ||
| 92 | + o.setPrice(generaInt()); | ||
| 93 | + o.setMarketPrice(generaInt()); | ||
| 94 | + o.setStock(generaInt()); | ||
| 95 | + o.setWarnStock(10); | ||
| 96 | + o.setSubCommissionFirstPrice(generaInt()); | ||
| 97 | + o.setSubCommissionSecondPrice(generaInt()); | ||
| 98 | + // 限制分数为两位数 | ||
| 99 | + o.setWeight(RandomUtil.randomDouble(10,2, RoundingMode.HALF_UP)); | ||
| 100 | + o.setVolume(RandomUtil.randomDouble(10,2, RoundingMode.HALF_UP)); | ||
| 101 | + }); | ||
| 102 | + ProductSpuCreateReqVO createReqVO = randomPojo(ProductSpuCreateReqVO.class,o->{ | ||
| 103 | + o.setCategoryId(generateId()); | ||
| 104 | + o.setBrandId(generateId()); | ||
| 105 | + o.setUnit(RandomUtil.randomInt(1,20)); // 限制商品单位范围 | ||
| 106 | + o.setSort(RandomUtil.randomInt(1,100)); // 限制排序范围 | ||
| 107 | + o.setGiveIntegral(generaInt()); // 限制范围为正整数 | ||
| 108 | + o.setVirtualSalesCount(generaInt()); // 限制范围为正整数 | ||
| 109 | + o.setActivityOrders(newArrayList(1,3,2,4,5)); // 活动排序 | ||
| 110 | + o.setSkus(newArrayList(skuCreateOrUpdateReqVO,skuCreateOrUpdateReqVO,skuCreateOrUpdateReqVO)); | ||
| 111 | + }); | ||
| 112 | + when(categoryService.getCategoryLevel(eq(createReqVO.getCategoryId()))).thenReturn(2); | ||
| 82 | Long spu = productSpuService.createSpu(createReqVO); | 113 | Long spu = productSpuService.createSpu(createReqVO); |
| 83 | ProductSpuDO productSpuDO = productSpuMapper.selectById(spu); | 114 | ProductSpuDO productSpuDO = productSpuMapper.selectById(spu); |
| 84 | assertPojoEquals(createReqVO, productSpuDO); | 115 | assertPojoEquals(createReqVO, productSpuDO); |
| @@ -87,12 +118,55 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { | @@ -87,12 +118,55 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { | ||
| 87 | @Test | 118 | @Test |
| 88 | public void testUpdateSpu_success() { | 119 | public void testUpdateSpu_success() { |
| 89 | // 准备参数 | 120 | // 准备参数 |
| 90 | - ProductSpuDO createReqVO = randomPojo(ProductSpuDO.class); | 121 | + ProductSpuDO createReqVO = randomPojo(ProductSpuDO.class,o->{ |
| 122 | + o.setCategoryId(generateId()); | ||
| 123 | + o.setBrandId(generateId()); | ||
| 124 | + o.setDeliveryTemplateId(generateId()); | ||
| 125 | + o.setUnit(RandomUtil.randomInt(1,20)); // 限制商品单位范围 | ||
| 126 | + o.setSort(RandomUtil.randomInt(1,100)); // 限制排序范围 | ||
| 127 | + o.setGiveIntegral(generaInt()); // 限制范围为正整数 | ||
| 128 | + o.setVirtualSalesCount(generaInt()); // 限制范围为正整数 | ||
| 129 | + o.setActivityOrders(newArrayList(1,3,2,4,5)); // 活动排序 | ||
| 130 | + o.setPrice(generaInt()); // 限制范围为正整数 | ||
| 131 | + o.setMarketPrice(generaInt()); // 限制范围为正整数 | ||
| 132 | + o.setCostPrice(generaInt()); // 限制范围为正整数 | ||
| 133 | + o.setStock(generaInt()); // 限制范围为正整数 | ||
| 134 | + o.setGiveIntegral(generaInt()); // 限制范围为正整数 | ||
| 135 | + o.setSalesCount(generaInt()); // 限制范围为正整数 | ||
| 136 | + o.setBrowseCount(generaInt()); // 限制范围为正整数 | ||
| 137 | + }); | ||
| 91 | productSpuMapper.insert(createReqVO); | 138 | productSpuMapper.insert(createReqVO); |
| 92 | // 准备参数 | 139 | // 准备参数 |
| 140 | + ProductSkuCreateOrUpdateReqVO skuCreateOrUpdateReqVO = randomPojo(ProductSkuCreateOrUpdateReqVO.class,o->{ | ||
| 141 | + // 限制范围为正整数 | ||
| 142 | + o.setCostPrice(generaInt()); | ||
| 143 | + o.setPrice(generaInt()); | ||
| 144 | + o.setMarketPrice(generaInt()); | ||
| 145 | + o.setStock(generaInt()); | ||
| 146 | + o.setWarnStock(10); | ||
| 147 | + o.setSubCommissionFirstPrice(generaInt()); | ||
| 148 | + o.setSubCommissionSecondPrice(generaInt()); | ||
| 149 | + // 限制分数为两位数 | ||
| 150 | + o.setWeight(RandomUtil.randomDouble(10,2, RoundingMode.HALF_UP)); | ||
| 151 | + o.setVolume(RandomUtil.randomDouble(10,2, RoundingMode.HALF_UP)); | ||
| 152 | + }); | ||
| 153 | + // 准备参数 | ||
| 93 | ProductSpuUpdateReqVO reqVO = randomPojo(ProductSpuUpdateReqVO.class, o -> { | 154 | ProductSpuUpdateReqVO reqVO = randomPojo(ProductSpuUpdateReqVO.class, o -> { |
| 94 | o.setId(createReqVO.getId()); // 设置更新的 ID | 155 | o.setId(createReqVO.getId()); // 设置更新的 ID |
| 156 | + o.setCategoryId(generateId()); | ||
| 157 | + o.setBrandId(generateId()); | ||
| 158 | + o.setUnit(RandomUtil.randomInt(1,20)); // 限制商品单位范围 | ||
| 159 | + o.setSort(RandomUtil.randomInt(1,100)); // 限制排序范围 | ||
| 160 | + o.setGiveIntegral(generaInt()); // 限制范围为正整数 | ||
| 161 | + o.setVirtualSalesCount(generaInt()); // 限制范围为正整数 | ||
| 162 | + o.setActivityOrders(newArrayList(1,3,2,4,5)); // 活动排序 | ||
| 163 | + o.setGiveIntegral(generaInt()); // 限制范围为正整数 | ||
| 164 | + o.setSalesCount(generaInt()); // 限制范围为正整数 | ||
| 165 | + o.setBrowseCount(generaInt()); // 限制范围为正整数 | ||
| 166 | + o.setStatus(0); | ||
| 167 | + o.setSkus(newArrayList(skuCreateOrUpdateReqVO,skuCreateOrUpdateReqVO,skuCreateOrUpdateReqVO)); | ||
| 95 | }); | 168 | }); |
| 169 | + when(categoryService.getCategoryLevel(eq(reqVO.getCategoryId()))).thenReturn(2); | ||
| 96 | // 调用 | 170 | // 调用 |
| 97 | productSpuService.updateSpu(reqVO); | 171 | productSpuService.updateSpu(reqVO); |
| 98 | // 校验是否更新正确 | 172 | // 校验是否更新正确 |
| @@ -110,7 +184,24 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { | @@ -110,7 +184,24 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { | ||
| 110 | @Test | 184 | @Test |
| 111 | void deleteSpu() { | 185 | void deleteSpu() { |
| 112 | // 准备参数 | 186 | // 准备参数 |
| 113 | - ProductSpuDO createReqVO = randomPojo(ProductSpuDO.class); | 187 | + ProductSpuDO createReqVO = randomPojo(ProductSpuDO.class,o->{ |
| 188 | + o.setCategoryId(generateId()); | ||
| 189 | + o.setBrandId(generateId()); | ||
| 190 | + o.setDeliveryTemplateId(generateId()); | ||
| 191 | + o.setUnit(RandomUtil.randomInt(1,20)); // 限制商品单位范围 | ||
| 192 | + o.setSort(RandomUtil.randomInt(1,100)); // 限制排序范围 | ||
| 193 | + o.setGiveIntegral(generaInt()); // 限制范围为正整数 | ||
| 194 | + o.setVirtualSalesCount(generaInt()); // 限制范围为正整数 | ||
| 195 | + o.setActivityOrders(newArrayList(1,3,2,4,5)); // 活动排序 | ||
| 196 | + o.setPrice(generaInt()); // 限制范围为正整数 | ||
| 197 | + o.setMarketPrice(generaInt()); // 限制范围为正整数 | ||
| 198 | + o.setCostPrice(generaInt()); // 限制范围为正整数 | ||
| 199 | + o.setStock(generaInt()); // 限制范围为正整数 | ||
| 200 | + o.setGiveIntegral(generaInt()); // 限制范围为正整数 | ||
| 201 | + o.setSalesCount(generaInt()); // 限制范围为正整数 | ||
| 202 | + o.setBrowseCount(generaInt()); // 限制范围为正整数 | ||
| 203 | + o.setStatus(-1); // 加入回收站才可删除 | ||
| 204 | + }); | ||
| 114 | productSpuMapper.insert(createReqVO); | 205 | productSpuMapper.insert(createReqVO); |
| 115 | 206 | ||
| 116 | // 调用 | 207 | // 调用 |
| @@ -122,7 +213,23 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { | @@ -122,7 +213,23 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { | ||
| 122 | @Test | 213 | @Test |
| 123 | void getSpu() { | 214 | void getSpu() { |
| 124 | // 准备参数 | 215 | // 准备参数 |
| 125 | - ProductSpuDO createReqVO = randomPojo(ProductSpuDO.class); | 216 | + ProductSpuDO createReqVO = randomPojo(ProductSpuDO.class,o->{ |
| 217 | + o.setCategoryId(generateId()); | ||
| 218 | + o.setBrandId(generateId()); | ||
| 219 | + o.setDeliveryTemplateId(generateId()); | ||
| 220 | + o.setUnit(RandomUtil.randomInt(1,20)); // 限制商品单位范围 | ||
| 221 | + o.setSort(RandomUtil.randomInt(1,100)); // 限制排序范围 | ||
| 222 | + o.setGiveIntegral(generaInt()); // 限制范围为正整数 | ||
| 223 | + o.setVirtualSalesCount(generaInt()); // 限制范围为正整数 | ||
| 224 | + o.setActivityOrders(newArrayList(1,3,2,4,5)); // 活动排序 | ||
| 225 | + o.setPrice(generaInt()); // 限制范围为正整数 | ||
| 226 | + o.setMarketPrice(generaInt()); // 限制范围为正整数 | ||
| 227 | + o.setCostPrice(generaInt()); // 限制范围为正整数 | ||
| 228 | + o.setStock(generaInt()); // 限制范围为正整数 | ||
| 229 | + o.setGiveIntegral(generaInt()); // 限制范围为正整数 | ||
| 230 | + o.setSalesCount(generaInt()); // 限制范围为正整数 | ||
| 231 | + o.setBrowseCount(generaInt()); // 限制范围为正整数 | ||
| 232 | + }); | ||
| 126 | productSpuMapper.insert(createReqVO); | 233 | productSpuMapper.insert(createReqVO); |
| 127 | 234 | ||
| 128 | ProductSpuDO spu = productSpuService.getSpu(createReqVO.getId()); | 235 | ProductSpuDO spu = productSpuService.getSpu(createReqVO.getId()); |
| @@ -132,19 +239,86 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { | @@ -132,19 +239,86 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { | ||
| 132 | @Test | 239 | @Test |
| 133 | void getSpuList() { | 240 | void getSpuList() { |
| 134 | // 准备参数 | 241 | // 准备参数 |
| 135 | - ArrayList<ProductSpuDO> createReqVO = Lists.newArrayList(randomPojo(ProductSpuDO.class), randomPojo(ProductSpuDO.class)); | ||
| 136 | - productSpuMapper.insertBatch(createReqVO); | 242 | + ArrayList<ProductSpuDO> createReqVOs = Lists.newArrayList(randomPojo(ProductSpuDO.class,o->{ |
| 243 | + o.setCategoryId(generateId()); | ||
| 244 | + o.setBrandId(generateId()); | ||
| 245 | + o.setDeliveryTemplateId(generateId()); | ||
| 246 | + o.setUnit(RandomUtil.randomInt(1,20)); // 限制商品单位范围 | ||
| 247 | + o.setSort(RandomUtil.randomInt(1,100)); // 限制排序范围 | ||
| 248 | + o.setGiveIntegral(generaInt()); // 限制范围为正整数 | ||
| 249 | + o.setVirtualSalesCount(generaInt()); // 限制范围为正整数 | ||
| 250 | + o.setActivityOrders(newArrayList(1,3,2,4,5)); // 活动排序 | ||
| 251 | + o.setPrice(generaInt()); // 限制范围为正整数 | ||
| 252 | + o.setMarketPrice(generaInt()); // 限制范围为正整数 | ||
| 253 | + o.setCostPrice(generaInt()); // 限制范围为正整数 | ||
| 254 | + o.setStock(generaInt()); // 限制范围为正整数 | ||
| 255 | + o.setGiveIntegral(generaInt()); // 限制范围为正整数 | ||
| 256 | + o.setSalesCount(generaInt()); // 限制范围为正整数 | ||
| 257 | + o.setBrowseCount(generaInt()); // 限制范围为正整数 | ||
| 258 | + }), randomPojo(ProductSpuDO.class,o->{ | ||
| 259 | + o.setCategoryId(generateId()); | ||
| 260 | + o.setBrandId(generateId()); | ||
| 261 | + o.setDeliveryTemplateId(generateId()); | ||
| 262 | + o.setUnit(RandomUtil.randomInt(1,20)); // 限制商品单位范围 | ||
| 263 | + o.setSort(RandomUtil.randomInt(1,100)); // 限制排序范围 | ||
| 264 | + o.setGiveIntegral(generaInt()); // 限制范围为正整数 | ||
| 265 | + o.setVirtualSalesCount(generaInt()); // 限制范围为正整数 | ||
| 266 | + o.setActivityOrders(newArrayList(1,3,2,4,5)); // 活动排序 | ||
| 267 | + o.setPrice(generaInt()); // 限制范围为正整数 | ||
| 268 | + o.setMarketPrice(generaInt()); // 限制范围为正整数 | ||
| 269 | + o.setCostPrice(generaInt()); // 限制范围为正整数 | ||
| 270 | + o.setStock(generaInt()); // 限制范围为正整数 | ||
| 271 | + o.setGiveIntegral(generaInt()); // 限制范围为正整数 | ||
| 272 | + o.setSalesCount(generaInt()); // 限制范围为正整数 | ||
| 273 | + o.setBrowseCount(generaInt()); // 限制范围为正整数 | ||
| 274 | + })); | ||
| 275 | + productSpuMapper.insertBatch(createReqVOs); | ||
| 137 | 276 | ||
| 138 | // 调用 | 277 | // 调用 |
| 139 | - List<ProductSpuDO> spuList = productSpuService.getSpuList(createReqVO.stream().map(ProductSpuDO::getId).collect(Collectors.toList())); | ||
| 140 | - Assertions.assertIterableEquals(createReqVO, spuList); | 278 | + List<ProductSpuDO> spuList = productSpuService.getSpuList(createReqVOs.stream().map(ProductSpuDO::getId).collect(Collectors.toList())); |
| 279 | + Assertions.assertIterableEquals(createReqVOs, spuList); | ||
| 141 | } | 280 | } |
| 142 | 281 | ||
| 143 | @Test | 282 | @Test |
| 144 | void getSpuPage_alarmStock_empty() { | 283 | void getSpuPage_alarmStock_empty() { |
| 284 | + // 准备参数 | ||
| 285 | + ArrayList<ProductSpuDO> createReqVOs = Lists.newArrayList(randomPojo(ProductSpuDO.class,o->{ | ||
| 286 | + o.setCategoryId(generateId()); | ||
| 287 | + o.setBrandId(generateId()); | ||
| 288 | + o.setDeliveryTemplateId(generateId()); | ||
| 289 | + o.setUnit(RandomUtil.randomInt(1,20)); // 限制商品单位范围 | ||
| 290 | + o.setSort(RandomUtil.randomInt(1,100)); // 限制排序范围 | ||
| 291 | + o.setGiveIntegral(generaInt()); // 限制范围为正整数 | ||
| 292 | + o.setVirtualSalesCount(generaInt()); // 限制范围为正整数 | ||
| 293 | + o.setActivityOrders(newArrayList(1,3,2,4,5)); // 活动排序 | ||
| 294 | + o.setPrice(generaInt()); // 限制范围为正整数 | ||
| 295 | + o.setMarketPrice(generaInt()); // 限制范围为正整数 | ||
| 296 | + o.setCostPrice(generaInt()); // 限制范围为正整数 | ||
| 297 | + o.setStock(11); // 限制范围为正整数 | ||
| 298 | + o.setGiveIntegral(generaInt()); // 限制范围为正整数 | ||
| 299 | + o.setSalesCount(generaInt()); // 限制范围为正整数 | ||
| 300 | + o.setBrowseCount(generaInt()); // 限制范围为正整数 | ||
| 301 | + }), randomPojo(ProductSpuDO.class,o->{ | ||
| 302 | + o.setCategoryId(generateId()); | ||
| 303 | + o.setBrandId(generateId()); | ||
| 304 | + o.setDeliveryTemplateId(generateId()); | ||
| 305 | + o.setUnit(RandomUtil.randomInt(1,20)); // 限制商品单位范围 | ||
| 306 | + o.setSort(RandomUtil.randomInt(1,100)); // 限制排序范围 | ||
| 307 | + o.setGiveIntegral(generaInt()); // 限制范围为正整数 | ||
| 308 | + o.setVirtualSalesCount(generaInt()); // 限制范围为正整数 | ||
| 309 | + o.setActivityOrders(newArrayList(1,3,2,4,5)); // 活动排序 | ||
| 310 | + o.setPrice(generaInt()); // 限制范围为正整数 | ||
| 311 | + o.setMarketPrice(generaInt()); // 限制范围为正整数 | ||
| 312 | + o.setCostPrice(generaInt()); // 限制范围为正整数 | ||
| 313 | + o.setStock(11); // 限制范围为正整数 | ||
| 314 | + o.setGiveIntegral(generaInt()); // 限制范围为正整数 | ||
| 315 | + o.setSalesCount(generaInt()); // 限制范围为正整数 | ||
| 316 | + o.setBrowseCount(generaInt()); // 限制范围为正整数 | ||
| 317 | + })); | ||
| 318 | + productSpuMapper.insertBatch(createReqVOs); | ||
| 145 | // 调用 | 319 | // 调用 |
| 146 | ProductSpuPageReqVO productSpuPageReqVO = new ProductSpuPageReqVO(); | 320 | ProductSpuPageReqVO productSpuPageReqVO = new ProductSpuPageReqVO(); |
| 147 | - //productSpuPageReqVO.setAlarmStock(true); | 321 | + productSpuPageReqVO.setTabType(ProductSpuPageTabEnum.ALERT_STOCK.getType()); |
| 148 | 322 | ||
| 149 | PageResult<ProductSpuDO> spuPage = productSpuService.getSpuPage(productSpuPageReqVO); | 323 | PageResult<ProductSpuDO> spuPage = productSpuService.getSpuPage(productSpuPageReqVO); |
| 150 | 324 | ||
| @@ -155,76 +329,67 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { | @@ -155,76 +329,67 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { | ||
| 155 | 329 | ||
| 156 | @Test | 330 | @Test |
| 157 | void getSpuPage_alarmStock() { | 331 | void getSpuPage_alarmStock() { |
| 158 | - // mock 数据 | ||
| 159 | - Long brandId = generateId(); | ||
| 160 | - Long categoryId = generateId(); | ||
| 161 | - String code = generateNo(); | ||
| 162 | - | ||
| 163 | // 准备参数 | 332 | // 准备参数 |
| 164 | - ProductSpuDO createReqVO = randomPojo(ProductSpuDO.class, o->{ | ||
| 165 | - o.setStatus(ProductSpuStatusEnum.ENABLE.getStatus()); | ||
| 166 | - //o.setTotalStock(500); | ||
| 167 | - //o.setMinPrice(1); // TODO ProductSpuDO中已没有相关属性 | ||
| 168 | - //o.setMaxPrice(50); | ||
| 169 | - o.setMarketPrice(25); | ||
| 170 | - o.setBrandId(brandId); | ||
| 171 | - o.setCategoryId(categoryId); | ||
| 172 | - //o.setClickCount(100); | ||
| 173 | - //o.setCode(code); // TODO ProductSpuDO中已没有相关属性 | ||
| 174 | - o.setDescription("测试商品"); | ||
| 175 | - o.setSliderPicUrls(new ArrayList<>()); | ||
| 176 | - o.setName("测试"); | ||
| 177 | - o.setSalesCount(100); | ||
| 178 | - //o.setSellPoint("超级加倍"); | ||
| 179 | - //o.setShowStock(true); // TODO ProductSpuDO中已没有相关属性 | ||
| 180 | - o.setVideoUrl(""); | ||
| 181 | - }); | ||
| 182 | - productSpuMapper.insert(createReqVO); | ||
| 183 | - | ||
| 184 | - //Set<Long> alarmStockSpuIds = SetUtils.asSet(createReqVO.getId()); TODO 查询接口已改变没有使用到这个变量 | ||
| 185 | - | ||
| 186 | - List<ProductSkuDO> productSpuDOS = Arrays.asList(randomPojo(ProductSkuDO.class, o -> { | ||
| 187 | - o.setSpuId(createReqVO.getId()); | ||
| 188 | - }), randomPojo(ProductSkuDO.class, o -> { | ||
| 189 | - o.setSpuId(createReqVO.getId()); | 333 | + ArrayList<ProductSpuDO> createReqVOs = Lists.newArrayList(randomPojo(ProductSpuDO.class,o->{ |
| 334 | + o.setCategoryId(generateId()); | ||
| 335 | + o.setBrandId(generateId()); | ||
| 336 | + o.setDeliveryTemplateId(generateId()); | ||
| 337 | + o.setUnit(RandomUtil.randomInt(1,20)); // 限制商品单位范围 | ||
| 338 | + o.setSort(RandomUtil.randomInt(1,100)); // 限制排序范围 | ||
| 339 | + o.setGiveIntegral(generaInt()); // 限制范围为正整数 | ||
| 340 | + o.setVirtualSalesCount(generaInt()); // 限制范围为正整数 | ||
| 341 | + o.setActivityOrders(newArrayList(1,3,2,4,5)); // 活动排序 | ||
| 342 | + o.setPrice(generaInt()); // 限制范围为正整数 | ||
| 343 | + o.setMarketPrice(generaInt()); // 限制范围为正整数 | ||
| 344 | + o.setCostPrice(generaInt()); // 限制范围为正整数 | ||
| 345 | + o.setStock(5); // 限制范围为正整数 | ||
| 346 | + o.setGiveIntegral(generaInt()); // 限制范围为正整数 | ||
| 347 | + o.setSalesCount(generaInt()); // 限制范围为正整数 | ||
| 348 | + o.setBrowseCount(generaInt()); // 限制范围为正整数 | ||
| 349 | + }), randomPojo(ProductSpuDO.class,o->{ | ||
| 350 | + o.setCategoryId(generateId()); | ||
| 351 | + o.setBrandId(generateId()); | ||
| 352 | + o.setDeliveryTemplateId(generateId()); | ||
| 353 | + o.setUnit(RandomUtil.randomInt(1,20)); // 限制商品单位范围 | ||
| 354 | + o.setSort(RandomUtil.randomInt(1,100)); // 限制排序范围 | ||
| 355 | + o.setGiveIntegral(generaInt()); // 限制范围为正整数 | ||
| 356 | + o.setVirtualSalesCount(generaInt()); // 限制范围为正整数 | ||
| 357 | + o.setActivityOrders(newArrayList(1,3,2,4,5)); // 活动排序 | ||
| 358 | + o.setPrice(generaInt()); // 限制范围为正整数 | ||
| 359 | + o.setMarketPrice(generaInt()); // 限制范围为正整数 | ||
| 360 | + o.setCostPrice(generaInt()); // 限制范围为正整数 | ||
| 361 | + o.setStock(9); // 限制范围为正整数 | ||
| 362 | + o.setGiveIntegral(generaInt()); // 限制范围为正整数 | ||
| 363 | + o.setSalesCount(generaInt()); // 限制范围为正整数 | ||
| 364 | + o.setBrowseCount(generaInt()); // 限制范围为正整数 | ||
| 190 | })); | 365 | })); |
| 191 | - | ||
| 192 | - Mockito.when(productSkuService.getSkuListByAlarmStock()).thenReturn(productSpuDOS); | ||
| 193 | - | 366 | + productSpuMapper.insertBatch(createReqVOs); |
| 194 | // 调用 | 367 | // 调用 |
| 195 | ProductSpuPageReqVO productSpuPageReqVO = new ProductSpuPageReqVO(); | 368 | ProductSpuPageReqVO productSpuPageReqVO = new ProductSpuPageReqVO(); |
| 196 | - //productSpuPageReqVO.setAlarmStock(true); | 369 | + productSpuPageReqVO.setTabType(ProductSpuPageTabEnum.ALERT_STOCK.getType()); |
| 197 | PageResult<ProductSpuDO> spuPage = productSpuService.getSpuPage(productSpuPageReqVO); | 370 | PageResult<ProductSpuDO> spuPage = productSpuService.getSpuPage(productSpuPageReqVO); |
| 198 | - | ||
| 199 | - PageResult<ProductSpuPageRespVO> result = ProductSpuConvert.INSTANCE.convertPage(productSpuMapper.selectPage(productSpuPageReqVO)); | ||
| 200 | - Assertions.assertIterableEquals(result.getList(), spuPage.getList()); | ||
| 201 | - assertEquals(spuPage.getTotal(), result.getTotal()); | 371 | + assertEquals(createReqVOs.size(), spuPage.getTotal()); |
| 202 | } | 372 | } |
| 203 | 373 | ||
| 204 | @Test | 374 | @Test |
| 205 | - void getSpuPage() { | ||
| 206 | - // mock 数据 | ||
| 207 | - Long brandId = generateId(); | ||
| 208 | - Long categoryId = generateId(); | ||
| 209 | - | 375 | + void testGetSpuPage() { |
| 210 | // 准备参数 | 376 | // 准备参数 |
| 211 | - ProductSpuDO createReqVO = randomPojo(ProductSpuDO.class, o->{ | ||
| 212 | - o.setStatus(ProductSpuStatusEnum.ENABLE.getStatus()); | ||
| 213 | - //o.setTotalStock(1); | ||
| 214 | - //o.setMinPrice(1); // TODO ProductSpuDO中已没有相关属性 | ||
| 215 | - //o.setMaxPrice(1); | ||
| 216 | - o.setMarketPrice(1); | ||
| 217 | - o.setBrandId(brandId); | ||
| 218 | - o.setSpecType(false); | ||
| 219 | - o.setCategoryId(categoryId); | ||
| 220 | - //o.setClickCount(1); // TODO ProductSpuDO中已没有相关属性 | ||
| 221 | - //o.setCode(generateNo()); | ||
| 222 | - o.setDescription("测试商品"); | ||
| 223 | - o.setSliderPicUrls(new ArrayList<>()); | ||
| 224 | - o.setName("测试"); | ||
| 225 | - o.setSalesCount(1); | ||
| 226 | - //o.setSellPoint("卖点"); | ||
| 227 | - //o.setShowStock(true); // TODO ProductSpuDO中已没有相关属性 | 377 | + ProductSpuDO createReqVO = randomPojo(ProductSpuDO.class,o->{ |
| 378 | + o.setCategoryId(generateId()); | ||
| 379 | + o.setBrandId(generateId()); | ||
| 380 | + o.setDeliveryTemplateId(generateId()); | ||
| 381 | + o.setUnit(RandomUtil.randomInt(1,20)); // 限制商品单位范围 | ||
| 382 | + o.setSort(RandomUtil.randomInt(1,100)); // 限制排序范围 | ||
| 383 | + o.setGiveIntegral(generaInt()); // 限制范围为正整数 | ||
| 384 | + o.setVirtualSalesCount(generaInt()); // 限制范围为正整数 | ||
| 385 | + o.setActivityOrders(newArrayList(1,3,2,4,5)); // 活动排序 | ||
| 386 | + o.setPrice(generaInt()); // 限制范围为正整数 | ||
| 387 | + o.setMarketPrice(generaInt()); // 限制范围为正整数 | ||
| 388 | + o.setCostPrice(generaInt()); // 限制范围为正整数 | ||
| 389 | + o.setStock(generaInt()); // 限制范围为正整数 | ||
| 390 | + o.setGiveIntegral(generaInt()); // 限制范围为正整数 | ||
| 391 | + o.setSalesCount(generaInt()); // 限制范围为正整数 | ||
| 392 | + o.setBrowseCount(generaInt()); // 限制范围为正整数 | ||
| 228 | }); | 393 | }); |
| 229 | 394 | ||
| 230 | // 准备参数 | 395 | // 准备参数 |
| @@ -241,45 +406,21 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { | @@ -241,45 +406,21 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { | ||
| 241 | 406 | ||
| 242 | // 调用 | 407 | // 调用 |
| 243 | ProductSpuPageReqVO productSpuPageReqVO = new ProductSpuPageReqVO(); | 408 | ProductSpuPageReqVO productSpuPageReqVO = new ProductSpuPageReqVO(); |
| 244 | - // TODO 已暂时没有相关属性,等用到时再添加 | ||
| 245 | - //productSpuPageReqVO.setAlarmStock(false); | ||
| 246 | - //productSpuPageReqVO.setBrandId(brandId); | ||
| 247 | - //productSpuPageReqVO.setStatus(ProductSpuStatusEnum.ENABLE.getStatus()); | ||
| 248 | - //productSpuPageReqVO.setCategoryId(categoryId); | 409 | + // 查询条件 按需打开 |
| 410 | + //productSpuPageReqVO.setTabType(ProductSpuPageTabEnum.ALERT_STOCK.getType()); | ||
| 411 | + //productSpuPageReqVO.setTabType(ProductSpuPageTabEnum.RECYCLE_BIN.getType()); | ||
| 412 | + //productSpuPageReqVO.setTabType(ProductSpuPageTabEnum.FOR_SALE.getType()); | ||
| 413 | + //productSpuPageReqVO.setTabType(ProductSpuPageTabEnum.IN_WAREHOUSE.getType()); | ||
| 414 | + //productSpuPageReqVO.setTabType(ProductSpuPageTabEnum.SOLD_OUT.getType()); | ||
| 415 | + //productSpuPageReqVO.setName(createReqVO.getName()); | ||
| 416 | + //productSpuPageReqVO.setCategoryId(createReqVO.getCategoryId()); | ||
| 249 | 417 | ||
| 250 | PageResult<ProductSpuDO> spuPage = productSpuService.getSpuPage(productSpuPageReqVO); | 418 | PageResult<ProductSpuDO> spuPage = productSpuService.getSpuPage(productSpuPageReqVO); |
| 251 | 419 | ||
| 252 | - PageResult<ProductSpuPageRespVO> result = ProductSpuConvert.INSTANCE.convertPage(productSpuMapper.selectPage(productSpuPageReqVO)); | ||
| 253 | - assertEquals(result, spuPage); | 420 | + PageResult<ProductSpuRespVO> result = ProductSpuConvert.INSTANCE.convertPage(productSpuMapper.selectPage(productSpuPageReqVO)); |
| 421 | + assertEquals(result.getTotal(), spuPage.getTotal()); | ||
| 254 | } | 422 | } |
| 255 | 423 | ||
| 256 | - @Test | ||
| 257 | - void testGetSpuPage() { | ||
| 258 | -// 准备参数 | ||
| 259 | - ProductSpuDO createReqVO = randomPojo(ProductSpuDO.class, o -> { | ||
| 260 | - o.setCategoryId(2L); | ||
| 261 | - }); | ||
| 262 | - productSpuMapper.insert(createReqVO); | ||
| 263 | - | ||
| 264 | - // 调用 | ||
| 265 | - AppProductSpuPageReqVO appSpuPageReqVO = new AppProductSpuPageReqVO(); | ||
| 266 | - appSpuPageReqVO.setCategoryId(2L); | ||
| 267 | - | ||
| 268 | -// PageResult<AppSpuPageItemRespVO> spuPage = productSpuService.getSpuPage(appSpuPageReqVO); | ||
| 269 | -// | ||
| 270 | -// PageResult<ProductSpuDO> result = productSpuMapper.selectPage( | ||
| 271 | -// ProductSpuConvert.INSTANCE.convert(appSpuPageReqVO)); | ||
| 272 | -// | ||
| 273 | -// List<AppSpuPageItemRespVO> collect = result.getList() | ||
| 274 | -// .stream() | ||
| 275 | -// .map(ProductSpuConvert.INSTANCE::convertAppResp) | ||
| 276 | -// .collect(Collectors.toList()); | ||
| 277 | -// | ||
| 278 | -// Assertions.assertIterableEquals(collect, spuPage.getList()); | ||
| 279 | -// assertEquals(spuPage.getTotal(), result.getTotal()); | ||
| 280 | - } | ||
| 281 | - | ||
| 282 | - | ||
| 283 | /** | 424 | /** |
| 284 | * 生成笛卡尔积 | 425 | * 生成笛卡尔积 |
| 285 | * | 426 | * |
| @@ -316,14 +457,48 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { | @@ -316,14 +457,48 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { | ||
| 316 | // 准备参数 | 457 | // 准备参数 |
| 317 | Map<Long, Integer> stockIncrCounts = MapUtil.builder(1L, 10).put(2L, -20).build(); | 458 | Map<Long, Integer> stockIncrCounts = MapUtil.builder(1L, 10).put(2L, -20).build(); |
| 318 | // mock 方法(数据) // TODO ProductSpuDO中已没有相关属性 | 459 | // mock 方法(数据) // TODO ProductSpuDO中已没有相关属性 |
| 319 | - //productSpuMapper.insert(randomPojo(ProductSpuDO.class, o -> o.setId(1L).setTotalStock(20))); | ||
| 320 | - //productSpuMapper.insert(randomPojo(ProductSpuDO.class, o -> o.setId(2L).setTotalStock(30))); | 460 | + productSpuMapper.insert(randomPojo(ProductSpuDO.class, o ->{ |
| 461 | + o.setCategoryId(generateId()); | ||
| 462 | + o.setBrandId(generateId()); | ||
| 463 | + o.setDeliveryTemplateId(generateId()); | ||
| 464 | + o.setUnit(RandomUtil.randomInt(1,20)); // 限制商品单位范围 | ||
| 465 | + o.setSort(RandomUtil.randomInt(1,100)); // 限制排序范围 | ||
| 466 | + o.setGiveIntegral(generaInt()); // 限制范围为正整数 | ||
| 467 | + o.setVirtualSalesCount(generaInt()); // 限制范围为正整数 | ||
| 468 | + o.setActivityOrders(newArrayList(1,3,2,4,5)); // 活动排序 | ||
| 469 | + o.setPrice(generaInt()); // 限制范围为正整数 | ||
| 470 | + o.setMarketPrice(generaInt()); // 限制范围为正整数 | ||
| 471 | + o.setCostPrice(generaInt()); // 限制范围为正整数 | ||
| 472 | + o.setStock(generaInt()); // 限制范围为正整数 | ||
| 473 | + o.setGiveIntegral(generaInt()); // 限制范围为正整数 | ||
| 474 | + o.setSalesCount(generaInt()); // 限制范围为正整数 | ||
| 475 | + o.setBrowseCount(generaInt()); // 限制范围为正整数 | ||
| 476 | + o.setId(1L).setStock(20); | ||
| 477 | + })); | ||
| 478 | + productSpuMapper.insert(randomPojo(ProductSpuDO.class, o -> { | ||
| 479 | + o.setCategoryId(generateId()); | ||
| 480 | + o.setBrandId(generateId()); | ||
| 481 | + o.setDeliveryTemplateId(generateId()); | ||
| 482 | + o.setUnit(RandomUtil.randomInt(1,20)); // 限制商品单位范围 | ||
| 483 | + o.setSort(RandomUtil.randomInt(1,100)); // 限制排序范围 | ||
| 484 | + o.setGiveIntegral(generaInt()); // 限制范围为正整数 | ||
| 485 | + o.setVirtualSalesCount(generaInt()); // 限制范围为正整数 | ||
| 486 | + o.setActivityOrders(newArrayList(1,3,2,4,5)); // 活动排序 | ||
| 487 | + o.setPrice(generaInt()); // 限制范围为正整数 | ||
| 488 | + o.setMarketPrice(generaInt()); // 限制范围为正整数 | ||
| 489 | + o.setCostPrice(generaInt()); // 限制范围为正整数 | ||
| 490 | + o.setStock(generaInt()); // 限制范围为正整数 | ||
| 491 | + o.setGiveIntegral(generaInt()); // 限制范围为正整数 | ||
| 492 | + o.setSalesCount(generaInt()); // 限制范围为正整数 | ||
| 493 | + o.setBrowseCount(generaInt()); // 限制范围为正整数 | ||
| 494 | + o.setId(2L).setStock(30); | ||
| 495 | + })); | ||
| 321 | 496 | ||
| 322 | // 调用 | 497 | // 调用 |
| 323 | productSpuService.updateSpuStock(stockIncrCounts); | 498 | productSpuService.updateSpuStock(stockIncrCounts); |
| 324 | // 断言 // TODO ProductSpuDO中已没有相关属性 | 499 | // 断言 // TODO ProductSpuDO中已没有相关属性 |
| 325 | - //assertEquals(productSpuService.getSpu(1L).getTotalStock(), 30); | ||
| 326 | - //assertEquals(productSpuService.getSpu(2L).getTotalStock(), 10); | 500 | + assertEquals(productSpuService.getSpu(1L).getStock(), 30); |
| 501 | + assertEquals(productSpuService.getSpu(2L).getStock(), 10); | ||
| 327 | } | 502 | } |
| 328 | 503 | ||
| 329 | } | 504 | } |
yudao-module-mall/yudao-module-product-biz/src/test/resources/sql/clean.sql
| 1 | DELETE FROM "product_sku"; | 1 | DELETE FROM "product_sku"; |
| 2 | DELETE FROM "product_spu"; | 2 | DELETE FROM "product_spu"; |
| 3 | -DELETE FROM "product_brand"; | ||
| 4 | DELETE FROM "product_category"; | 3 | DELETE FROM "product_category"; |
| 4 | +DELETE FROM "product_brand"; | ||
| 5 | +DELETE FROM "product_property"; | ||
| 6 | +DELETE FROM "product_property_value"; | ||
| 5 | DELETE FROM "product_comment"; | 7 | DELETE FROM "product_comment"; |
yudao-module-mall/yudao-module-product-biz/src/test/resources/sql/create_tables.sql
| 1 | CREATE TABLE IF NOT EXISTS `product_sku` ( | 1 | CREATE TABLE IF NOT EXISTS `product_sku` ( |
| 2 | - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', | 2 | + `id` bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY, |
| 3 | `spu_id` bigint NOT NULL COMMENT 'spu编号', | 3 | `spu_id` bigint NOT NULL COMMENT 'spu编号', |
| 4 | - `spu_name` varchar DEFAULT NULL COMMENT '商品 SPU 名字', | ||
| 5 | - `properties` varchar DEFAULT NULL COMMENT '规格值数组-json格式, [{propertId: , valueId: }, {propertId: , valueId: }]', | ||
| 6 | - `price` int NOT NULL DEFAULT '-1' COMMENT '销售价格,单位:分', | ||
| 7 | - `market_price` int DEFAULT NULL COMMENT '市场价', | 4 | + `properties` varchar(512) DEFAULT NULL COMMENT '属性数组,JSON 格式', |
| 5 | + `price` int NOT NULL DEFAULT '-1' COMMENT '商品价格,单位:分', | ||
| 6 | + `market_price` int DEFAULT NULL COMMENT '市场价,单位:分', | ||
| 8 | `cost_price` int NOT NULL DEFAULT '-1' COMMENT '成本价,单位: 分', | 7 | `cost_price` int NOT NULL DEFAULT '-1' COMMENT '成本价,单位: 分', |
| 9 | - `pic_url` varchar NOT NULL COMMENT '图片地址', | 8 | + `bar_code` varchar(64) DEFAULT NULL COMMENT 'SKU 的条形码', |
| 9 | + `pic_url` varchar(256) NOT NULL COMMENT '图片地址', | ||
| 10 | `stock` int DEFAULT NULL COMMENT '库存', | 10 | `stock` int DEFAULT NULL COMMENT '库存', |
| 11 | - `warn_stock` int DEFAULT NULL COMMENT '预警库存', | ||
| 12 | - `volume` double DEFAULT NULL COMMENT '商品体积', | ||
| 13 | - `weight` double DEFAULT NULL COMMENT '商品重量', | ||
| 14 | - `bar_code` varchar DEFAULT NULL COMMENT '条形码', | ||
| 15 | - `status` tinyint DEFAULT NULL COMMENT '状态: 0-正常 1-禁用', | ||
| 16 | - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 17 | - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 18 | - `creator` varchar DEFAULT NULL COMMENT '创建人', | ||
| 19 | - `updater` varchar DEFAULT NULL COMMENT '更新人', | ||
| 20 | - `deleted` bit(1) NOT NULL DEFAULT 0 COMMENT '是否删除', | ||
| 21 | - PRIMARY KEY (`id`) | 11 | + `weight` double DEFAULT NULL COMMENT '商品重量,单位:kg 千克', |
| 12 | + `volume` double DEFAULT NULL COMMENT '商品体积,单位:m^3 平米', | ||
| 13 | + `sub_commission_first_price` int DEFAULT NULL COMMENT '一级分销的佣金,单位:分', | ||
| 14 | + `sub_commission_second_price` int DEFAULT NULL COMMENT '二级分销的佣金,单位:分', | ||
| 15 | + `sales_count` int DEFAULT NULL COMMENT '商品销量', | ||
| 16 | + "creator" varchar(64) DEFAULT '', | ||
| 17 | + "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 18 | + "updater" varchar(64) DEFAULT '', | ||
| 19 | + "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 20 | + "deleted" bit NOT NULL DEFAULT FALSE, | ||
| 21 | + "tenant_id" bigint not null default '0', | ||
| 22 | + PRIMARY KEY("id") | ||
| 22 | ) COMMENT '商品sku'; | 23 | ) COMMENT '商品sku'; |
| 23 | 24 | ||
| 24 | - | ||
| 25 | CREATE TABLE IF NOT EXISTS `product_spu` ( | 25 | CREATE TABLE IF NOT EXISTS `product_spu` ( |
| 26 | - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', | ||
| 27 | - `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号', | ||
| 28 | - `brand_id` bigint DEFAULT NULL COMMENT '商品品牌编号', | ||
| 29 | - `category_id` bigint NOT NULL COMMENT '分类id', | ||
| 30 | - `spec_type` int NOT NULL COMMENT '规格类型:0 单规格 1 多规格', | ||
| 31 | - `code` varchar(128) DEFAULT NULL COMMENT '商品编码', | 26 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '商品 SPU 编号,自增', |
| 32 | `name` varchar(128) NOT NULL COMMENT '商品名称', | 27 | `name` varchar(128) NOT NULL COMMENT '商品名称', |
| 33 | - `sell_point` varchar(128) DEFAULT NULL COMMENT '卖点', | ||
| 34 | - `description` text COMMENT '描述', | ||
| 35 | - `pic_urls` varchar(1024) DEFAULT '' COMMENT '商品轮播图地址数组,以逗号分隔最多上传15张', | ||
| 36 | - `video_url` varchar(128) DEFAULT NULL COMMENT '商品视频', | ||
| 37 | - `market_price` int DEFAULT NULL COMMENT '市场价,单位使用:分', | ||
| 38 | - `min_price` int DEFAULT NULL COMMENT '最小价格,单位使用:分', | ||
| 39 | - `max_price` int DEFAULT NULL COMMENT '最大价格,单位使用:分', | ||
| 40 | - `total_stock` int NOT NULL DEFAULT '0' COMMENT '总库存', | ||
| 41 | - `show_stock` int DEFAULT '0' COMMENT '是否展示库存', | 28 | + `keyword` varchar(256) NOT NULL COMMENT '关键字', |
| 29 | + `introduction` varchar(256) NOT NULL COMMENT '商品简介', | ||
| 30 | + `description` text NOT NULL COMMENT '商品详情', | ||
| 31 | + `bar_code` varchar(64) NOT NULL COMMENT '条形码', | ||
| 32 | + `category_id` bigint NOT NULL COMMENT '商品分类编号', | ||
| 33 | + `brand_id` int DEFAULT NULL COMMENT '商品品牌编号', | ||
| 34 | + `pic_url` varchar(256) NOT NULL COMMENT '商品封面图', | ||
| 35 | + `slider_pic_urls` varchar(2000) DEFAULT '' COMMENT '商品轮播图地址\n 数组,以逗号分隔\n 最多上传15张', | ||
| 36 | + `video_url` varchar(256) DEFAULT NULL COMMENT '商品视频', | ||
| 37 | + `unit` tinyint NOT NULL COMMENT '单位', | ||
| 38 | + `sort` int NOT NULL DEFAULT '0' COMMENT '排序字段', | ||
| 39 | + `status` tinyint NOT NULL COMMENT '商品状态: 0 上架(开启) 1 下架(禁用)-1 回收', | ||
| 40 | + `spec_type` bit(1) NOT NULL COMMENT '规格类型:0 单规格 1 多规格', | ||
| 41 | + `price` int NOT NULL DEFAULT '-1' COMMENT '商品价格,单位使用:分', | ||
| 42 | + `market_price` int NOT NULL COMMENT '市场价,单位使用:分', | ||
| 43 | + `cost_price` int NOT NULL DEFAULT '-1' COMMENT '成本价,单位: 分', | ||
| 44 | + `stock` int NOT NULL DEFAULT '0' COMMENT '库存', | ||
| 45 | + `delivery_template_id` bigint NOT NULL COMMENT '物流配置模板编号', | ||
| 46 | + `recommend_hot` bit(1) NOT NULL COMMENT '是否热卖推荐: 0 默认 1 热卖', | ||
| 47 | + `recommend_benefit` bit(1) NOT NULL COMMENT '是否优惠推荐: 0 默认 1 优选', | ||
| 48 | + `recommend_best` bit(1) NOT NULL COMMENT '是否精品推荐: 0 默认 1 精品', | ||
| 49 | + `recommend_new` bit(1) NOT NULL COMMENT '是否新品推荐: 0 默认 1 新品', | ||
| 50 | + `recommend_good` bit(1) NOT NULL COMMENT '是否优品推荐', | ||
| 51 | + `give_integral` int NOT NULL COMMENT '赠送积分', | ||
| 52 | + `give_coupon_template_ids` varchar(512) DEFAULT '' COMMENT '赠送的优惠劵编号的数组', | ||
| 53 | + `sub_commission_type` bit(1) NOT NULL COMMENT '分销类型', | ||
| 54 | + `activity_orders` varchar(16) NOT NULL DEFAULT '' COMMENT '活动显示排序0=默认, 1=秒杀,2=砍价,3=拼团', | ||
| 42 | `sales_count` int DEFAULT '0' COMMENT '商品销量', | 55 | `sales_count` int DEFAULT '0' COMMENT '商品销量', |
| 43 | `virtual_sales_count` int DEFAULT '0' COMMENT '虚拟销量', | 56 | `virtual_sales_count` int DEFAULT '0' COMMENT '虚拟销量', |
| 44 | - `click_count` int DEFAULT '0' COMMENT '商品点击量', | ||
| 45 | - `status` bit(1) DEFAULT NULL COMMENT '上下架状态: 0 上架(开启) 1 下架(禁用)-1 回收', | ||
| 46 | - `sort` int NOT NULL DEFAULT '0' COMMENT '排序字段', | ||
| 47 | - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 48 | - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 49 | - `creator` varchar DEFAULT NULL COMMENT '创建人', | ||
| 50 | - `updater` varchar DEFAULT NULL COMMENT '更新人', | ||
| 51 | - `deleted` bit(1) NOT NULL DEFAULT 0 COMMENT '是否删除', | ||
| 52 | -PRIMARY KEY (`id`) | 57 | + `browse_count` int DEFAULT '0' COMMENT '商品点击量', |
| 58 | + "creator" varchar(64) DEFAULT '', | ||
| 59 | + "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 60 | + "updater" varchar(64) DEFAULT '', | ||
| 61 | + "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 62 | + "deleted" bit NOT NULL DEFAULT FALSE, | ||
| 63 | + "tenant_id" bigint not null default '0', | ||
| 64 | + PRIMARY KEY("id") | ||
| 53 | ) COMMENT '商品spu'; | 65 | ) COMMENT '商品spu'; |
| 54 | 66 | ||
| 55 | CREATE TABLE IF NOT EXISTS `product_category` ( | 67 | CREATE TABLE IF NOT EXISTS `product_category` ( |
| 56 | `id` bigint NOT NULL AUTO_INCREMENT COMMENT '分类编号', | 68 | `id` bigint NOT NULL AUTO_INCREMENT COMMENT '分类编号', |
| 57 | - `parent_id` bigint DEFAULT NULL COMMENT '父分类编号', | ||
| 58 | - `name` varchar(128) NOT NULL COMMENT '分类名称', | ||
| 59 | - `pic_url` varchar DEFAULT NULL COMMENT '分类图片', | ||
| 60 | - `big_pic_url` varchar DEFAULT NULL COMMENT 'PC端分类图', | ||
| 61 | - `sort` int NOT NULL DEFAULT '0' COMMENT '排序字段', | ||
| 62 | - `status` bit(1) DEFAULT NULL COMMENT '状态', | ||
| 63 | - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 64 | - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 65 | - `creator` varchar DEFAULT NULL COMMENT '创建人', | ||
| 66 | - `updater` varchar DEFAULT NULL COMMENT '更新人', | ||
| 67 | - `deleted` bit(1) NOT NULL DEFAULT 0 COMMENT '是否删除', | ||
| 68 | - PRIMARY KEY (`id`) | 69 | + `parent_id` bigint NOT NULL COMMENT '父分类编号', |
| 70 | + `name` varchar(255) NOT NULL COMMENT '分类名称', | ||
| 71 | + `pic_url` varchar(255) NOT NULL COMMENT '移动端分类图', | ||
| 72 | + `big_pic_url` varchar(255) DEFAULT NULL COMMENT 'PC 端分类图', | ||
| 73 | + `sort` int DEFAULT '0' COMMENT '分类排序', | ||
| 74 | + `status` tinyint NOT NULL COMMENT '开启状态', | ||
| 75 | + "creator" varchar(64) DEFAULT '', | ||
| 76 | + "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 77 | + "updater" varchar(64) DEFAULT '', | ||
| 78 | + "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 79 | + "deleted" bit NOT NULL DEFAULT FALSE, | ||
| 80 | + "tenant_id" bigint not null default '0', | ||
| 81 | + PRIMARY KEY("id") | ||
| 69 | ) COMMENT '商品分类'; | 82 | ) COMMENT '商品分类'; |
| 70 | 83 | ||
| 71 | CREATE TABLE IF NOT EXISTS `product_brand` ( | 84 | CREATE TABLE IF NOT EXISTS `product_brand` ( |
| 72 | `id` bigint NOT NULL AUTO_INCREMENT COMMENT '品牌编号', | 85 | `id` bigint NOT NULL AUTO_INCREMENT COMMENT '品牌编号', |
| 73 | - `name` varchar(128) NOT NULL COMMENT '品牌名称', | ||
| 74 | - `pic_url` varchar DEFAULT NULL COMMENT '品牌图片', | ||
| 75 | - `sort` int NOT NULL DEFAULT '0' COMMENT '排序字段', | ||
| 76 | - `description` varchar(256) NOT NULL DEFAULT '0' COMMENT '品牌描述', | ||
| 77 | - `status` bit(1) DEFAULT NULL COMMENT '状态', | ||
| 78 | - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 79 | - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 80 | - `creator` varchar DEFAULT NULL COMMENT '创建人', | ||
| 81 | - `updater` varchar DEFAULT NULL COMMENT '更新人', | ||
| 82 | - `deleted` bit(1) NOT NULL DEFAULT 0 COMMENT '是否删除', | ||
| 83 | - PRIMARY KEY (`id`) | 86 | + `name` varchar(255) NOT NULL COMMENT '品牌名称', |
| 87 | + `pic_url` varchar(255) NOT NULL COMMENT '品牌图片', | ||
| 88 | + `sort` int DEFAULT '0' COMMENT '品牌排序', | ||
| 89 | + `description` varchar(1024) DEFAULT NULL COMMENT '品牌描述', | ||
| 90 | + `status` tinyint NOT NULL COMMENT '状态', | ||
| 91 | + "creator" varchar(64) DEFAULT '', | ||
| 92 | + "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 93 | + "updater" varchar(64) DEFAULT '', | ||
| 94 | + "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 95 | + "deleted" bit NOT NULL DEFAULT FALSE, | ||
| 96 | + "tenant_id" bigint not null default '0', | ||
| 97 | + PRIMARY KEY("id") | ||
| 84 | ) COMMENT '商品品牌'; | 98 | ) COMMENT '商品品牌'; |
| 85 | 99 | ||
| 100 | +CREATE TABLE IF NOT EXISTS `product_property` ( | ||
| 101 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', | ||
| 102 | + `name` varchar(64) DEFAULT NULL COMMENT '规格名称', | ||
| 103 | + `status` tinyint DEFAULT NULL COMMENT '状态: 0 开启 ,1 禁用', | ||
| 104 | + "creator" varchar(64) DEFAULT '', | ||
| 105 | + "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 106 | + "updater" varchar(64) DEFAULT '', | ||
| 107 | + "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 108 | + "deleted" bit NOT NULL DEFAULT FALSE, | ||
| 109 | + "tenant_id" bigint not null default '0', | ||
| 110 | + `remark` varchar(255) DEFAULT NULL COMMENT '备注', | ||
| 111 | + PRIMARY KEY("id") | ||
| 112 | +) COMMENT '规格名称'; | ||
| 113 | + | ||
| 114 | +CREATE TABLE IF NOT EXISTS `product_property_value` ( | ||
| 115 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', | ||
| 116 | + `property_id` bigint DEFAULT NULL COMMENT '规格键id', | ||
| 117 | + `name` varchar(128) DEFAULT NULL COMMENT '规格值名字', | ||
| 118 | + `status` tinyint DEFAULT NULL COMMENT '状态: 1 开启 ,2 禁用', | ||
| 119 | + "creator" varchar(64) DEFAULT '', | ||
| 120 | + "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 121 | + "updater" varchar(64) DEFAULT '', | ||
| 122 | + "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 123 | + "deleted" bit NOT NULL DEFAULT FALSE, | ||
| 124 | + "tenant_id" bigint not null default '0', | ||
| 125 | + `remark` varchar(255) DEFAULT NULL COMMENT '备注', | ||
| 126 | + PRIMARY KEY("id") | ||
| 127 | +) COMMENT '规格值'; | ||
| 128 | + | ||
| 86 | CREATE TABLE IF NOT EXISTS `product_comment` ( | 129 | CREATE TABLE IF NOT EXISTS `product_comment` ( |
| 87 | `id` bigint NOT NULL AUTO_INCREMENT COMMENT '评价编号', | 130 | `id` bigint NOT NULL AUTO_INCREMENT COMMENT '评价编号', |
| 88 | `user_id` bigint NOT NULL COMMENT ' 评价ID 用户编号', | 131 | `user_id` bigint NOT NULL COMMENT ' 评价ID 用户编号', |
| @@ -108,10 +151,11 @@ CREATE TABLE IF NOT EXISTS `product_comment` ( | @@ -108,10 +151,11 @@ CREATE TABLE IF NOT EXISTS `product_comment` ( | ||
| 108 | `additional_content` varchar(2000) COMMENT '追加评价内容', | 151 | `additional_content` varchar(2000) COMMENT '追加评价内容', |
| 109 | `additional_pic_urls` varchar(1024) COMMENT '追评评价图片地址数组,以逗号分隔最多上传9张', | 152 | `additional_pic_urls` varchar(1024) COMMENT '追评评价图片地址数组,以逗号分隔最多上传9张', |
| 110 | `additional_time` datetime COMMENT '追加评价时间', | 153 | `additional_time` datetime COMMENT '追加评价时间', |
| 111 | - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 112 | - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 113 | - `creator` varchar DEFAULT NULL COMMENT '创建人', | ||
| 114 | - `updater` varchar DEFAULT NULL COMMENT '更新人', | ||
| 115 | - `deleted` bit(1) NOT NULL DEFAULT 0 COMMENT '是否删除', | 154 | + "creator" varchar(64) DEFAULT '', |
| 155 | + "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 156 | + "updater" varchar(64) DEFAULT '', | ||
| 157 | + "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 158 | + "deleted" bit NOT NULL DEFAULT FALSE, | ||
| 159 | + "tenant_id" bigint not null default '0', | ||
| 116 | PRIMARY KEY (`id`) | 160 | PRIMARY KEY (`id`) |
| 117 | ) COMMENT '商品评价'; | 161 | ) COMMENT '商品评价'; |
| 118 | \ No newline at end of file | 162 | \ No newline at end of file |