利用 Java語言使用 SSM 框架編寫完成書城項目後本地部署步驟操作指引 ...
BookStore
部署步驟
-
$ 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', '[email protected]'); INSERT INTO `t_user` VALUES (2, 'admin', 'admin', '[email protected]'); INSERT INTO `t_user` VALUES (3, 'tom', 'tom', '[email protected]'); INSERT INTO `t_user` VALUES (4, 'jackson', 'jackson', '[email protected]'); SET FOREIGN_KEY_CHECKS = 1;
-
初始化數據完成後點擊 IDEA 綠色三角圖標啟動伺服器運行項目
-
伺服器啟動成功後,就會自動彈出我們的項目頁面啦!
本文來自博客園,作者:Schieber,轉載請註明原文鏈接:https://www.cnblogs.com/xiqingbo/p/java-30.html