我在用Springboot构建商城网站后台,请帮我写出商品下单部分Service层代码,只需要写出核心代码即可,不用输出完整代码。 不要用@Autowired(使用@Resource代替) CREATE TABLE `goods` ( `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, `goods_name` varchar(127) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商品名称', `category_id` int(11) NULL DEFAULT 0 COMMENT '商品所属类目ID', `brand` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '0' COMMENT '商品品牌', `gallery` varchar(1023) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '[]' COMMENT '商品宣传图片列表,采用JSON数组格式', `brief` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '商品简介', `is_on_sale` tinyint(1) NULL DEFAULT 1 COMMENT '是否上架 0为下架 1为上架', `sort_order` smallint(4) NULL DEFAULT 100 COMMENT '排序', `pic_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '商品页面商品图片', `type` tinyint(1) NULL DEFAULT 0 COMMENT '商品类型', `unit` varchar(31) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '件' COMMENT '商品单位,例如件、盒', `counter_price` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '专柜价格(原价 / 划线价)', `retail_price` decimal(10, 2) NULL DEFAULT 100000.00 COMMENT '零售价格(售价 / 未划线价)', `detail` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '商品详细介绍,是富文本格式', `deleted` tinyint(1) NULL DEFAULT 0 COMMENT '逻辑删除 0为正常 1为删除', PRIMARY KEY (`id`) USING BTREE, INDEX `category_id`(`category_id`) USING BTREE, INDEX `brand_id`(`brand`) USING BTREE, INDEX `sort_order`(`sort_order`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 23 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '商品基本信息表' ROW_FORMAT = Dynamic; CREATE TABLE `goods_category` ( `id` bigint(11) NOT NULL AUTO_INCREMENT, `category_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '商品分类名', `order` int(11) NULL DEFAULT NULL COMMENT '排序', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic; CREATE TABLE `orders` ( `order_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '订单ID', `user_id` int(11) NOT NULL COMMENT '用户ID', `order_date` date NOT NULL COMMENT '订单日期', `order_status` enum('Pending','Processing','Shipped','Delivered','Cancelled') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '订单状态', PRIMARY KEY (`order_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic; CREATE TABLE `goods_order_details` ( `order_detail_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '订单详情ID', `order_id` int(11) NOT NULL COMMENT '订单ID', `product_id` int(11) NOT NULL COMMENT '商品ID', `product_quantity` int(11) NOT NULL COMMENT '商品数量', PRIMARY KEY (`order_detail_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;