LibrarySystem图书管理系统开发(一)

时间:2022-03-12 08:25:02

本文为大家分享了librarysystem图书管理系统开发的第一篇,供大家参考,具体内容如下

ssm搭建过程:

一般idea创建工程的过程

打开idea ---> file ---> new ---> project ---> maven --->

create from archetype ---> maven-archetype-webapp ---> 接下来一般默认即可

最后在main目录下新建java 和 resources 文件夹。

LibrarySystem图书管理系统开发(一)

第一步:添加spring、spring mvc、mybatis的依赖

都配有详细的说明,这里不再重复

pom.xml

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<?xml version="1.0" encoding="utf-8"?>
 
<project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"
 xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 <modelversion>4.0.0</modelversion>
 
 <groupid>com.ray</groupid>
 <artifactid>librarysystem02</artifactid>
 <version>1.0-snapshot</version>
 <packaging>war</packaging>
 
 <name>librarysystem02 maven webapp</name>
 <!-- fixme change it to the project's website -->
 <url>http://www.example.com</url>
 
 <properties>
 <project.build.sourceencoding>utf-8</project.build.sourceencoding>
 <maven.compiler.source>1.7</maven.compiler.source>
 <maven.compiler.target>1.7</maven.compiler.target>
 
 <!-- 配置可变版本号 -->
 <logback.version>1.1.1</logback.version>
 <mysql.version>5.1.18</mysql.version>
 <com.alibaba.druid.version>1.1.9</com.alibaba.druid.version>
 <com.mybatis.mybatis.version>3.4.1</com.mybatis.mybatis.version>
 <com.mybatis.mybatis_spring.version>1.3.0</com.mybatis.mybatis_spring.version>
 <javax.servlet.version>3.1.0</javax.servlet.version>
 <org.springframework.version>4.3.2.release</org.springframework.version>
 <slf4j.version>1.7.18</slf4j.version>
 <log4j.version>1.2.17</log4j.version>
 <jackson-mapper-asl.version>1.9.13</jackson-mapper-asl.version>
 <jackson.version>2.9.2</jackson.version>
 <fastjson.version>1.2.47</fastjson.version>
 <org.mybatis.generator.version>1.3.5</org.mybatis.generator.version>
 </properties>
 
 <dependencies>
 <!-- 单元测试 -->
 <dependency>
  <groupid>junit</groupid>
  <artifactid>junit</artifactid>
  <version>4.11</version>
  <scope>test</scope>
 </dependency>
 
 <!-- 0.日志 -->
 <!-- 实现slf4j接口并整合 -->
 <dependency>
  <groupid>ch.qos.logback</groupid>
  <artifactid>logback-classic</artifactid>
  <version>${logback.version}</version>
 </dependency>
 
 <!-- 1.数据库 -->
 <dependency>
  <groupid>mysql</groupid>
  <artifactid>mysql-connector-java</artifactid>
  <version>${mysql.version}</version>
  <scope>runtime</scope>
 </dependency>
 <!--druid 阿里巴巴数据库连接池-->
 <dependency>
  <groupid>com.alibaba</groupid>
  <artifactid>druid</artifactid>
  <version>${com.alibaba.druid.version}</version>
 </dependency>
 <!-- dao: mybatis -->
 <dependency>
  <groupid>org.mybatis</groupid>
  <artifactid>mybatis</artifactid>
  <version>${com.mybatis.mybatis.version}</version>
 </dependency>
 <dependency>
  <groupid>org.mybatis</groupid>
  <artifactid>mybatis-spring</artifactid>
  <version>${com.mybatis.mybatis_spring.version}</version>
 </dependency>
 
 <!-- 2.servlet web -->
 <dependency>
  <groupid>jstl</groupid>
  <artifactid>jstl</artifactid>
  <version>1.2</version>
 </dependency>
 <!--servlet版本设置-->
 <dependency>
  <groupid>javax.servlet</groupid>
  <artifactid>javax.servlet-api</artifactid>
  <version>${javax.servlet.version}</version>
 </dependency>
 
 <!-- 3.spring -->
 <!-- 1)spring核心 -->
 <dependency>
  <groupid>org.springframework</groupid>
  <artifactid>spring-core</artifactid>
  <version>${org.springframework.version}</version>
 </dependency>
 <dependency>
  <groupid>org.springframework</groupid>
  <artifactid>spring-beans</artifactid>
  <version>${org.springframework.version}</version>
 </dependency>
 <dependency>
  <groupid>org.springframework</groupid>
  <artifactid>spring-context</artifactid>
  <version>${org.springframework.version}</version>
 </dependency>
 <!-- 2)spring dao层 -->
 <dependency>
  <groupid>org.springframework</groupid>
  <artifactid>spring-jdbc</artifactid>
  <version>${org.springframework.version}</version>
 </dependency>
 <dependency>
  <groupid>org.springframework</groupid>
  <artifactid>spring-tx</artifactid>
  <version>${org.springframework.version}</version>
 </dependency>
 <!-- 3)spring web -->
 <dependency>
  <groupid>org.springframework</groupid>
  <artifactid>spring-web</artifactid>
  <version>${org.springframework.version}</version>
 </dependency>
 <dependency>
  <groupid>org.springframework</groupid>
  <artifactid>spring-webmvc</artifactid>
  <version>${org.springframework.version}</version>
 </dependency>
 <dependency>
  <groupid>org.springframework</groupid>
  <artifactid>spring-test</artifactid>
  <version>${org.springframework.version}</version>
 </dependency>
 
 <!-- 映入json -->
 <dependency>
  <groupid>org.codehaus.jackson</groupid>
  <artifactid>jackson-mapper-asl</artifactid>
  <version>${jackson-mapper-asl.version}</version>
 </dependency>
 <dependency>
  <groupid>com.fasterxml.jackson.core</groupid>
  <artifactid>jackson-core</artifactid>
  <version>${jackson.version}</version>
 </dependency>
 <dependency>
  <groupid>com.fasterxml.jackson.core</groupid>
  <artifactid>jackson-databind</artifactid>
  <version>${jackson.version}</version>
 </dependency>
 
 <!-- 添加fastjson -->
 <dependency>
  <groupid>com.alibaba</groupid>
  <artifactid>fastjson</artifactid>
  <version>${fastjson.version}</version>
 </dependency>
 </dependencies>
 
 <build>
 <finalname>librarysystem02</finalname>
 <pluginmanagement><!-- lock down plugins versions to avoid using maven defaults (may be moved to parent pom) -->
  <plugins>
  <plugin>
   <artifactid>maven-clean-plugin</artifactid>
   <version>3.0.0</version>
  </plugin>
  <!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#plugin_bindings_for_war_packaging -->
  <plugin>
   <artifactid>maven-resources-plugin</artifactid>
   <version>3.0.2</version>
  </plugin>
  <plugin>
   <artifactid>maven-compiler-plugin</artifactid>
   <version>3.7.0</version>
  </plugin>
  <plugin>
   <artifactid>maven-surefire-plugin</artifactid>
   <version>2.20.1</version>
  </plugin>
  <plugin>
   <artifactid>maven-war-plugin</artifactid>
   <version>3.2.0</version>
  </plugin>
  <plugin>
   <artifactid>maven-install-plugin</artifactid>
   <version>2.5.2</version>
  </plugin>
  <plugin>
   <artifactid>maven-deploy-plugin</artifactid>
   <version>2.8.2</version>
  </plugin>
 
  <!-- 逆向工程 mybatis-generator -->
  <plugin>
   <groupid>org.mybatis.generator</groupid>
   <artifactid>mybatis-generator-maven-plugin</artifactid>
   <version>${org.mybatis.generator.version}</version>
   <configuration>
   <verbose>true</verbose>
   <overwrite>true</overwrite>
   </configuration>
   <dependencies>
   <dependency>
    <groupid>org.mybatis</groupid>
    <artifactid>mybatis</artifactid>
    <version>${com.mybatis.mybatis.version}</version>
   </dependency>
   <dependency>
    <groupid>mysql</groupid>
    <artifactid>mysql-connector-java</artifactid>
    <version>${mysql.version}</version>
   </dependency>
   </dependencies>
  </plugin>
  </plugins>
 </pluginmanagement>
 </build>
</project>

第二步:添加数据库

这里需要创建一个数据库,名为:library

建表语句如下:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# host: localhost (version 6.0.11-alpha-community)
# date: 2018-05-22 20:31:40
# generator: mysql-front 6.0 (build 2.20)
 
 
#
# structure for table "book"
#
 
drop table if exists `book`;
create table `book` (
 `id` bigint(20) not null auto_increment,
 `book_name` varchar(255) not null,
 `book_writer` varchar(255) not null,
 `book_publisher` varchar(255) not null,
 `book_isrent` bigint(20) not null,
 `book_person` varchar(20) not null,
 primary key (`id`)
) engine=innodb auto_increment=5 default charset=utf8;
 
#
# data for table "book"
#
 
insert into `book` values (1,'机器学习','周志华','清华大学出版社',1,'linyue'),(2,'实战机器学习','peter','人民邮电出版社',1,'linyue'),(4,'算法导论','thomas','机械工业出版社',0,' ');
 
#
# structure for table "user"
#
 
drop table if exists `user`;
create table `user` (
 `id` bigint(11) not null auto_increment,
 `user_name` varchar(40) not null,
 `user_email` varchar(50) not null,
 `user_pwd` varchar(50) not null,
 primary key (`id`)
) engine=innodb auto_increment=11 default charset=utf8;
 
#
# data for table "user"
#
 
insert into `user` values (1,'linyue','123123@qq.com','123'),(3,'rain','222222@gmail.com','222'),(4,'ray','333333@qq.com','333'),(5,'test','123123@qq.com','123');

完整项目demo下载:librarysystem02

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持服务器之家。

原文链接:https://blog.csdn.net/q343509740/article/details/80411123