利用 Java语言使用 SSM 框架编写完成书城项目后本地部署步骤操作指引 BookStore部署步骤 $ git clone https://gitee.com/xiqingbo/bookstore.git #将远程仓库克隆到本地 打开IDEA编译器依次点击 File - Op
-
$ git clone https://gitee.com/xiqingbo/bookstore.git #将远程仓库克隆到本地
-
打开IDEA编译器依次点击 File - Open
-
找到我们克隆下来的项目
-
选中右上角的“项目结构”按钮
-
在“项目结构”界面,选中 “Facets” 并点击 “+” 添加一个 "Web"
-
选择需要添加的模块
-
选择 “Facets” 后会默认跳转到 “Modules” 选项界面并给出提示,按照提示点击 “Create Artifacts”
-
点击 “Create Artifacts”后会默认跳转到 “Artifacts” 选项界面,可以选择右侧的 “lib” 双击将需要输出的文件放入左侧输出目录中,或根据下方提示 “Fix” 点击 "Add 'lib' to the artifact",效果相同;最后 "Apply" 或直接 "OK" 就可以了
-
配置 Tomcat 服务器运行项目,点击IDEA上方 “Add Configurations” 选项
-
在配置界面找到 "Tomcat Server - Local"模版并选中,根据上方提示点击 “Create configuration”
-
自动创建配置后下方会出现警告,此时需要关联我们之前配置好的 “Artifacts”,点击 "Fix"
-
点击 "Fix" 后会关联到我们已经配置好的 “Artifacts”,最后 "Apply" 或直接 "OK" 就可以了
-
在数据库管理工具中新建数据库名固定为 bookstore,并初始化以下表及数据
/* Navicat Premium Data Transfer Source Server : localhost Source Server Type : MySQL Source Server Version : 50727 Source Host : localhost:3306 Source Schema : bookstore Target Server Type : MySQL Target Server Version : 50727 File Encoding : 65001 Date: 19/05/2022 21:26:58 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for t_book -- ---------------------------- DROP TABLE IF EXISTS `t_book`; CREATE TABLE `t_book` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `author` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `price` decimal(11, 2) NOT NULL, `sales` int(11) NOT NULL, `stock` int(11) NOT NULL, `img_path` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 30 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of t_book -- ---------------------------- INSERT INTO `t_book` VALUES (1, 'java从入门到放弃', 'Linus Torvalds', 80.00, 9999, 9, 'static/img/default.png'); INSERT INTO `t_book` VALUES (2, '数据结构与算法', 'Jeff Dean', 78.50, 6, 13, 'static/img/default.png'); INSERT INTO `t_book` VALUES (3, '怎样拐跑别人的媳妇', 'John Carmack', 68.00, 100006, 45, 'static/img/default.png'); INSERT INTO `t_book` VALUES (4, '木虚肉盖饭', 'Richard Stallman', 16.00, 1009, 41, 'static/img/default.png'); INSERT INTO `t_book` VALUES (5, 'C++编程思想', 'Fabrice Bellard', 45.50, 14, 95, 'static/img/default.png'); INSERT INTO `t_book` VALUES (6, '蛋炒饭', 'Doug Cutting', 9.90, 12, 53, 'static/img/default.png'); INSERT INTO `t_book` VALUES (7, '赌神', 'Donald Knuth', 66.50, 125, 535, 'static/img/default.png'); INSERT INTO `t_book` VALUES (8, 'Java编程思想', 'Anders Hejlsberg', 99.50, 47, 36, 'static/img/default.png'); INSERT INTO `t_book` VALUES (9, 'JavaScript从入门到精通', 'Ken Thompson', 9.90, 85, 95, 'static/img/default.png'); INSERT INTO `t_book` VALUES (10, 'cocos2d-x游戏编程入门', 'Adam D Angelo', 49.00, 52, 62, 'static/img/default.png'); INSERT INTO `t_book` VALUES (11, 'C语言程序设计', 'Sanjay Ghemawat', 28.00, 52, 74, 'static/img/default.png'); INSERT INTO `t_book` VALUES (12, 'Lua语言程序设计', 'Petr Mitrichev', 51.50, 48, 82, 'static/img/default.png'); INSERT INTO `t_book` VALUES (13, '西游记', 'Jon Skeet', 12.00, 19, 9999, 'static/img/default.png'); INSERT INTO `t_book` VALUES (14, '水浒传', 'Gennady Korotkevich', 33.05, 22, 88, 'static/img/default.png'); INSERT INTO `t_book` VALUES (15, '操作系统原理', 'Jon Skeet', 133.05, 122, 188, 'static/img/default.png'); INSERT INTO `t_book` VALUES (16, '数据结构 java版', 'Gennady Korotkevich', 173.15, 21, 81, 'static/img/default.png'); INSERT INTO `t_book` VALUES (17, 'UNIX高级环境编程', 'Richard Stallman', 99.15, 210, 810, 'static/img/default.png'); INSERT INTO `t_book` VALUES (18, 'javaScript高级编程', 'Petr Mitrechev', 69.15, 210, 810, 'static/img/default.png'); INSERT INTO `t_book` VALUES (19, '大话设计模式', 'Doug Cutting', 89.15, 20, 10, 'static/img/default.png'); INSERT INTO `t_book` VALUES (20, '人月神话', 'Anders Hejlsberg', 88.15, 20, 80, 'static/img/default.png'); INSERT INTO `t_book` VALUES (26, '时间简史', '霍金', 30.00, 200, 300, 'static/img/default.png'); INSERT INTO `t_book` VALUES (27, '修改后的数据', '作者1', 111.00, 111, 111, 'static/img/default.png'); INSERT INTO `t_book` VALUES (29, '修改数据完成', '作者2', 3333.00, 3333, 3333, 'static/img/default.png'); -- ---------------------------- -- Table structure for t_order -- ---------------------------- DROP TABLE IF EXISTS `t_order`; CREATE TABLE `t_order` ( `order_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `creation_time` datetime(0) NULL DEFAULT NULL, `price` decimal(11, 2) NULL DEFAULT NULL, `status` int(11) NULL DEFAULT NULL, `user_id` int(11) NULL DEFAULT NULL, PRIMARY KEY (`order_id`) USING BTREE, INDEX `user_id`(`user_id`) USING BTREE, CONSTRAINT `t_order_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `t_user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of t_order -- ---------------------------- INSERT INTO `t_order` VALUES ('16147708201621', '2021-03-03 11:27:00', 200.00, 0, 1); INSERT INTO `t_order` VALUES ('16147772792532', '2021-03-03 13:14:39', 242.50, 0, 2); INSERT INTO `t_order` VALUES ('16147776087662', '2021-03-03 13:20:09', 0.00, 0, 2); INSERT INTO `t_order` VALUES ('16147776113612', '2021-03-03 13:20:11', 0.00, 0, 2); INSERT INTO `t_order` VALUES ('16147789428202', '2021-03-03 13:42:23', 78.50, 0, 2); INSERT INTO `t_order` VALUES ('16147789733112', '2021-03-03 13:42:53', 16.00, 0, 2); INSERT INTO `t_order` VALUES ('16147802861272', '2021-03-03 14:04:46', 80.00, 0, 2); INSERT INTO `t_order` VALUES ('16147804192232', '2021-03-03 14:06:59', 32.00, 0, 2); INSERT INTO `t_order` VALUES ('16147804912532', '2021-03-03 14:08:11', 16.00, 0, 2); INSERT INTO `t_order` VALUES ('16147806820482', '2021-03-03 14:11:22', 68.00, 0, 2); INSERT INTO `t_order` VALUES ('16148151318172', '2021-03-03 23:45:32', 204.00, 0, 2); INSERT INTO `t_order` VALUES ('16148192562122', '2021-03-04 00:54:16', 68.00, 0, 2); INSERT INTO `t_order` VALUES ('16149818910862', '2021-03-05 22:04:51', 68.00, 0, 2); INSERT INTO `t_order` VALUES ('16521019967272', '2022-05-09 13:13:17', 84.00, 0, 2); INSERT INTO `t_order` VALUES ('20210303', '2021-03-03 07:55:21', 100.00, 0, 1); -- ---------------------------- -- Table structure for t_order_item -- ---------------------------- DROP TABLE IF EXISTS `t_order_item`; CREATE TABLE `t_order_item` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `count` int(11) NULL DEFAULT NULL, `price` decimal(11, 2) NULL DEFAULT NULL, `total_price` decimal(11, 2) NULL DEFAULT NULL, `order_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE, INDEX `order_id`(`order_id`) USING BTREE, CONSTRAINT `t_order_item_ibfk_1` FOREIGN KEY (`order_id`) REFERENCES `t_order` (`order_id`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE = InnoDB AUTO_INCREMENT = 21 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of t_order_item -- ---------------------------- INSERT INTO `t_order_item` VALUES (1, 'Java从入门到精通', 1, 50.00, 50.00, '20210303'); INSERT INTO `t_order_item` VALUES (2, 'Java从入门到放弃', 2, 25.00, 50.00, '20210303'); INSERT INTO `t_order_item` VALUES (3, 'Java', 1, 50.00, 50.00, '16147708201621'); INSERT INTO `t_order_item` VALUES (4, 'C++', 1, 50.00, 50.00, '16147708201621'); INSERT INTO `t_order_item` VALUES (5, 'C#', 2, 50.00, 100.00, '16147708201621'); INSERT INTO `t_order_item` VALUES (6, 'java从入门到放弃', 1, 80.00, 80.00, '16147772792532'); INSERT INTO `t_order_item` VALUES (7, '数据结构与算法', 1, 78.50, 78.50, '16147772792532'); INSERT INTO `t_order_item` VALUES (8, '怎样拐跑别人的媳妇', 1, 68.00, 68.00, '16147772792532'); INSERT INTO `t_order_item` VALUES (9, '木虚肉盖饭', 1, 16.00, 16.00, '16147772792532'); INSERT INTO `t_order_item` VALUES (10, '数据结构与算法', 1, 78.50, 78.50, '16147789428202'); INSERT INTO `t_order_item` VALUES (11, '木虚肉盖饭', 1, 16.00, 16.00, '16147789733112'); INSERT INTO `t_order_item` VALUES (12, '木虚肉盖饭', 5, 16.00, 80.00, '16147802861272'); INSERT INTO `t_order_item` VALUES (13, '木虚肉盖饭', 2, 16.00, 32.00, '16147804192232'); INSERT INTO `t_order_item` VALUES (14, '木虚肉盖饭', 1, 16.00, 16.00, '16147804912532'); INSERT INTO `t_order_item` VALUES (15, '怎样拐跑别人的媳妇', 1, 68.00, 68.00, '16147806820482'); INSERT INTO `t_order_item` VALUES (16, '怎样拐跑别人的媳妇', 3, 68.00, 204.00, '16148151318172'); INSERT INTO `t_order_item` VALUES (17, '怎样拐跑别人的媳妇', 1, 68.00, 68.00, '16148192562122'); INSERT INTO `t_order_item` VALUES (18, '怎样拐跑别人的媳妇', 1, 68.00, 68.00, '16149818910862'); INSERT INTO `t_order_item` VALUES (19, '怎样拐跑别人的媳妇', 1, 68.00, 68.00, '16521019967272'); INSERT INTO `t_order_item` VALUES (20, '木虚肉盖饭', 1, 16.00, 16.00, '16521019967272'); -- ---------------------------- -- Table structure for t_user -- ---------------------------- DROP TABLE IF EXISTS `t_user`; CREATE TABLE `t_user` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `password` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `mailbox` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of t_user -- ---------------------------- INSERT INTO `t_user` VALUES (1, 'heber', 'heber', 'heber@qq.com'); INSERT INTO `t_user` VALUES (2, 'admin', 'admin', 'admin@qq.com'); INSERT INTO `t_user` VALUES (3, 'tom', 'tom', 'tom@qq.com'); INSERT INTO `t_user` VALUES (4, 'jackson', 'jackson', 'jackson@qq.com'); SET FOREIGN_KEY_CHECKS = 1;
-
初始化数据完成后点击 IDEA 绿色三角图标启动服务器运行项目
-
服务器启动成功后,就会自动弹出我们的项目页面啦!