LibrarySystem图书管理系统开发(一)
程序员文章站
2023-12-18 22:05:04
本文为大家分享了librarysystem图书管理系统开发的第一篇,供大家参考,具体内容如下
ssm搭建过程:
一般idea创建工程的过程
打开idea --->...
本文为大家分享了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
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。