refactor: 商品模块重构

This commit is contained in:
Ray.Hao 2024-04-26 23:56:29 +08:00
parent 956d8dd213
commit f75fd2bfa7
38 changed files with 665 additions and 465 deletions

View File

@ -1,4 +1,18 @@
use youlai_mall_pms;
/*
Navicat Premium Data Transfer
Source Server : localhost
Source Server Type : MySQL
Source Server Version : 80027
Source Host : 192.168.10.192:3306
Source Schema : youlai_mall_pms
Target Server Type : MySQL
Target Server Version : 80027
File Encoding : 65001
Date: 26/04/2024 23:36:05
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
@ -15,8 +29,9 @@ CREATE TABLE `pms_attribute` (
`options` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '逗号分割的可选值列表仅当input_type是2使用',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
`is_deleted` tinyint NOT NULL DEFAULT 0 COMMENT '逻辑删除标识0-未删除1-已删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of pms_attribute
@ -27,14 +42,15 @@ CREATE TABLE `pms_attribute` (
-- ----------------------------
DROP TABLE IF EXISTS `pms_attribute_group`;
CREATE TABLE `pms_attribute_group` (
`id` bigint NOT NULL AUTO_INCREMENT,
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`sort` smallint NULL DEFAULT NULL,
`remark` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`create_time` datetime NULL DEFAULT NULL,
`update_time` datetime NULL DEFAULT NULL,
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '属性组ID',
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '属性组名称',
`sort` smallint NOT NULL DEFAULT 1 COMMENT '排序',
`remark` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
`is_deleted` tinyint NOT NULL DEFAULT 0 COMMENT '逻辑删除标识0-未删除1-已删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of pms_attribute_group
@ -45,52 +61,53 @@ CREATE TABLE `pms_attribute_group` (
-- ----------------------------
DROP TABLE IF EXISTS `pms_brand`;
CREATE TABLE `pms_brand` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '品牌ID',
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '品牌名称',
`logo_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'LOGO图片',
`sort` int NULL DEFAULT NULL COMMENT '排序',
`logo_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'Logo图片URL',
`sort` int NOT NULL DEFAULT 1 COMMENT '排序',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
`is_deleted` tinyint NOT NULL DEFAULT 0 COMMENT '逻辑删除标识0-未删除1-已删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 33 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '商品品牌表' ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 34 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '商品品牌表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of pms_brand
-- ----------------------------
INSERT INTO `pms_brand` VALUES (1, '有来', 'http://a.youlai.tech:9000/default/5409e3deb5a14b8fa8cb4275dee0e25d.png', 1, '2021-07-11 19:56:58', '2021-07-11 20:02:54');
INSERT INTO `pms_brand` VALUES (10, '小米', 'http://a.youlai.tech:9000/default/6a5a606fc60742919149a7861bf26cd5.jpg', 2, '2022-03-05 16:12:16', '2022-03-05 16:12:16');
INSERT INTO `pms_brand` VALUES (11, '华硕', 'http://a.youlai.tech:9000/default/f18083f95e104a0bae3c587dee3bb2ed.png', 3, '2022-03-05 16:12:16', '2022-03-05 16:12:16');
INSERT INTO `pms_brand` VALUES (20, '华为', 'https://oss.youlai.tech/default/ff61bd639b23491d8f2aa85d09fcf788.jpg', 1, '2022-05-06 23:08:33', '2022-05-06 23:08:33');
INSERT INTO `pms_brand` VALUES (33, '惠普', 'https://oss.youlai.tech/default/4cf579add9544c6eaafb41ce1131559e.gif', 1, '2022-07-07 00:12:16', '2022-07-07 00:12:16');
INSERT INTO `pms_brand` VALUES (1, '有来', 'http://a.youlai.tech:9000/default/5409e3deb5a14b8fa8cb4275dee0e25d.png', 1, '2021-07-11 19:56:58', '2021-07-11 20:02:54', 0);
INSERT INTO `pms_brand` VALUES (10, '小米', 'http://a.youlai.tech:9000/default/6a5a606fc60742919149a7861bf26cd5.jpg', 2, '2022-03-05 16:12:16', '2022-03-05 16:12:16', 0);
INSERT INTO `pms_brand` VALUES (11, '华硕', 'http://a.youlai.tech:9000/default/f18083f95e104a0bae3c587dee3bb2ed.png', 3, '2022-03-05 16:12:16', '2022-03-05 16:12:16', 0);
INSERT INTO `pms_brand` VALUES (20, '华为', 'https://oss.youlai.tech/default/ff61bd639b23491d8f2aa85d09fcf788.jpg', 1, '2022-05-06 23:08:33', '2022-05-06 23:08:33', 0);
INSERT INTO `pms_brand` VALUES (33, '惠普', 'https://oss.youlai.tech/default/4cf579add9544c6eaafb41ce1131559e.gif', 1, '2022-07-07 00:12:16', '2022-07-07 00:12:16', 0);
-- ----------------------------
-- Table structure for pms_category
-- ----------------------------
DROP TABLE IF EXISTS `pms_category`;
CREATE TABLE `pms_category` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '商品分类名称',
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '分类ID',
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '分类名称',
`parent_id` bigint NOT NULL COMMENT '父级ID',
`level` int NULL DEFAULT NULL COMMENT '层级',
`icon_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '图标地址',
`sort` int NULL DEFAULT NULL COMMENT '排序',
`visible` tinyint(1) NULL DEFAULT 1 COMMENT '显示状态:( 0:隐藏 1:显示)',
`sort` int NOT NULL DEFAULT 1 COMMENT '排序',
`visible` tinyint(1) NULL DEFAULT 1 COMMENT '显示状态(1-显示0-隐藏)',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
`is_deleted` tinyint NULL DEFAULT 0 COMMENT '逻辑删除标识(0-未删除1-已删除)',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 101 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '商品分类表' ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 102 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '商品分类表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of pms_category
-- ----------------------------
INSERT INTO `pms_category` VALUES (3, '手机配件', 0, 1, NULL, 2, 1, NULL, '2022-07-07 22:56:53');
INSERT INTO `pms_category` VALUES (4, '智能手机', 3, 2, NULL, 1, 1, NULL, NULL);
INSERT INTO `pms_category` VALUES (5, '5g手机', 4, 3, 'https://oss.youlai.tech/default/6ffb37110ac2434a9882b9e8968b2887.jpg', 1, 1, NULL, '2022-07-08 00:28:38');
INSERT INTO `pms_category` VALUES (6, '电脑办公', 0, 1, 'https://www.youlai.tech/files/default/776c21c1a71848069093033f461c5f4a.jpg', 1, 1, '2022-02-25 11:22:44', '2022-07-07 22:56:38');
INSERT INTO `pms_category` VALUES (97, '笔记本电脑', 6, 2, NULL, 100, 1, '2022-07-08 00:10:27', '2022-07-08 00:10:27');
INSERT INTO `pms_category` VALUES (99, '三星轻薄本', 97, 3, 'https://oss.youlai.tech/default/2f849b96ebb54ab3a94b1b90137f1b4d.png', 100, 1, '2022-07-08 00:14:03', '2022-07-08 00:26:52');
INSERT INTO `pms_category` VALUES (100, '全能本', 97, 3, 'https://oss.youlai.tech/default/37cc080ec61b4ce7b0583b002568ebaa.png', 100, 1, '2022-07-08 00:14:10', '2022-07-08 00:27:01');
INSERT INTO `pms_category` VALUES (101, '游戏本', 97, 3, 'https://oss.youlai.tech/default/5c1a2d5427534b48bc382caa55197f11.png', 100, 1, '2022-07-08 00:14:18', '2022-07-08 00:27:11');
INSERT INTO `pms_category` VALUES (3, '手机配件', 0, NULL, 2, 1, NULL, '2022-07-07 22:56:53', 0);
INSERT INTO `pms_category` VALUES (4, '智能手机', 3, NULL, 1, 1, NULL, NULL, 0);
INSERT INTO `pms_category` VALUES (5, '5g手机', 4, 'https://oss.youlai.tech/default/6ffb37110ac2434a9882b9e8968b2887.jpg', 1, 1, NULL, '2022-07-08 00:28:38', 0);
INSERT INTO `pms_category` VALUES (6, '电脑办公', 0, 'https://www.youlai.tech/files/default/776c21c1a71848069093033f461c5f4a.jpg', 1, 1, '2022-02-25 11:22:44', '2022-07-07 22:56:38', 0);
INSERT INTO `pms_category` VALUES (97, '笔记本电脑', 6, NULL, 100, 1, '2022-07-08 00:10:27', '2022-07-08 00:10:27', 0);
INSERT INTO `pms_category` VALUES (99, '三星轻薄本', 97, 'https://oss.youlai.tech/default/2f849b96ebb54ab3a94b1b90137f1b4d.png', 100, 1, '2022-07-08 00:14:03', '2022-07-08 00:26:52', 0);
INSERT INTO `pms_category` VALUES (100, '全能本', 97, 'https://oss.youlai.tech/default/37cc080ec61b4ce7b0583b002568ebaa.png', 100, 1, '2022-07-08 00:14:10', '2022-07-08 00:27:01', 0);
INSERT INTO `pms_category` VALUES (101, '游戏本', 97, 'https://oss.youlai.tech/default/5c1a2d5427534b48bc382caa55197f11.png', 100, 1, '2022-07-08 00:14:18', '2022-07-08 00:27:11', 0);
-- ----------------------------
-- Table structure for pms_category_brand
@ -112,40 +129,40 @@ CREATE TABLE `pms_category_brand` (
DROP TABLE IF EXISTS `pms_sku`;
CREATE TABLE `pms_sku` (
`id` bigint NOT NULL AUTO_INCREMENT,
`sku_sn` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '商品编码',
`sku_sn` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'SKU编码',
`spu_id` bigint NOT NULL COMMENT 'SPU ID',
`name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '商品名称',
`spec_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '商品规格值,以英文逗号(,)分割',
`price` bigint NULL DEFAULT NULL COMMENT '商品价格(单位:分)',
`stock` int UNSIGNED NULL DEFAULT NULL COMMENT '库存数量',
`locked_stock` int NULL DEFAULT NULL COMMENT '库存锁定数量',
`img_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '商品图片URL',
`img_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'SKU 图片URL',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
`is_deleted` tinyint NULL DEFAULT NULL COMMENT '逻辑删除标识0-未删除1-已删除',
PRIMARY KEY (`id`) USING BTREE,
INDEX `fk_pms_sku_pms_spu`(`spu_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 17 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '商品库存表' ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 755 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '商品库存表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of pms_sku
-- ----------------------------
INSERT INTO `pms_sku` VALUES (1, 'sn001', 1, '黑 6+128g', '1_3', 399900, 990, 150, 'https://www.youlai.tech/files/default/c25b39470474494485633c49101a0f5d.png', '2021-08-08 00:43:26', '2022-07-03 14:16:16');
INSERT INTO `pms_sku` VALUES (2, 'sn002', 1, '黑 8+256g', '1_4', 499900, 999, 0, 'https://www.youlai.tech/files/default/c25b39470474494485633c49101a0f5d.png', '2021-08-08 00:43:26', '2022-07-03 14:16:16');
INSERT INTO `pms_sku` VALUES (3, 'sn003', 1, '蓝 6+128g', '216_3', 399900, 999, 0, 'https://www.youlai.tech/files/default/835d73a337964b9b97e5c7c90acc8cb2.png', '2022-03-05 09:25:53', '2022-07-03 14:16:16');
INSERT INTO `pms_sku` VALUES (4, 'sn004', 1, '蓝 8+256g', '216_4', 499900, 999, 0, 'https://www.youlai.tech/files/default/835d73a337964b9b97e5c7c90acc8cb2.png', '2022-03-05 09:25:53', '2022-07-03 14:16:16');
INSERT INTO `pms_sku` VALUES (5, '10000001', 2, '魔幻青 RTX3060/i7-12700H/165Hz 2.5K屏', '256_258', 1025000, 998, 0, 'http://a.youlai.tech:9000/default/8815c9a46fcc4b1ea952623406750da5.jpg', '2022-03-11 14:39:21', '2022-07-08 00:29:56');
INSERT INTO `pms_sku` VALUES (6, '10000002', 2, '魔幻青 RTX3050tTi/12代i5/144Hz高色域屏', '256_259', 925000, 999, 0, 'http://a.youlai.tech:9000/default/8815c9a46fcc4b1ea952623406750da5.jpg', '2022-03-11 14:39:21', '2022-07-08 00:29:56');
INSERT INTO `pms_sku` VALUES (7, '10000003', 2, '日蚀灰 RTX3060/i7-12700H/165Hz 2.5K屏', '257_258', 1025000, 999, 0, 'http://a.youlai.tech:9000/default/3210cd1ffb6c4346b743a10855d3cb37.jpg', '2022-03-11 14:39:21', '2022-07-08 00:29:56');
INSERT INTO `pms_sku` VALUES (8, '10000004', 2, '日蚀灰 RTX3050tTi/12代i5/144Hz高色域屏', '257_259', 925000, 999, 0, 'http://a.youlai.tech:9000/default/3210cd1ffb6c4346b743a10855d3cb37.jpg', '2022-03-11 14:39:21', '2022-07-08 00:29:56');
INSERT INTO `pms_sku` VALUES (9, '111', 3, '16g 512g 【2022款】锐龙六核R5-6600U/核芯显卡/100%sRGB高色域', '841_843_845', 589900, 992, 1, 'https://oss.youlai.tech/youlai-boot/2023/06/08/78b8efecb753426f81e5dcfcd175495f.jpg', '2022-07-07 00:22:13', '2022-07-08 00:29:41');
INSERT INTO `pms_sku` VALUES (10, '112', 3, '16g 512g 【2022款】锐龙八核R7-6800U/核芯显卡/100%sRGB高色域', '841_843_846', 629900, 999, 0, 'https://oss.youlai.tech/youlai-boot/2023/06/08/93cbc9dc6fe144f5a59793a6248479a0.jpg', '2022-07-07 00:22:13', '2022-07-08 00:29:41');
INSERT INTO `pms_sku` VALUES (11, '113', 3, '16g 1t 【2022款】锐龙六核R5-6600U/核芯显卡/100%sRGB高色域', '841_844_845', 639900, 999, 0, 'https://oss.youlai.tech/youlai-boot/2023/06/08/78b8efecb753426f81e5dcfcd175495f.jpg', '2022-07-07 00:22:13', '2022-07-08 00:29:41');
INSERT INTO `pms_sku` VALUES (12, '114', 3, '16g 1t 【2022款】锐龙八核R7-6800U/核芯显卡/100%sRGB高色域', '841_844_846', 639900, 999, 0, 'https://oss.youlai.tech/youlai-boot/2023/06/08/93cbc9dc6fe144f5a59793a6248479a0.jpg', '2022-07-07 00:22:13', '2022-07-08 00:29:41');
INSERT INTO `pms_sku` VALUES (13, '115', 3, '32g 512g 【2022款】锐龙六核R5-6600U/核芯显卡/100%sRGB高色域', '842_843_845', 589900, 999, 0, 'https://oss.youlai.tech/youlai-boot/2023/06/08/78b8efecb753426f81e5dcfcd175495f.jpg', '2022-07-07 00:22:13', '2022-07-08 00:29:41');
INSERT INTO `pms_sku` VALUES (14, '116', 3, '32g 512g 【2022款】锐龙八核R7-6800U/核芯显卡/100%sRGB高色域', '842_843_846', 629900, 999, 0, 'https://oss.youlai.tech/youlai-boot/2023/06/08/93cbc9dc6fe144f5a59793a6248479a0.jpg', '2022-07-07 00:22:13', '2022-07-08 00:29:41');
INSERT INTO `pms_sku` VALUES (15, '117', 3, '32g 1t 【2022款】锐龙六核R5-6600U/核芯显卡/100%sRGB高色域', '842_844_845', 639900, 999, 0, 'https://oss.youlai.tech/youlai-boot/2023/06/08/78b8efecb753426f81e5dcfcd175495f.jpg', '2022-07-07 00:22:13', '2022-07-08 00:29:41');
INSERT INTO `pms_sku` VALUES (16, '118', 3, '32g 1t 【2022款】锐龙八核R7-6800U/核芯显卡/100%sRGB高色域', '842_844_846', 639900, 999, 0, 'https://oss.youlai.tech/youlai-boot/2023/06/08/93cbc9dc6fe144f5a59793a6248479a0.jpg', '2022-07-07 00:22:13', '2022-07-08 00:29:41');
INSERT INTO `pms_sku` VALUES (17, 'sn001', 4, '黑 6+128g', '1_3', 399900, 999, 0, 'https://oss.youlai.tech/youlai-boot/2023/06/08/6b83dd33eaa248ed8e11cff0003287ee.jpg', '2021-08-08 00:43:26', '2022-07-03 14:16:16');
INSERT INTO `pms_sku` VALUES (1, 'sn001', 1, '黑 6+128g', 399900, 990, 150, 'https://www.youlai.tech/files/default/c25b39470474494485633c49101a0f5d.png', '2021-08-08 00:43:26', '2022-07-03 14:16:16', 0);
INSERT INTO `pms_sku` VALUES (2, 'sn002', 1, '黑 8+256g', 499900, 999, 0, 'https://www.youlai.tech/files/default/c25b39470474494485633c49101a0f5d.png', '2021-08-08 00:43:26', '2022-07-03 14:16:16', 0);
INSERT INTO `pms_sku` VALUES (3, 'sn003', 1, '蓝 6+128g', 399900, 999, 0, 'https://www.youlai.tech/files/default/835d73a337964b9b97e5c7c90acc8cb2.png', '2022-03-05 09:25:53', '2022-07-03 14:16:16', 0);
INSERT INTO `pms_sku` VALUES (4, 'sn004', 1, '蓝 8+256g', 499900, 999, 0, 'https://www.youlai.tech/files/default/835d73a337964b9b97e5c7c90acc8cb2.png', '2022-03-05 09:25:53', '2022-07-03 14:16:16', 0);
INSERT INTO `pms_sku` VALUES (5, '10000001', 2, '魔幻青 RTX3060/i7-12700H/165Hz 2.5K屏', 1025000, 998, 0, 'http://a.youlai.tech:9000/default/8815c9a46fcc4b1ea952623406750da5.jpg', '2022-03-11 14:39:21', '2022-07-08 00:29:56', 0);
INSERT INTO `pms_sku` VALUES (6, '10000002', 2, '魔幻青 RTX3050tTi/12代i5/144Hz高色域屏', 925000, 999, 0, 'http://a.youlai.tech:9000/default/8815c9a46fcc4b1ea952623406750da5.jpg', '2022-03-11 14:39:21', '2022-07-08 00:29:56', 0);
INSERT INTO `pms_sku` VALUES (7, '10000003', 2, '日蚀灰 RTX3060/i7-12700H/165Hz 2.5K屏', 1025000, 999, 0, 'http://a.youlai.tech:9000/default/3210cd1ffb6c4346b743a10855d3cb37.jpg', '2022-03-11 14:39:21', '2022-07-08 00:29:56', 0);
INSERT INTO `pms_sku` VALUES (8, '10000004', 2, '日蚀灰 RTX3050tTi/12代i5/144Hz高色域屏', 925000, 999, 0, 'http://a.youlai.tech:9000/default/3210cd1ffb6c4346b743a10855d3cb37.jpg', '2022-03-11 14:39:21', '2022-07-08 00:29:56', 0);
INSERT INTO `pms_sku` VALUES (9, '111', 3, '16g 512g 【2022款】锐龙六核R5-6600U/核芯显卡/100%sRGB高色域', 589900, 992, 1, 'https://oss.youlai.tech/youlai-boot/2023/06/08/78b8efecb753426f81e5dcfcd175495f.jpg', '2022-07-07 00:22:13', '2022-07-08 00:29:41', 0);
INSERT INTO `pms_sku` VALUES (10, '112', 3, '16g 512g 【2022款】锐龙八核R7-6800U/核芯显卡/100%sRGB高色域', 629900, 999, 0, 'https://oss.youlai.tech/youlai-boot/2023/06/08/93cbc9dc6fe144f5a59793a6248479a0.jpg', '2022-07-07 00:22:13', '2022-07-08 00:29:41', 0);
INSERT INTO `pms_sku` VALUES (11, '113', 3, '16g 1t 【2022款】锐龙六核R5-6600U/核芯显卡/100%sRGB高色域', 639900, 999, 0, 'https://oss.youlai.tech/youlai-boot/2023/06/08/78b8efecb753426f81e5dcfcd175495f.jpg', '2022-07-07 00:22:13', '2022-07-08 00:29:41', 0);
INSERT INTO `pms_sku` VALUES (12, '114', 3, '16g 1t 【2022款】锐龙八核R7-6800U/核芯显卡/100%sRGB高色域', 639900, 999, 0, 'https://oss.youlai.tech/youlai-boot/2023/06/08/93cbc9dc6fe144f5a59793a6248479a0.jpg', '2022-07-07 00:22:13', '2022-07-08 00:29:41', 0);
INSERT INTO `pms_sku` VALUES (13, '115', 3, '32g 512g 【2022款】锐龙六核R5-6600U/核芯显卡/100%sRGB高色域', 589900, 999, 0, 'https://oss.youlai.tech/youlai-boot/2023/06/08/78b8efecb753426f81e5dcfcd175495f.jpg', '2022-07-07 00:22:13', '2022-07-08 00:29:41', 0);
INSERT INTO `pms_sku` VALUES (14, '116', 3, '32g 512g 【2022款】锐龙八核R7-6800U/核芯显卡/100%sRGB高色域', 629900, 999, 0, 'https://oss.youlai.tech/youlai-boot/2023/06/08/93cbc9dc6fe144f5a59793a6248479a0.jpg', '2022-07-07 00:22:13', '2022-07-08 00:29:41', 0);
INSERT INTO `pms_sku` VALUES (15, '117', 3, '32g 1t 【2022款】锐龙六核R5-6600U/核芯显卡/100%sRGB高色域', 639900, 999, 0, 'https://oss.youlai.tech/youlai-boot/2023/06/08/78b8efecb753426f81e5dcfcd175495f.jpg', '2022-07-07 00:22:13', '2022-07-08 00:29:41', 0);
INSERT INTO `pms_sku` VALUES (16, '118', 3, '32g 1t 【2022款】锐龙八核R7-6800U/核芯显卡/100%sRGB高色域', 639900, 999, 0, 'https://oss.youlai.tech/youlai-boot/2023/06/08/93cbc9dc6fe144f5a59793a6248479a0.jpg', '2022-07-07 00:22:13', '2022-07-08 00:29:41', 0);
INSERT INTO `pms_sku` VALUES (17, 'sn001', 4, '黑 6+128g', 399900, 999, 0, 'https://oss.youlai.tech/youlai-boot/2023/06/08/6b83dd33eaa248ed8e11cff0003287ee.jpg', '2021-08-08 00:43:26', '2022-07-03 14:16:16', 0);
-- ----------------------------
-- Table structure for pms_sku_spec_value
@ -161,36 +178,6 @@ CREATE TABLE `pms_sku_spec_value` (
-- Records of pms_sku_spec_value
-- ----------------------------
-- ----------------------------
-- Table structure for pms_spec
-- ----------------------------
DROP TABLE IF EXISTS `pms_spec`;
CREATE TABLE `pms_spec` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '规格 ID',
`spu_id` int NULL DEFAULT NULL COMMENT 'SPU ID',
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规格名称',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of pms_spec
-- ----------------------------
-- ----------------------------
-- Table structure for pms_spec_value
-- ----------------------------
DROP TABLE IF EXISTS `pms_spec_value`;
CREATE TABLE `pms_spec_value` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '规格值ID',
`spec_id` bigint NOT NULL COMMENT '规格ID',
`value` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规格值',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of pms_spec_value
-- ----------------------------
-- ----------------------------
-- Table structure for pms_spu
-- ----------------------------
@ -198,95 +185,123 @@ DROP TABLE IF EXISTS `pms_spu`;
CREATE TABLE `pms_spu` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '商品名称',
`status` tinyint NULL DEFAULT 1 COMMENT '状态1-在售, 0-下架',
`category_id` bigint NOT NULL COMMENT '类型ID',
`brand_id` bigint NULL DEFAULT NULL COMMENT '品牌ID',
`origin_price` bigint NOT NULL COMMENT '原价【起】',
`price` bigint NOT NULL COMMENT '现价【起】',
`sales` int NULL DEFAULT 0 COMMENT '销量',
`img_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '商品主图',
`album` json NULL COMMENT '商品图册',
`unit` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '单位',
`description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '商品简介',
`detail` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '商品详情',
`status` tinyint NULL DEFAULT 1 COMMENT '商品状态(0:下架 1:上架)',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
`is_deleted` tinyint NULL DEFAULT NULL COMMENT '逻辑删除标识0-未删除1-已删除',
PRIMARY KEY (`id`) USING BTREE,
INDEX `fk_pms_spu_pms_brand`(`brand_id`) USING BTREE,
INDEX `fk_pms_spu_pms_category`(`category_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '商品表' ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 288 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '商品表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of pms_spu
-- ----------------------------
INSERT INTO `pms_spu` VALUES (1, 'Galaxy Z Fold5', 5, 10, 599900, 599900, 1, 'https://shop-image.samsung.com.cn/productv5/img/2023/07/26/64c0e30fe4b08db29258c50c.png', '[\"https://shop-image.samsung.com.cn/productv5/img/2023/07/26/64c0e30fe4b08db29258c50c.png\"]', '', '好快,好稳,\n好一次强上加强。\n高通全新一代芯片赋能速度大幅提升。\n三大专业主摄影像加持能力全面进化。\n大师级设计理念新诠释质感简而不凡。\n斩获十五项纪录旗舰屏感官万般出众。', '<p><img src=\"https://shop-image.samsung.com.cn/productv5/img/2023/11/03/65449d3ee4b08db20823bcbe.jpg\" alt=\"\" data-href=\"\" style=\"width: 449.00px;height: 449.00px;\"/></p>', 1, NULL, '2022-07-03 14:16:16');
INSERT INTO `pms_spu` VALUES (2, '华硕天选3', 101, 11, 1145000, 929900, 0, 'https://www.youlai.tech/files/default/d97457b3fd7d4aef8846da96fe032bf8.jpg', '[\"https://www.youlai.tech/files/default/3edd01c723ff456384cea9bd3c9b19e7.jpg\", \"https://www.youlai.tech/files/default/a6681c18fc294ee49efb8e121b8e943f.jpg\", \"https://www.youlai.tech/files/default/97458ae9ea734bc498724660abb1c6cd.jpg\", \"https://www.youlai.tech/files/default/501b0e6dcb3f4d69b7e40e90b3d3ac32.jpg\"]', NULL, '中国台湾华硕电脑股份有限公司 [1] 是当前全球第一大主板生产商、全球第三大显卡生产商同时也是全球领先的3C解决方案提供商之一致力于为个人和企业用户提供最具创新价值的产品及应用方案。华硕的产品线完整覆盖至笔记本电脑、主板、显卡、服务器、光存储、有线/无线网络通讯产品、LCD、掌上电脑、智能手机等全线3C产品。其中显卡和主板以及笔记本电脑三大产品已经成为华硕的主要竞争实力。', '<p><img src=\"http://a.youlai.tech:9000/default/5e4fb81b04244a74aacaabb4685101e2.png\" alt=\"\" data-href=\"\" style=\"\"/><img src=\"http://a.youlai.tech:9000/default/0744c5b6d77b47b294eb111ee992c62b.png\" alt=\"\" data-href=\"\" style=\"\"/></p>', 1, '2022-03-11 14:39:21', '2022-07-08 00:29:56');
INSERT INTO `pms_spu` VALUES (3, '惠普战X ', 99, 33, 639900, 629900, 0, 'https://oss.youlai.tech/default/e59859e0effb4b66a0f7380ff5369d66.jpg', '[\"https://oss.youlai.tech/default/de9c5625e35b4c0aa9888c48d4def446.jpg\"]', NULL, '【2022新款】HP/惠普战X 16英寸锐龙新款6000系列R5六核/R7八核高性能学生家用轻薄办公商用笔记本电脑\n六核/八核处理器,高性能集成显卡', '<p><img src=\"https://oss.youlai.tech/default/d645a6f642794e2183cc44d340613b9d.jpg\" alt=\"\" data-href=\"\" style=\"\"/></p>', 1, '2022-07-07 00:22:13', '2022-07-08 00:29:41');
INSERT INTO `pms_spu` VALUES (4, '小米13', 5, 10, 599900, 599900, 1, 'https://oss.youlai.tech/youlai-boot/2023/06/08/6b83dd33eaa248ed8e11cff0003287ee.jpg', '[\"https://oss.youlai.tech/youlai-boot/2023/06/08/6b83dd33eaa248ed8e11cff0003287ee.jpg\"]', '', '好快,好稳,\n好一次强上加强。\n高通全新一代芯片赋能速度大幅提升。\n三大专业主摄影像加持能力全面进化。\n大师级设计理念新诠释质感简而不凡。\n斩获十五项纪录旗舰屏感官万般出众。', '<p><img src=\"http://a.youlai.tech:9000/default/1a69357664c24962ac23953905c3c38f.png\" alt=\"\" data-href=\"\" style=\"width: 449.00px;height: 449.00px;\"/></p>', 1, NULL, '2022-07-03 14:16:16');
INSERT INTO `pms_spu` VALUES (1, 'Galaxy Z Fold5', 1, 5, 10, 'https://shop-image.samsung.com.cn/productv5/img/2023/07/26/64c0e30fe4b08db29258c50c.png', '', '好快,好稳,\n好一次强上加强。\n高通全新一代芯片赋能速度大幅提升。\n三大专业主摄影像加持能力全面进化。\n大师级设计理念新诠释质感简而不凡。\n斩获十五项纪录旗舰屏感官万般出众。', '<p><img src=\"https://shop-image.samsung.com.cn/productv5/img/2023/11/03/65449d3ee4b08db20823bcbe.jpg\" alt=\"\" data-href=\"\" style=\"width: 449.00px;height: 449.00px;\"/></p>', NULL, '2022-07-03 14:16:16', 0);
INSERT INTO `pms_spu` VALUES (2, '华硕天选3', 1, 101, 11, 'https://www.youlai.tech/files/default/d97457b3fd7d4aef8846da96fe032bf8.jpg', NULL, '中国台湾华硕电脑股份有限公司 [1] 是当前全球第一大主板生产商、全球第三大显卡生产商同时也是全球领先的3C解决方案提供商之一致力于为个人和企业用户提供最具创新价值的产品及应用方案。华硕的产品线完整覆盖至笔记本电脑、主板、显卡、服务器、光存储、有线/无线网络通讯产品、LCD、掌上电脑、智能手机等全线3C产品。其中显卡和主板以及笔记本电脑三大产品已经成为华硕的主要竞争实力。', '<p><img src=\"http://a.youlai.tech:9000/default/5e4fb81b04244a74aacaabb4685101e2.png\" alt=\"\" data-href=\"\" style=\"\"/><img src=\"http://a.youlai.tech:9000/default/0744c5b6d77b47b294eb111ee992c62b.png\" alt=\"\" data-href=\"\" style=\"\"/></p>', '2022-03-11 14:39:21', '2022-07-08 00:29:56', 0);
INSERT INTO `pms_spu` VALUES (3, '惠普战X ', 1, 99, 33, 'https://oss.youlai.tech/default/e59859e0effb4b66a0f7380ff5369d66.jpg', NULL, '【2022新款】HP/惠普战X 16英寸锐龙新款6000系列R5六核/R7八核高性能学生家用轻薄办公商用笔记本电脑\n六核/八核处理器,高性能集成显卡', '<p><img src=\"https://oss.youlai.tech/default/d645a6f642794e2183cc44d340613b9d.jpg\" alt=\"\" data-href=\"\" style=\"\"/></p>', '2022-07-07 00:22:13', '2022-07-08 00:29:41', 0);
INSERT INTO `pms_spu` VALUES (4, '小米13', 1, 5, 10, 'https://oss.youlai.tech/youlai-boot/2023/06/08/6b83dd33eaa248ed8e11cff0003287ee.jpg', '', '好快,好稳,\n好一次强上加强。\n高通全新一代芯片赋能速度大幅提升。\n三大专业主摄影像加持能力全面进化。\n大师级设计理念新诠释质感简而不凡。\n斩获十五项纪录旗舰屏感官万般出众。', '<p><img src=\"http://a.youlai.tech:9000/default/1a69357664c24962ac23953905c3c38f.png\" alt=\"\" data-href=\"\" style=\"width: 449.00px;height: 449.00px;\"/></p>', NULL, '2022-07-03 14:16:16', 0);
-- ----------------------------
-- Table structure for pms_spu_attribute
-- ----------------------------
DROP TABLE IF EXISTS `pms_spu_attribute`;
CREATE TABLE `pms_spu_attribute` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
`spu_id` bigint NOT NULL COMMENT '产品ID',
`attribute_id` bigint NULL DEFAULT NULL COMMENT '属性ID',
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'SPU 属性ID',
`spu_id` bigint NOT NULL COMMENT 'SPU ID',
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '属性名称',
`value` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '属性值',
`type` tinyint NOT NULL COMMENT '类型(1:规格;2:属性;)',
`img_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '规格图片',
`sort` smallint NOT NULL DEFAULT 1 COMMENT '排序',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
`is_deleted` tinyint NOT NULL DEFAULT 0 COMMENT '逻辑删除标识0-未删除1-已删除',
PRIMARY KEY (`id`) USING BTREE,
INDEX `fk_pms_spu_attribute_pms_attr`(`name`) USING BTREE,
INDEX `fk_pms_spu_attribute_pms_spu`(`spu_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 846 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '商品属性/规格表' ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 847 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '商品属性/规格表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of pms_spu_attribute
-- ----------------------------
INSERT INTO `pms_spu_attribute` VALUES (1, 1, 34, '颜色', '', 1, 'https://www.youlai.tech/files/default/c25b39470474494485633c49101a0f5d.png', NULL, '2022-07-03 14:16:16');
INSERT INTO `pms_spu_attribute` VALUES (3, 1, 35, '规格', '6+128g', 1, NULL, NULL, '2022-07-03 14:16:16');
INSERT INTO `pms_spu_attribute` VALUES (4, 1, 35, '规格', '8+256g', 1, NULL, NULL, '2022-07-03 14:16:16');
INSERT INTO `pms_spu_attribute` VALUES (5, 1, 36, '上市时间', '2021-07-17', 2, NULL, NULL, '2022-07-03 14:16:16');
INSERT INTO `pms_spu_attribute` VALUES (216, 1, NULL, '颜色', '', 1, 'https://www.youlai.tech/files/default/835d73a337964b9b97e5c7c90acc8cb2.png', '2022-03-05 09:25:53', '2022-07-03 14:16:16');
INSERT INTO `pms_spu_attribute` VALUES (251, 2, NULL, '上市时间', '2022/3/11', 2, NULL, '2022-03-11 14:39:21', '2022-07-08 00:29:56');
INSERT INTO `pms_spu_attribute` VALUES (252, 2, NULL, '商品名称', '华硕天选3', 2, NULL, '2022-03-11 14:39:21', '2022-07-08 00:29:56');
INSERT INTO `pms_spu_attribute` VALUES (253, 2, NULL, '商品编号', '100032610338', 2, NULL, '2022-03-11 14:39:21', '2022-07-08 00:29:56');
INSERT INTO `pms_spu_attribute` VALUES (254, 2, NULL, '商品毛重', '4.05kg', 2, NULL, '2022-03-11 14:39:21', '2022-07-08 00:29:56');
INSERT INTO `pms_spu_attribute` VALUES (255, 2, NULL, '系统', 'windows11', 2, NULL, '2022-03-11 14:39:21', '2022-07-08 00:29:56');
INSERT INTO `pms_spu_attribute` VALUES (256, 2, NULL, '颜色', '魔幻青', 1, 'http://a.youlai.tech:9000/default/8815c9a46fcc4b1ea952623406750da5.jpg', '2022-03-11 14:39:21', '2022-07-08 00:29:56');
INSERT INTO `pms_spu_attribute` VALUES (257, 2, NULL, '颜色', '日蚀灰', 1, 'http://a.youlai.tech:9000/default/3210cd1ffb6c4346b743a10855d3cb37.jpg', '2022-03-11 14:39:21', '2022-07-08 00:29:56');
INSERT INTO `pms_spu_attribute` VALUES (258, 2, NULL, '规格', 'RTX3060/i7-12700H/165Hz 2.5K屏', 1, NULL, '2022-03-11 14:39:21', '2022-07-08 00:29:56');
INSERT INTO `pms_spu_attribute` VALUES (259, 2, NULL, '规格', 'RTX3050tTi/12代i5/144Hz高色域屏', 1, NULL, '2022-03-11 14:39:21', '2022-07-08 00:29:56');
INSERT INTO `pms_spu_attribute` VALUES (838, 3, NULL, '内存', '16g 32g', 2, NULL, '2022-07-07 00:22:13', '2022-07-08 00:29:41');
INSERT INTO `pms_spu_attribute` VALUES (839, 3, NULL, '重量', '1.5kg(含)-2kg(不含)', 2, NULL, '2022-07-07 00:22:13', '2022-07-08 00:29:41');
INSERT INTO `pms_spu_attribute` VALUES (840, 3, NULL, '显卡类型', '核芯显卡', 2, NULL, '2022-07-07 00:22:13', '2022-07-08 00:29:41');
INSERT INTO `pms_spu_attribute` VALUES (841, 3, NULL, '内存容量', '16g', 1, NULL, '2022-07-07 00:22:13', '2022-07-08 00:29:41');
INSERT INTO `pms_spu_attribute` VALUES (842, 3, NULL, '内存容量', '32g', 1, NULL, '2022-07-07 00:22:13', '2022-07-08 00:29:41');
INSERT INTO `pms_spu_attribute` VALUES (843, 3, NULL, '硬盘容量', '512g', 1, NULL, '2022-07-07 00:22:13', '2022-07-08 00:29:41');
INSERT INTO `pms_spu_attribute` VALUES (844, 3, NULL, '硬盘容量', '1t', 1, NULL, '2022-07-07 00:22:13', '2022-07-08 00:29:41');
INSERT INTO `pms_spu_attribute` VALUES (845, 3, NULL, '套餐类型', '【2022款】锐龙六核R5-6600U/核芯显卡/100%sRGB高色域', 1, NULL, '2022-07-07 00:22:13', '2022-07-08 00:29:41');
INSERT INTO `pms_spu_attribute` VALUES (846, 3, NULL, '套餐类型', '【2022款】锐龙八核R7-6800U/核芯显卡/100%sRGB高色域', 1, NULL, '2022-07-07 00:22:13', '2022-07-08 00:29:41');
INSERT INTO `pms_spu_attribute` VALUES (1, 1, '颜色', '', 1, NULL, '2022-07-03 14:16:16', 0);
INSERT INTO `pms_spu_attribute` VALUES (3, 1, '规格', '6+128g', 1, NULL, '2022-07-03 14:16:16', 0);
INSERT INTO `pms_spu_attribute` VALUES (4, 1, '规格', '8+256g', 1, NULL, '2022-07-03 14:16:16', 0);
INSERT INTO `pms_spu_attribute` VALUES (5, 1, '上市时间', '2021-07-17', 1, NULL, '2022-07-03 14:16:16', 0);
INSERT INTO `pms_spu_attribute` VALUES (216, 1, '颜色', '', 1, '2022-03-05 09:25:53', '2022-07-03 14:16:16', 0);
INSERT INTO `pms_spu_attribute` VALUES (251, 2, '上市时间', '2022/3/11', 1, '2022-03-11 14:39:21', '2022-07-08 00:29:56', 0);
INSERT INTO `pms_spu_attribute` VALUES (252, 2, '商品名称', '华硕天选3', 1, '2022-03-11 14:39:21', '2022-07-08 00:29:56', 0);
INSERT INTO `pms_spu_attribute` VALUES (253, 2, '商品编号', '100032610338', 1, '2022-03-11 14:39:21', '2022-07-08 00:29:56', 0);
INSERT INTO `pms_spu_attribute` VALUES (254, 2, '商品毛重', '4.05kg', 1, '2022-03-11 14:39:21', '2022-07-08 00:29:56', 0);
INSERT INTO `pms_spu_attribute` VALUES (255, 2, '系统', 'windows11', 1, '2022-03-11 14:39:21', '2022-07-08 00:29:56', 0);
INSERT INTO `pms_spu_attribute` VALUES (256, 2, '颜色', '魔幻青', 1, '2022-03-11 14:39:21', '2022-07-08 00:29:56', 0);
INSERT INTO `pms_spu_attribute` VALUES (257, 2, '颜色', '日蚀灰', 1, '2022-03-11 14:39:21', '2022-07-08 00:29:56', 0);
INSERT INTO `pms_spu_attribute` VALUES (258, 2, '规格', 'RTX3060/i7-12700H/165Hz 2.5K屏', 1, '2022-03-11 14:39:21', '2022-07-08 00:29:56', 0);
INSERT INTO `pms_spu_attribute` VALUES (259, 2, '规格', 'RTX3050tTi/12代i5/144Hz高色域屏', 1, '2022-03-11 14:39:21', '2022-07-08 00:29:56', 0);
INSERT INTO `pms_spu_attribute` VALUES (838, 3, '内存', '16g 32g', 1, '2022-07-07 00:22:13', '2022-07-08 00:29:41', 0);
INSERT INTO `pms_spu_attribute` VALUES (839, 3, '重量', '1.5kg(含)-2kg(不含)', 1, '2022-07-07 00:22:13', '2022-07-08 00:29:41', 0);
INSERT INTO `pms_spu_attribute` VALUES (840, 3, '显卡类型', '核芯显卡', 1, '2022-07-07 00:22:13', '2022-07-08 00:29:41', 0);
INSERT INTO `pms_spu_attribute` VALUES (841, 3, '内存容量', '16g', 1, '2022-07-07 00:22:13', '2022-07-08 00:29:41', 0);
INSERT INTO `pms_spu_attribute` VALUES (842, 3, '内存容量', '32g', 1, '2022-07-07 00:22:13', '2022-07-08 00:29:41', 0);
INSERT INTO `pms_spu_attribute` VALUES (843, 3, '硬盘容量', '512g', 1, '2022-07-07 00:22:13', '2022-07-08 00:29:41', 0);
INSERT INTO `pms_spu_attribute` VALUES (844, 3, '硬盘容量', '1t', 1, '2022-07-07 00:22:13', '2022-07-08 00:29:41', 0);
INSERT INTO `pms_spu_attribute` VALUES (845, 3, '套餐类型', '【2022款】锐龙六核R5-6600U/核芯显卡/100%sRGB高色域', 1, '2022-07-07 00:22:13', '2022-07-08 00:29:41', 0);
INSERT INTO `pms_spu_attribute` VALUES (846, 3, '套餐类型', '【2022款】锐龙八核R7-6800U/核芯显卡/100%sRGB高色域', 1, '2022-07-07 00:22:13', '2022-07-08 00:29:41', 0);
-- ----------------------------
-- Table structure for pms_spu_image
-- ----------------------------
DROP TABLE IF EXISTS `pms_spu_image`;
CREATE TABLE `pms_spu_image` (
`id` bigint NOT NULL AUTO_INCREMENT,
`spu_id` bigint NOT NULL,
`img_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`create_time` datetime NULL DEFAULT NULL,
`update_time` datetime NULL DEFAULT NULL,
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
`spu_id` bigint NOT NULL COMMENT 'SPU ID',
`img_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品图片URL',
`sort` smallint NOT NULL DEFAULT 1 COMMENT '排序',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
`is_deleted` tinyint NOT NULL DEFAULT 0 COMMENT '逻辑删除标识0-未删除1-已删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of pms_spu_image
-- ----------------------------
-- ----------------------------
-- Table structure for pms_spu_spec
-- ----------------------------
DROP TABLE IF EXISTS `pms_spu_spec`;
CREATE TABLE `pms_spu_spec` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '规格 ID',
`spu_id` bigint NULL DEFAULT NULL COMMENT 'SPU ID',
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规格名称(如:颜色、尺寸)',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of pms_spu_spec
-- ----------------------------
-- ----------------------------
-- Table structure for pms_spu_spec_value
-- ----------------------------
DROP TABLE IF EXISTS `pms_spu_spec_value`;
CREATE TABLE `pms_spu_spec_value` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '规格值ID',
`spec_id` bigint NOT NULL COMMENT '规格ID',
`value` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '规格值(如:蓝色、白色)',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of pms_spu_spec_value
-- ----------------------------
-- ----------------------------
-- Table structure for undo_log
-- ----------------------------

View File

@ -3,7 +3,7 @@ package com.youlai.mall.pms.controller.admin;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.youlai.common.result.PageResult;
import com.youlai.common.result.Result;
import com.youlai.mall.pms.model.form.PmsSpuForm;
import com.youlai.mall.pms.model.form.SpuForm;
import com.youlai.mall.pms.model.query.SpuPageQuery;
import com.youlai.mall.pms.model.vo.PmsSpuDetailVO;
import com.youlai.mall.pms.model.vo.PmsSpuPageVO;
@ -12,6 +12,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
@ -42,10 +43,10 @@ public class SpuController {
return Result.success(pmsSpuDetailVO);
}
@Operation(summary = "新增商品")
@Operation(summary = "保存商品")
@PostMapping
public Result addSpu(@RequestBody PmsSpuForm formData) {
boolean result = spuService.addSpu(formData);
public Result saveSpu(@Validated @RequestBody SpuForm formData) {
boolean result = spuService.saveSpu(formData);
return Result.judge(result);
}
@ -53,7 +54,7 @@ public class SpuController {
@PutMapping(value = "/{id}")
public Result updateSpuById(
@Parameter(name = "商品ID") @PathVariable Long id,
@RequestBody PmsSpuForm formData
@RequestBody SpuForm formData
) {
boolean result = spuService.updateSpuById(id, formData);
return Result.judge(result);

View File

@ -4,18 +4,17 @@ import org.mapstruct.InheritInverseConfiguration;
import org.mapstruct.Mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.youlai.mall.pms.model.dto.SpecDTO;
import com.youlai.mall.pms.model.entity.Spec;
import com.youlai.mall.pms.model.vo.SpecPageVO;
import com.youlai.mall.pms.model.form.SpecForm;
import com.youlai.mall.pms.model.bo.SpecBO;
import com.youlai.mall.pms.model.bo.SpuSpecBO;
@Mapper(componentModel = "spring")
public interface SpecConverter{
SpecPageVO bo2PageVo(SpecBO bo);
SpecPageVO bo2PageVo(SpuSpecBO bo);
Page<SpecPageVO> bo2PageVo(Page<SpecBO> bo);
Page<SpecPageVO> bo2PageVo(Page<SpuSpecBO> bo);
SpecForm entity2Form(Spec entity);

View File

@ -7,14 +7,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.youlai.mall.pms.model.entity.SpecValue;
import com.youlai.mall.pms.model.vo.SpecValuePageVO;
import com.youlai.mall.pms.model.form.SpecValueForm;
import com.youlai.mall.pms.model.bo.SpecValueBO;
import com.youlai.mall.pms.model.bo.SpuSpecValueBO;
@Mapper(componentModel = "spring")
public interface SpecValueConverter{
SpecValuePageVO bo2PageVo(SpecValueBO bo);
SpecValuePageVO bo2PageVo(SpuSpecValueBO bo);
Page<SpecValuePageVO> bo2PageVo(Page<SpecValueBO> bo);
Page<SpecValuePageVO> bo2PageVo(Page<SpuSpecValueBO> bo);
SpecValueForm entity2Form(SpecValue entity);

View File

@ -2,15 +2,18 @@ package com.youlai.mall.pms.converter;
import com.youlai.mall.pms.model.entity.SpuAttribute;
import com.youlai.mall.pms.model.form.PmsSpuAttributeForm;
import com.youlai.mall.pms.model.form.SpuForm;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import java.util.List;
/**
* 商品属性对象转换器
*
* @author haoxr
* @date 2022/6/11
* @since 2022/6/11
*/
@Mapper(componentModel = "spring")
public interface SpuAttributeConverter {
@ -20,4 +23,7 @@ public interface SpuAttributeConverter {
})
SpuAttribute form2Entity(PmsSpuAttributeForm form);
SpuAttribute formAttribute2Entity(SpuForm.SpuAttribute formAttribute);
List<SpuAttribute> formAttribute2Entity(List<SpuForm.SpuAttribute> formAttribute);
}

View File

@ -1,31 +1,26 @@
package com.youlai.mall.pms.converter;
import com.youlai.mall.pms.model.entity.Spu;
import com.youlai.mall.pms.model.form.PmsSpuForm;
import com.youlai.mall.pms.model.form.SpuForm;
import com.youlai.mall.pms.model.vo.SeckillingSpuVO;
import org.mapstruct.InheritInverseConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import java.util.List;
/**
* 商品对象转换器
*
* @author haoxr
* @date 2022/6/11
* @author Ray Hao
* @since 2024/4/24
*/
@Mapper(componentModel = "spring")
public interface SpuConverter {
@Mappings({
@Mapping(target = "album", source = "subImgUrls")
})
Spu form2Entity(PmsSpuForm form);
Spu form2Entity(SpuForm form);
@InheritInverseConfiguration(name="form2Entity")
PmsSpuForm entity2Form(Spu entity);
SpuForm entity2Form(Spu entity);
SeckillingSpuVO entity2SeckillingVO(Spu entity);

View File

@ -1,5 +1,6 @@
package com.youlai.mall.pms.converter;
import com.youlai.mall.pms.model.form.SpuForm;
import org.mapstruct.InheritInverseConfiguration;
import org.mapstruct.Mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -10,6 +11,8 @@ import com.youlai.mall.pms.model.vo.SpuImagePageVO;
import com.youlai.mall.pms.model.form.SpuImageForm;
import com.youlai.mall.pms.model.bo.SpuImageBO;
import java.util.List;
@Mapper(componentModel = "spring")
public interface SpuImageConverter{
@ -21,4 +24,9 @@ public interface SpuImageConverter{
@InheritInverseConfiguration(name = "entity2Form")
SpuImage form2Entity(SpuImageForm entity);
SpuImage formImage2Entity(SpuForm.SpuImage formImages);
List<SpuImage> formImage2Entity(List<SpuForm.SpuImage> formImages);
}

View File

@ -3,7 +3,7 @@ package com.youlai.mall.pms.mapper;
import com.youlai.mall.pms.model.entity.Spec;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.youlai.mall.pms.model.bo.SpecBO;
import com.youlai.mall.pms.model.bo.SpuSpecBO;
import com.youlai.mall.pms.model.query.SpecPageQuery;
import org.apache.ibatis.annotations.Mapper;
@ -15,7 +15,7 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface SpecMapper extends BaseMapper<Spec> {
public interface SpuSpecMapper extends BaseMapper<Spec> {
/**
* 获取用户分页列表
@ -24,6 +24,6 @@ public interface SpecMapper extends BaseMapper<Spec> {
* @param queryParams 查询参数
* @return
*/
Page<SpecBO> listPagedSpecs(Page<SpecBO> page, SpecPageQuery queryParams);
Page<SpuSpecBO> listPagedSpecs(Page<SpuSpecBO> page, SpecPageQuery queryParams);
}

View File

@ -3,7 +3,7 @@ package com.youlai.mall.pms.mapper;
import com.youlai.mall.pms.model.entity.SpecValue;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.youlai.mall.pms.model.bo.SpecValueBO;
import com.youlai.mall.pms.model.bo.SpuSpecValueBO;
import com.youlai.mall.pms.model.query.SpecValuePageQuery;
import org.apache.ibatis.annotations.Mapper;
@ -15,7 +15,7 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface SpecValueMapper extends BaseMapper<SpecValue> {
public interface SpuSpecValueMapper extends BaseMapper<SpecValue> {
/**
* 获取用户分页列表
@ -24,6 +24,6 @@ public interface SpecValueMapper extends BaseMapper<SpecValue> {
* @param queryParams 查询参数
* @return
*/
Page<SpecValueBO> listPagedSpecValues(Page<SpecValueBO> page, SpecValuePageQuery queryParams);
Page<SpuSpecValueBO> listPagedSpecValues(Page<SpuSpecValueBO> page, SpecValuePageQuery queryParams);
}

View File

@ -2,11 +2,10 @@ package com.youlai.mall.pms.model.bo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
/**
*
@ -16,7 +15,7 @@ import java.time.LocalDateTime;
*/
@Getter
@Setter
public class SpecBO implements Serializable {
public class SpuSpecBO implements Serializable {
private static final long serialVersionUID = 1L;

View File

@ -2,11 +2,10 @@ package com.youlai.mall.pms.model.bo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
/**
*
@ -16,7 +15,7 @@ import java.time.LocalDateTime;
*/
@Getter
@Setter
public class SpecValueBO implements Serializable {
public class SpuSpecValueBO implements Serializable {
private static final long serialVersionUID = 1L;

View File

@ -4,7 +4,7 @@ package com.youlai.mall.pms.model.dto;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* DTO
*
@ -13,7 +13,7 @@ import java.time.LocalDateTime;
*/
@Getter
@Setter
public class SpecDTO implements Serializable {
public class SpuSpecDTO implements Serializable {
private static final long serialVersionUID = 1L;

View File

@ -4,7 +4,7 @@ package com.youlai.mall.pms.model.dto;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* DTO
*
@ -13,7 +13,7 @@ import java.time.LocalDateTime;
*/
@Getter
@Setter
public class SpecValueDTO implements Serializable {
public class SpuSpecValueDTO implements Serializable {
private static final long serialVersionUID = 1L;

View File

@ -36,11 +36,4 @@ public class Attribute extends BaseEntity {
* 逗号分割的可选值列表仅当input_type是2使用
*/
private String options;
/**
* 逻辑删除标识(0-未删除1-已删除)
*/
private Integer isDeleted;
;
}

View File

@ -24,7 +24,7 @@ public class AttributeGroup extends BaseEntity {
/**
* 排序
*/
private Short sort;
private Integer sort;
/**
* 备注
@ -32,8 +32,5 @@ public class AttributeGroup extends BaseEntity {
private String remark;
/**
* 逻辑删除标识(0-未删除1-已删除)
*/
private Integer isDeleted;;
}

View File

@ -5,13 +5,28 @@ import com.youlai.common.base.BaseEntity;
import lombok.Data;
/**
* 品牌实体
*
* @author Ray Hao
* @since 2024-04-19
*/
@TableName("pms_brand")
@Data
public class Brand extends BaseEntity {
/**
* 品牌的名称
*/
private String name;
/**
* 品牌的LOGO图片的URL地址
*/
private String logoUrl;
/**
* 用于展示在列表中的排序权重数值越小排序越靠前
*/
private Integer sort;
}

View File

@ -36,23 +36,9 @@ public class Category extends BaseEntity {
*/
private Integer sort;
/**
* 分类是否可见
*/
private Integer visible;
/**
* 创建人ID
*/
private Long createBy;
/**
* 更新人ID
*/
private Long updateBy;
/**
* 逻辑删除标识(0-未删除1-已删除)
*/
private Integer isDeleted;
}

View File

@ -2,55 +2,54 @@ package com.youlai.mall.pms.model.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.youlai.common.base.BaseEntity;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
/**
* 商品库存单元
* Sku 实体类代表商品的一个具体的库存单元
* Sku 通常包含特定的属性组合如颜色尺寸等与Spu相对
* Spu是指商品的标准化信息而Sku是在此基础上的特定属性的实体
*
* @author haoxr
* @since 2022/2/6
* @author Ray Hao
* @since 2024/4/6
*/
@TableName("pms_sku")
@Data
@Getter
@Setter
public class Sku extends BaseEntity {
/**
* 库存单元编号
* 商品的SKU编号唯一标识一个SKU
*/
private String skuSn;
/**
* SKU 名称
* 商品SKU的名称
*/
private String name;
/**
* SPU ID
* 与该SKU相关联的SPU的ID
*/
private Long spuId;
/**
* 规格ID多个使用英文逗号(,)分割
*/
private String specIds;
/**
* 商品价格(单位)
* 商品SKU的价格单位
*/
private Long price;
/**
* 库存数量
* 商品SKU的库存数量
*/
private Integer stock;
/**
* 锁定库存数量
* 锁定库存数量
*/
private Integer lockedStock;
/**
* SKU 展示图片 URL
* 商品SKU的图片URL地址
*/
private String imgUrl;
}
}

View File

@ -15,7 +15,7 @@ import lombok.Setter;
*/
@Getter
@Setter
@TableName("pms_spec")
@TableName("pms_spu_spec")
public class Spec implements Serializable {
private static final long serialVersionUID = 1L;

View File

@ -1,11 +1,9 @@
package com.youlai.mall.pms.model.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.youlai.common.base.BaseEntity;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
/**
* SPU 实体类
@ -14,40 +12,48 @@ import java.util.List;
* @since 2022/7/2
*/
@TableName("pms_spu")
@Data
@Accessors(chain = true)
@Getter
@Setter
public class Spu extends BaseEntity {
/**
* 商品名称
*/
private String name;
/**
* 商品类别ID
*/
private Long categoryId;
/**
* 品牌ID
*/
private Long brandId;
private Long originPrice;
private Long price;
private Integer sales;
private String imgUrl;
private String[] album;
/**
* 主图URL
*/
private String mainImgUrl;
/**
* 计量单位
*/
private String unit;
/**
* 商品简短描述
*/
private String description;
/**
* 商品详细描述
*/
private String detail;
/**
* 商品状态1-上架0-下架
*/
private Integer status;
@TableField(exist = false)
private String categoryName;
@TableField(exist = false)
private String brandName;
@TableField(exist = false)
private List<Sku> skuList;
}

View File

@ -2,26 +2,31 @@ package com.youlai.mall.pms.model.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.youlai.common.base.BaseEntity;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
/**
* 商品属性
* <p>
* <strong>更新记录</strong>
* <ul>
* <li>2024/4/24 - Ray Hao 修改了商品属性表结构规格从属性表拆分出来</li>
* </ul>
* </p>
*
* @author haoxr
* @since 2020/11/06
*/
@TableName("pms_spu_attribute")
@Data
@Getter
@Setter
public class SpuAttribute extends BaseEntity {
/**
* 商品ID
*/
private Long spuId;
/**
* 属性ID
*/
private Long attributeId;
/**
* 属性名称
*/
@ -31,14 +36,10 @@ public class SpuAttribute extends BaseEntity {
* 属性值
*/
private String value;
/**
* 属性类型(1:规格;2:属性;)
*/
private Integer type;
/**
* 规格图片地址
* 排序
*/
private String imgUrl;
private Integer sort;
}

View File

@ -1,12 +1,13 @@
package com.youlai.mall.pms.model.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import com.youlai.common.base.BaseEntity;
import lombok.Getter;
import lombok.Setter;
/**
* 商品图片
* 商品图片实体
*
* @author Ray Hao
* @since 2024-04-14
@ -14,11 +15,20 @@ import lombok.Setter;
@Getter
@Setter
@TableName("pms_spu_image")
public class SpuImage implements Serializable {
private static final long serialVersionUID = 1L;
public class SpuImage extends BaseEntity {
/**
* 商品ID
*/
private Long spuId;
/**
* 图片地址
*/
private String imgUrl;
/**
* 排序
*/
private Integer sort;
}

View File

@ -1,32 +0,0 @@
package com.youlai.mall.pms.model.form;
import com.youlai.mall.pms.model.entity.Sku;
import lombok.Data;
import java.util.List;
/**
* 商品SPU表单对象
*
* @author haoxr
* @since 2022/7/2
*/
@Data
public class PmsSpuForm {
private Long id;
private String name;
private Long categoryId;
private Long brandId;
private Long originPrice;
private Long price;
private String imgUrl;
private String[] subImgUrls;
private String description;
private String detail;
private List<PmsSpuAttributeForm> attrList;
private List<PmsSpuAttributeForm> specList;
private List<Sku> skuList;
}

View File

@ -0,0 +1,121 @@
package com.youlai.mall.pms.model.form;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import java.util.List;
/**
* 商品SPU表单对象
*
* @author Ray Hao
* @since 2024/4/23
*/
@Schema(description = "商品SPU表单对象")
@Data
public class SpuForm {
@Schema(description = "商品ID")
private Long id;
@Schema(description = "商品名称")
@NotBlank(message = "商品名称不能为空")
private String name;
@Schema(description = "分类ID")
private Long categoryId;
@Schema(description = "品牌ID")
private Long brandId;
@Schema(description = "状态1-在售0-下架")
private Integer status;
@Schema(description = "商品主图URL")
private String imgUrl;
@Schema(description = "商品图册(详情页轮播图)")
private List<SpuImage> galleryImages;
@Schema(description = "商品描述")
private String description;
@Schema(description = "商品详情")
private String detail;
@Schema(description = "商品属性列表")
private List<SpuAttribute> attrList;
@Schema(description = "商品规格列表")
private List<SpuSpec> specList;
@Schema(description = "SKU列表")
private List<Sku> skuList;
@Schema(description = "商品图片")
@Data
public static class SpuImage {
@Schema(description = "图片ID")
private Long id;
@Schema(description = "图片地址")
private String imgUrl;
@Schema(description = "排序")
private Integer sort;
}
@Schema(description = "商品属性")
@Data
public static class SpuAttribute {
@Schema(description = "属性ID")
private Long id;
@Schema(description = "属性名称")
private String name;
@Schema(description = "属性值")
private String value;
@Schema(description = "排序")
private Integer sort;
}
@Schema(description = "商品规格")
@Data
public static class SpuSpec {
@Schema(description = "规格ID")
private Long id;
@Schema(description = "规格名称(如:颜色)")
private String name;
@Schema(description = "规格值列表(如:黑色、白色)")
private List<String> values;
}
@Schema(description = "SKU")
@Data
public static class Sku {
@Schema(description = "SKU ID")
private Long id;
@Schema(description = "SKU 名称")
private String name;
@Schema(description = "价格(单位:分)")
private Long price;
@Schema(description = "库存")
private Integer stock;
}
}

View File

@ -1,7 +1,8 @@
package com.youlai.mall.pms.model.form;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
@ -15,11 +16,18 @@ import lombok.Setter;
@Setter
public class SpuImageForm implements Serializable {
/**
* 序列化版本号版本号不一致会导致反序列化失败
* 如果对象结构发生变化建议修改此版本号
*/
private static final long serialVersionUID = 1L;
@Schema(description = "商品ID")
private Long spuId;
private Long spuId;
@Schema(description = "图片地址")
private String imgUrl;
private String imgUrl;
@Schema(description = "排序")
private Integer sort;
}

View File

@ -2,9 +2,24 @@ package com.youlai.mall.pms.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.youlai.mall.pms.model.entity.SpuAttribute;
import com.youlai.mall.pms.model.form.SpuForm;
import java.util.List;
/**
* 商品属性 接口层
*
* @author Ray Hao
* @since 2024/04/24
*/
public interface SpuAttributeService extends IService<SpuAttribute> {
/**
* 保存商品属性
*
* @param spuId SPU ID
* @param attributeList 属性列表
*/
void saveSpuAttributes(Long spuId, List<SpuForm.SpuAttribute> attributeList);
}

View File

@ -1,61 +1,25 @@
package com.youlai.mall.pms.service;
import com.youlai.mall.pms.model.entity.SpuImage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.youlai.mall.pms.model.form.SpuImageForm;
import com.youlai.mall.pms.model.query.SpuImagePageQuery;
import com.youlai.mall.pms.model.vo.SpuImagePageVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.youlai.mall.pms.model.entity.SpuImage;
import com.youlai.mall.pms.model.form.SpuForm;
import java.util.List;
/**
* 商品图片 服务类
* 商品图片接口
*
* @author Ray Hao
* @since 2024-04-14
*/
public interface SpuImageService extends IService<SpuImage> {
/**
*商品图片分页列表
* 保存商品图片
*
* @param spuId 商品ID
* @param galleryImages 商品图册
* @return
*/
IPage<SpuImagePageVO> listPagedSpuImages(SpuImagePageQuery queryParams);
/**
* 获取商品图片表单数据
*
* @param id 商品图片ID
* @return
*/
SpuImageForm getSpuImageFormData(Long id);
/**
* 新增商品图片
*
* @param formData 商品图片表单对象
* @return
*/
boolean saveSpuImage(SpuImageForm formData);
/**
* 修改商品图片
*
* @param id 商品图片ID
* @param formData 商品图片表单对象
* @return
*/
boolean updateSpuImage(Long id, SpuImageForm formData);
/**
* 删除商品图片
*
* @param idsStr 商品图片ID多个以英文逗号(,)分割
* @return
*/
boolean deleteSpuImages(String idsStr);
void saveSpuImages(Long spuId, List<SpuForm.SpuImage> galleryImages);
}

View File

@ -3,7 +3,7 @@ package com.youlai.mall.pms.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.youlai.mall.pms.model.entity.Spu;
import com.youlai.mall.pms.model.form.PmsSpuForm;
import com.youlai.mall.pms.model.form.SpuForm;
import com.youlai.mall.pms.model.query.SpuPageQuery;
import com.youlai.mall.pms.model.vo.*;
@ -55,10 +55,10 @@ public interface SpuService extends IService<Spu> {
/**
* 新增商品
*
* @param formData
* @param formData 商品表单
* @return
*/
boolean addSpu(PmsSpuForm formData);
boolean saveSpu(SpuForm formData);
/**
* 修改商品
@ -67,7 +67,7 @@ public interface SpuService extends IService<Spu> {
* @param formData
* @return
*/
boolean updateSpuById(Long spuId, PmsSpuForm formData);
boolean updateSpuById(Long spuId, SpuForm formData);
/**
* 删除商品

View File

@ -3,20 +3,24 @@ package com.youlai.mall.pms.service;
import com.youlai.mall.pms.model.entity.Spec;
import com.baomidou.mybatisplus.extension.service.IService;
import com.youlai.mall.pms.model.form.SpecForm;
import com.youlai.mall.pms.model.form.SpuForm;
import com.youlai.mall.pms.model.query.SpecPageQuery;
import com.youlai.mall.pms.model.vo.SpecPageVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
* 服务类
* 服务类
*
* @author Ray Hao
* @since 2024-04-14
*/
public interface SpecService extends IService<Spec> {
public interface SpuSpecService extends IService<Spec> {
/**
*分页列表
* 分页列表
*
* @return
*/
@ -29,7 +33,7 @@ public interface SpecService extends IService<Spec> {
* @param id ID
* @return
*/
SpecForm getSpecFormData(Long id);
SpecForm getSpecFormData(Long id);
/**
@ -43,7 +47,7 @@ public interface SpecService extends IService<Spec> {
/**
* 修改
*
* @param id ID
* @param id ID
* @param formData 表单对象
* @return
*/
@ -58,4 +62,12 @@ public interface SpecService extends IService<Spec> {
*/
boolean deleteSpecs(String idsStr);
/**
* 保存SPU规格
*
* @param spuId SPU ID
* @param specList 规格列表
*/
void saveSpuSpecs(Long spuId, List<SpuForm.SpuSpec> specList);
}

View File

@ -12,7 +12,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
* @author Ray Hao
* @since 2024-04-14
*/
public interface SpecValueService extends IService<SpecValue> {
public interface SpuSpecValueService extends IService<SpecValue> {
/**

View File

@ -1,13 +1,74 @@
package com.youlai.mall.pms.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.youlai.mall.pms.converter.SpuAttributeConverter;
import com.youlai.mall.pms.mapper.SpuAttributeMapper;
import com.youlai.mall.pms.model.entity.SpuAttribute;
import com.youlai.mall.pms.model.form.SpuForm;
import com.youlai.mall.pms.service.SpuAttributeService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 商品属性 服务实现类
*
* @author Ray Hao
* @since 2024/04/24
*/
@Service
@RequiredArgsConstructor
public class SpuAttributeServiceImpl extends ServiceImpl<SpuAttributeMapper, SpuAttribute> implements SpuAttributeService {
private final SpuAttributeConverter spuAttributeConverter;
/**
* 保存商品属性
*
* @param spuId SPU ID
* @param formAttributes 属性列表
*/
@Override
public void saveSpuAttributes(Long spuId, List<SpuForm.SpuAttribute> formAttributes) {
// 如果属性列表为空则删除所有旧属性
if (CollectionUtil.isEmpty(formAttributes)) {
this.remove(new LambdaQueryWrapper<SpuAttribute>().eq(SpuAttribute::getSpuId, spuId));
} else {
// 获取当前数据库中的属性
Map<Long, SpuAttribute> existingAttributes = this.list(new LambdaQueryWrapper<SpuAttribute>().eq(SpuAttribute::getSpuId, spuId))
.stream().collect(Collectors.toMap(SpuAttribute::getId, Function.identity()));
List<SpuAttribute> attributesToSave = new ArrayList<>();
for (int i = 0; i < formAttributes.size(); i++) {
SpuAttribute newAttr = spuAttributeConverter.formAttribute2Entity(formAttributes.get(i));
newAttr.setSort(i + 1);
newAttr.setSpuId(spuId);
// 如果存在旧属性则移除这样existingAttributes中剩下的即为需要删除的属性
if (newAttr.getId() != null) {
existingAttributes.remove(newAttr.getId());
}
attributesToSave.add(newAttr);
}
// 删除不再存在的属性
if (!existingAttributes.isEmpty()) {
this.removeByIds(existingAttributes.keySet());
}
// 保存所有属性
if (!attributesToSave.isEmpty()) {
this.saveOrUpdateBatch(attributesToSave);
}
}
}
}

View File

@ -1,33 +1,26 @@
package com.youlai.mall.pms.service.impl;
import com.youlai.mall.pms.model.entity.SpuImage;
import com.youlai.mall.pms.mapper.SpuImageMapper;
import com.youlai.mall.pms.service.SpuImageService;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.youlai.mall.pms.converter.SpuImageConverter;
import com.youlai.mall.pms.mapper.SpuImageMapper;
import com.youlai.mall.pms.model.entity.SpuImage;
import com.youlai.mall.pms.model.form.SpuForm;
import com.youlai.mall.pms.service.SpuImageService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import com.youlai.common.util.DateUtils;
import com.youlai.mall.pms.model.form.SpuImageForm;
import com.youlai.mall.pms.model.query.SpuImagePageQuery;
import com.youlai.mall.pms.model.bo.SpuImageBO;
import com.youlai.mall.pms.model.vo.SpuImagePageVO;
import com.youlai.mall.pms.converter.SpuImageConverter;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;
/**
* 商品图片服务实现类
*
* @author Ray Hao
* @since 2024-04-14
* @since 2024/04/14
*/
@Service
@RequiredArgsConstructor
@ -35,83 +28,52 @@ public class SpuImageServiceImpl extends ServiceImpl<SpuImageMapper, SpuImage> i
private final SpuImageConverter spuImageConverter;
/**
* 获取商品图片分页列表
*
* @param queryParams 查询参数
* @return {@link IPage<SpuImagePageVO>} 商品图片分页列表
*/
@Override
public IPage<SpuImagePageVO> listPagedSpuImages(SpuImagePageQuery queryParams) {
// 参数构建
int pageNum = queryParams.getPageNum();
int pageSize = queryParams.getPageSize();
Page<SpuImageBO> page = new Page<>(pageNum, pageSize);
// 格式化为数据库日期格式避免日期比较使用格式化函数导致索引失效
DateUtils.toDatabaseFormat(queryParams, "startTime", "endTime");
// 查询数据
Page<SpuImageBO> boPage = this.baseMapper.listPagedSpuImages(page, queryParams);
// 实体转换
return spuImageConverter.bo2PageVo(boPage);
}
/**
* 获取商品图片表单数据
* 保存商品图册
*
* @param id 商品图片ID
* @return
* @param spuId 商品ID
* @param formImages 商品图册
*/
@Override
public SpuImageForm getSpuImageFormData(Long id) {
SpuImage entity = this.getById(id);
return spuImageConverter.entity2Form(entity);
}
/**
* 新增商品图片
*
* @param formData 商品图片表单对象
* @return
*/
@Override
public boolean saveSpuImage(SpuImageForm formData) {
// 实体转换 form->entity
SpuImage entity = spuImageConverter.form2Entity(formData);
return this.save(entity);
}
/**
* 更新商品图片
*
* @param id 商品图片ID
* @param formData 商品图片表单对象
* @return
*/
@Override
public boolean updateSpuImage(Long id,SpuImageForm formData) {
SpuImage entity = spuImageConverter.form2Entity(formData);
return this.updateById(entity);
}
/**
* 删除商品图片
*
* @param idsStr 商品图片ID多个以英文逗号(,)分割
* @return true|false
*/
@Override
public boolean deleteSpuImages(String idsStr) {
Assert.isTrue(StrUtil.isNotBlank(idsStr), "删除的商品图片数据为空");
// 逻辑删除
List<Long> ids = Arrays.stream(idsStr.split(","))
.map(Long::parseLong)
.collect(Collectors.toList());
return this.removeByIds(ids);
}
@Override
public void saveSpuImages(Long spuId, List<SpuForm.SpuImage> formImages) {
// 根据 SPU ID 获取商品图册旧图片
List<SpuImage> oldImages = this.list(new LambdaQueryWrapper<SpuImage>()
.eq(SpuImage::getSpuId, spuId));
// 转换为实体
List<SpuImage> newImages = spuImageConverter.formImage2Entity(formImages);
if (CollectionUtil.isNotEmpty(newImages)) {
// 新增图片处理
List<SpuImage> addImages = newImages.stream()
.filter(item -> item.getId() == null)
.peek(item -> item.setSpuId(spuId))
.toList();
if(CollectionUtil.isNotEmpty(addImages)){
this.saveBatch(addImages);
}
// 构建新图片ID集合以便快速检查
Set<Long> newImageIds = newImages.stream()
.map(SpuImage::getId)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
// 确定需要删除的图片ID集合旧图片ID集合中存在新图片ID集合中不存在
List<Long> removeImageIds = oldImages.stream()
.map(SpuImage::getId)
.filter(id -> !newImageIds.contains(id))
.collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(removeImageIds)) {
this.remove(new LambdaQueryWrapper<SpuImage>()
.eq(SpuImage::getSpuId, spuId)
.in(SpuImage::getId, removeImageIds));
}
}
}
}

View File

@ -19,13 +19,10 @@ import com.youlai.mall.pms.model.entity.SpuAttribute;
import com.youlai.mall.pms.model.entity.Sku;
import com.youlai.mall.pms.model.entity.Spu;
import com.youlai.mall.pms.model.form.PmsSpuAttributeForm;
import com.youlai.mall.pms.model.form.PmsSpuForm;
import com.youlai.mall.pms.model.form.SpuForm;
import com.youlai.mall.pms.model.query.SpuPageQuery;
import com.youlai.mall.pms.model.vo.*;
import com.youlai.mall.pms.service.SkuService;
import com.youlai.mall.pms.service.SpuAttributeService;
import com.youlai.mall.pms.service.SpuService;
import com.youlai.mall.ums.api.MemberFeignClient;
import com.youlai.mall.pms.service.*;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -44,10 +41,11 @@ import java.util.stream.Collectors;
public class SpuServiceImpl extends ServiceImpl<SpuMapper, Spu> implements SpuService {
private final SkuService skuService;
private final SpuSpecService spuSpecService;
private final SpuAttributeService spuAttributeService;
private final MemberFeignClient memberFeignClient;
private final SpuConverter spuConverter;
private final SpuAttributeConverter spuAttributeConverter;
private final SpuImageService spuImageService;
/**
* Admin-商品分页列表
@ -213,13 +211,27 @@ public class SpuServiceImpl extends ServiceImpl<SpuMapper, Spu> implements SpuSe
*/
@Override
@Transactional
public boolean addSpu(PmsSpuForm formData) {
public boolean saveSpu(SpuForm formData) {
Spu entity = spuConverter.form2Entity(formData);
boolean result = this.save(entity);
boolean result = this.saveOrUpdate(entity);
if (result) {
Long spuId = entity.getId();
List<SpuForm.SpuImage> galleryImages = formData.getGalleryImages();
spuImageService.saveSpuImages(spuId, galleryImages);
List<SpuForm.SpuAttribute> attributeList = formData.getAttrList();
spuAttributeService.saveSpuAttributes(spuId, attributeList);
List<SpuForm.SpuSpec> specList = formData.getSpecList();
spuSpecService.saveSpuSpecs(spuId, specList);
List<SpuForm.Sku> skuList = formData.getSkuList();
skuService.saveSkus(spuId, skuList);
// 保存属性
List<PmsSpuAttributeForm> attrList = formData.getAttrList();
this.saveSpuAttrs(spuId, attrList);
@ -245,7 +257,7 @@ public class SpuServiceImpl extends ServiceImpl<SpuMapper, Spu> implements SpuSe
*/
@Transactional
@Override
public boolean updateSpuById(Long spuId, PmsSpuForm formData) {
public boolean updateSpuById(Long spuId, SpuForm formData) {
Spu entity = spuConverter.form2Entity(formData);

View File

@ -1,23 +1,28 @@
package com.youlai.mall.pms.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.youlai.mall.pms.model.entity.Spec;
import com.youlai.mall.pms.mapper.SpecMapper;
import com.youlai.mall.pms.service.SpecService;
import com.youlai.mall.pms.mapper.SpuSpecMapper;
import com.youlai.mall.pms.model.form.SpuForm;
import com.youlai.mall.pms.service.SpuSpecService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import com.youlai.common.util.DateUtils;
import com.youlai.mall.pms.model.form.SpecForm;
import com.youlai.mall.pms.model.query.SpecPageQuery;
import com.youlai.mall.pms.model.bo.SpecBO;
import com.youlai.mall.pms.model.bo.SpuSpecBO;
import com.youlai.mall.pms.model.vo.SpecPageVO;
import com.youlai.mall.pms.converter.SpecConverter;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import cn.hutool.core.lang.Assert;
@ -31,7 +36,7 @@ import cn.hutool.core.util.StrUtil;
*/
@Service
@RequiredArgsConstructor
public class SpecServiceImpl extends ServiceImpl<SpecMapper, Spec> implements SpecService {
public class SpuSpecServiceImpl extends ServiceImpl<SpuSpecMapper, Spec> implements SpuSpecService {
private final SpecConverter specConverter;
@ -47,13 +52,13 @@ public class SpecServiceImpl extends ServiceImpl<SpecMapper, Spec> implements Sp
// 参数构建
int pageNum = queryParams.getPageNum();
int pageSize = queryParams.getPageSize();
Page<SpecBO> page = new Page<>(pageNum, pageSize);
Page<SpuSpecBO> page = new Page<>(pageNum, pageSize);
// 格式化为数据库日期格式避免日期比较使用格式化函数导致索引失效
DateUtils.toDatabaseFormat(queryParams, "startTime", "endTime");
// 查询数据
Page<SpecBO> boPage = this.baseMapper.listPagedSpecs(page, queryParams);
Page<SpuSpecBO> boPage = this.baseMapper.listPagedSpecs(page, queryParams);
// 实体转换
return specConverter.bo2PageVo(boPage);
@ -112,6 +117,37 @@ public class SpecServiceImpl extends ServiceImpl<SpecMapper, Spec> implements Sp
.collect(Collectors.toList());
return this.removeByIds(ids);
}
@Override
public void saveSpuSpecs(Long spuId, List<SpuForm.SpuSpec> specList) {
// 如果规格列表为空则删除所有旧规格
if (specList == null || specList.isEmpty()) {
this.remove(new LambdaQueryWrapper<Spec>().eq(Spec::getSpuId, spuId));
} else {
// 获取当前数据库中的规格
Map<Long, Spec> existingSpecs = this.list(new LambdaQueryWrapper<Spec>().eq(Spec::getSpuId, spuId))
.stream().collect(Collectors.toMap(Spec::getId, Function.identity()));
List<Spec> specsToSave = new ArrayList<>();
for (int i = 0; i < specList.size(); i++) {
Spec newSpec = specConverter.formSpec2Entity(specList.get(i));
newSpec.setSort(i + 1);
newSpec.setSpuId(spuId);
// 如果存在旧规格则移除这样existingSpecs中剩下的即为需要删除的规格
if (newSpec.getId() != null) {
existingSpecs.remove(newSpec.getId());
}
specsToSave.add(newSpec);
}
// 删除不再存在的规格
if (!existingSpecs.isEmpty()) {
this.removeByIds(existingSpecs.keySet());
}
}
}
}

View File

@ -1,15 +1,15 @@
package com.youlai.mall.pms.service.impl;
import com.youlai.mall.pms.model.entity.SpecValue;
import com.youlai.mall.pms.mapper.SpecValueMapper;
import com.youlai.mall.pms.service.SpecValueService;
import com.youlai.mall.pms.mapper.SpuSpecValueMapper;
import com.youlai.mall.pms.service.SpuSpecValueService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import com.youlai.common.util.DateUtils;
import com.youlai.mall.pms.model.form.SpecValueForm;
import com.youlai.mall.pms.model.query.SpecValuePageQuery;
import com.youlai.mall.pms.model.bo.SpecValueBO;
import com.youlai.mall.pms.model.bo.SpuSpecValueBO;
import com.youlai.mall.pms.model.vo.SpecValuePageVO;
import com.youlai.mall.pms.converter.SpecValueConverter;
@ -31,7 +31,7 @@ import cn.hutool.core.util.StrUtil;
*/
@Service
@RequiredArgsConstructor
public class SpecValueServiceImpl extends ServiceImpl<SpecValueMapper, SpecValue> implements SpecValueService {
public class SpuSpecValueServiceImpl extends ServiceImpl<SpuSpecValueMapper, SpecValue> implements SpuSpecValueService {
private final SpecValueConverter specValueConverter;
@ -47,13 +47,13 @@ public class SpecValueServiceImpl extends ServiceImpl<SpecValueMapper, SpecValue
// 参数构建
int pageNum = queryParams.getPageNum();
int pageSize = queryParams.getPageSize();
Page<SpecValueBO> page = new Page<>(pageNum, pageSize);
Page<SpuSpecValueBO> page = new Page<>(pageNum, pageSize);
// 格式化为数据库日期格式避免日期比较使用格式化函数导致索引失效
DateUtils.toDatabaseFormat(queryParams, "startTime", "endTime");
// 查询数据
Page<SpecValueBO> boPage = this.baseMapper.listPagedSpecValues(page, queryParams);
Page<SpuSpecValueBO> boPage = this.baseMapper.listPagedSpecValues(page, queryParams);
// 实体转换
return specValueConverter.bo2PageVo(boPage);

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.youlai.mall.pms.mapper.SpecMapper">
<mapper namespace="com.youlai.mall.pms.mapper.SpuSpecMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.youlai.mall.pms.model.entity.Spec">
@ -16,7 +16,7 @@
<!-- 分页列表 -->
<select id="listPagedSpecs" resultType="com.youlai.mall.pms.model.bo.SpecBO">
<select id="listPagedSpecs" resultType="com.youlai.mall.pms.model.bo.SpuSpecBO">
SELECT
${Base_Column_List}
FROM

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.youlai.mall.pms.mapper.SpecValueMapper">
<mapper namespace="com.youlai.mall.pms.mapper.SpuSpecValueMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.youlai.mall.pms.model.entity.SpecValue">
@ -16,7 +16,7 @@
<!-- 分页列表 -->
<select id="listPagedSpecValues" resultType="com.youlai.mall.pms.model.bo.SpecValueBO">
<select id="listPagedSpecValues" resultType="com.youlai.mall.pms.model.bo.SpuSpecValueBO">
SELECT
${Base_Column_List}
FROM

View File

@ -1,9 +1,6 @@
package com.youlai.common.base;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.io.Serial;
@ -24,13 +21,28 @@ public class BaseEntity implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键ID
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
/**
* 逻辑删除标识(0-未删除1-已删除)
*/
@TableLogic(value = "0", delval = "1")
private Integer isDeleted;;
}