亲宝软件园·资讯

展开

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

Remember_Ray 人气:0

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

SSM搭建过程:

一般idea创建工程的过程

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

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

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

第一步:添加Spring、Spring MVC、Mybatis的依赖

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

pom.xml

<?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

建表语句如下:

# 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

加载全部内容

相关教程
猜你喜欢
用户评论