Skip to content

Commit 7b6b0ea

Browse files
committed
first commit
0 parents  commit 7b6b0ea

35 files changed

+14295
-0
lines changed

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Maven #
2+
target/
3+
4+
# IDEA #
5+
.idea/
6+
*.iml
7+
8+
# Eclipse #
9+
.settings/
10+
.classpath
11+
.project

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#SSM集成的基础项目,项目使用Maven管理
2+
3+
项目使用Spring3.2.12+SpringMVC3.2.12+Mybatis3.2.8
4+
5+
项目集成了Mybatis分页插件和通用Mapper插件
6+
7+
项目使用的hsqldb内存数据库,根据需要可以切换为其他支持的数据库
8+
9+
##推荐使用Mybatis通用Mapper
10+
11+
项目地址:https://github.com/abel533/Mapper
12+
13+
##推荐使用Mybatis分页插件
14+
15+
Mybatis分页插件oschub的项目地址:http://git.oschina.net/free/Mybatis_PageHelper
16+
17+
Mybatis分页插件github的项目地址:https://github.com/pagehelper/Mybatis-PageHelper
18+
19+
分页插件文档地址:http://git.oschina.net/free/Mybatis_PageHelper/wikis/home
20+
21+
22+
##其他相关信息
23+
24+
Mybatis项目:https://github.com/mybatis/mybatis-3
25+
26+
Mybatis文档:http://mybatis.github.io/mybatis-3/zh/index.html
27+
28+
Mybatis专栏:
29+
Mybatis示例:http://blog.csdn.net/column/details/mybatis-sample.html
30+
Mybatis问题集:http://blog.csdn.net/column/details/mybatisqa.html
31+
32+
##作者信息
33+
34+
作者博客:
35+
http://my.oschina.net/flags/blog
36+
http://blog.csdn.net/isea533
37+
38+
作者QQ: 120807756
39+
40+
作者邮箱: abel533@gmail.com
41+
42+
推荐一个Mybatis的QQ群: 146127540

pom.xml

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>com.isea533</groupId>
5+
<artifactId>mybatis-spring</artifactId>
6+
<packaging>war</packaging>
7+
<version>1.0-SNAPSHOT</version>
8+
<name>Spring-Mybatis-Mapper-PageHelper</name>
9+
<description>这是一个集成了Mybatis分页插件和通用Mapper的示例项目</description>
10+
<url>http://maven.apache.org</url>
11+
12+
<properties>
13+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
14+
</properties>
15+
16+
<dependencies>
17+
<dependency>
18+
<groupId>junit</groupId>
19+
<artifactId>junit</artifactId>
20+
<version>4.11</version>
21+
<scope>test</scope>
22+
</dependency>
23+
<dependency>
24+
<groupId>log4j</groupId>
25+
<artifactId>log4j</artifactId>
26+
<version>1.2.17</version>
27+
</dependency>
28+
29+
<!--web-->
30+
<dependency>
31+
<groupId>javax.servlet</groupId>
32+
<artifactId>servlet-api</artifactId>
33+
<version>2.5</version>
34+
<scope>provided</scope>
35+
</dependency>
36+
<dependency>
37+
<groupId>javax.servlet.jsp</groupId>
38+
<artifactId>javax.servlet.jsp-api</artifactId>
39+
<version>2.3.1</version>
40+
<scope>provided</scope>
41+
</dependency>
42+
<dependency>
43+
<groupId>javax.servlet.jsp.jstl</groupId>
44+
<artifactId>javax.servlet.jsp.jstl-api</artifactId>
45+
<version>1.2.1</version>
46+
</dependency>
47+
<dependency>
48+
<groupId>javax.ws.rs</groupId>
49+
<artifactId>javax.ws.rs-api</artifactId>
50+
<version>2.0</version>
51+
</dependency>
52+
<dependency>
53+
<groupId>javax.websocket</groupId>
54+
<artifactId>javax.websocket-api</artifactId>
55+
<version>1.0</version>
56+
</dependency>
57+
<dependency>
58+
<groupId>javax.annotation</groupId>
59+
<artifactId>javax.annotation-api</artifactId>
60+
<version>1.2</version>
61+
</dependency>
62+
<dependency>
63+
<groupId>javax.transaction</groupId>
64+
<artifactId>javax.transaction-api</artifactId>
65+
<version>1.2</version>
66+
</dependency>
67+
68+
<!--Spring-->
69+
<dependency>
70+
<groupId>org.springframework</groupId>
71+
<artifactId>spring-context</artifactId>
72+
</dependency>
73+
<dependency>
74+
<groupId>org.springframework</groupId>
75+
<artifactId>spring-orm</artifactId>
76+
</dependency>
77+
<dependency>
78+
<groupId>org.springframework</groupId>
79+
<artifactId>spring-oxm</artifactId>
80+
</dependency>
81+
<dependency>
82+
<groupId>org.springframework</groupId>
83+
<artifactId>spring-jdbc</artifactId>
84+
</dependency>
85+
<dependency>
86+
<groupId>org.springframework</groupId>
87+
<artifactId>spring-tx</artifactId>
88+
</dependency>
89+
<dependency>
90+
<groupId>org.springframework</groupId>
91+
<artifactId>spring-web</artifactId>
92+
</dependency>
93+
<dependency>
94+
<groupId>org.springframework</groupId>
95+
<artifactId>spring-webmvc</artifactId>
96+
</dependency>
97+
<dependency>
98+
<groupId>org.springframework</groupId>
99+
<artifactId>spring-aop</artifactId>
100+
</dependency>
101+
102+
<!--spring-oxm依赖-->
103+
<dependency>
104+
<groupId>org.codehaus.castor</groupId>
105+
<artifactId>castor-xml</artifactId>
106+
<version>1.3.3</version>
107+
</dependency>
108+
<!--spring-json依赖-->
109+
<dependency>
110+
<groupId>com.fasterxml.jackson.core</groupId>
111+
<artifactId>jackson-databind</artifactId>
112+
<version>2.4.2</version>
113+
</dependency>
114+
<dependency>
115+
<groupId>com.fasterxml.jackson.dataformat</groupId>
116+
<artifactId>jackson-dataformat-xml</artifactId>
117+
<version>2.4.2</version>
118+
</dependency>
119+
<!--spring-aop依赖-->
120+
<dependency>
121+
<groupId>org.aspectj</groupId>
122+
<artifactId>aspectjweaver</artifactId>
123+
<version>1.8.2</version>
124+
</dependency>
125+
126+
<!--Commons-->
127+
<dependency>
128+
<groupId>commons-dbcp</groupId>
129+
<artifactId>commons-dbcp</artifactId>
130+
<version>1.4</version>
131+
</dependency>
132+
<!--上传文件-->
133+
<dependency>
134+
<groupId>commons-fileupload</groupId>
135+
<artifactId>commons-fileupload</artifactId>
136+
<version>1.3.1</version>
137+
</dependency>
138+
139+
<!--hsqldb-->
140+
<dependency>
141+
<groupId>org.hsqldb</groupId>
142+
<artifactId>hsqldb</artifactId>
143+
<version>2.2.9</version>
144+
</dependency>
145+
146+
<!--Mybatis-->
147+
<dependency>
148+
<groupId>org.mybatis</groupId>
149+
<artifactId>mybatis</artifactId>
150+
<version>3.2.8</version>
151+
</dependency>
152+
<dependency>
153+
<groupId>org.mybatis</groupId>
154+
<artifactId>mybatis-spring</artifactId>
155+
<version>1.2.2</version>
156+
</dependency>
157+
<dependency>
158+
<groupId>com.github.jsqlparser</groupId>
159+
<artifactId>jsqlparser</artifactId>
160+
<version>0.9.1</version>
161+
</dependency>
162+
163+
<!--JPA-->
164+
<dependency>
165+
<groupId>javax.persistence</groupId>
166+
<artifactId>persistence-api</artifactId>
167+
<version>1.0</version>
168+
</dependency>
169+
</dependencies>
170+
<dependencyManagement>
171+
<dependencies>
172+
<dependency>
173+
<groupId>org.springframework</groupId>
174+
<artifactId>spring-framework-bom</artifactId>
175+
<version>3.2.12.RELEASE</version>
176+
<type>pom</type>
177+
<scope>import</scope>
178+
</dependency>
179+
</dependencies>
180+
</dependencyManagement>
181+
<repositories>
182+
<repository>
183+
<id>nexus</id>
184+
<name>local private nexus</name>
185+
<url>http://maven.oschina.net/content/groups/public/</url>
186+
<releases>
187+
<enabled>true</enabled>
188+
</releases>
189+
<snapshots>
190+
<enabled>false</enabled>
191+
</snapshots>
192+
</repository>
193+
</repositories>
194+
<build>
195+
<plugins>
196+
<plugin>
197+
<artifactId>maven-compiler-plugin</artifactId>
198+
<configuration>
199+
<source>1.6</source>
200+
<target>1.6</target>
201+
</configuration>
202+
</plugin>
203+
</plugins>
204+
</build>
205+
</project>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package com.isea533.mybatis.controller.demo;
2+
3+
import com.isea533.mybatis.model.Country;
4+
import com.isea533.mybatis.service.DemoService;
5+
import org.springframework.beans.factory.annotation.Autowired;
6+
import org.springframework.http.HttpEntity;
7+
import org.springframework.http.HttpStatus;
8+
import org.springframework.http.ResponseEntity;
9+
import org.springframework.stereotype.Controller;
10+
import org.springframework.web.bind.annotation.RequestMapping;
11+
import org.springframework.web.bind.annotation.RequestParam;
12+
import org.springframework.web.bind.annotation.ResponseBody;
13+
14+
import java.util.List;
15+
16+
/**
17+
* @author liuzh
18+
*/
19+
@Controller
20+
public class DemoController {
21+
22+
@Autowired
23+
private DemoService demoService;
24+
25+
@RequestMapping(value = {"/", "index.html"})
26+
public String index() {
27+
return "index";
28+
}
29+
30+
@ResponseBody
31+
@RequestMapping("test1")
32+
public Country requestTest5(HttpEntity<String> message) {
33+
return demoService.selectById(35);
34+
}
35+
36+
@RequestMapping("test2")
37+
public ResponseEntity<Country> requestTest6() {
38+
return new ResponseEntity<Country>(demoService.selectById2(35), HttpStatus.OK);
39+
}
40+
41+
@ResponseBody
42+
@RequestMapping("test3")
43+
public List<Country> requestTest7(
44+
@RequestParam(value = "pageNum", required = false, defaultValue = "1") int pageNum,
45+
@RequestParam(value = "pageSize", required = false, defaultValue = "10") int pageSize
46+
) {
47+
return demoService.selectPage(pageNum, pageSize);
48+
}
49+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.isea533.mybatis.mapper;
2+
3+
import com.isea533.mybatis.mapperhelper.Mapper;
4+
import com.isea533.mybatis.model.Country;
5+
6+
public interface CountryMapper extends Mapper<Country> {
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.isea533.mybatis.mapper;
2+
3+
import com.isea533.mybatis.mapperhelper.Mapper;
4+
import com.isea533.mybatis.model.UserInfo;
5+
6+
public interface UserInfoMapper extends Mapper<UserInfo> {
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.isea533.mybatis.mapper;
2+
3+
import com.isea533.mybatis.mapperhelper.Mapper;
4+
import com.isea533.mybatis.model.UserLogin;
5+
6+
public interface UserLoginMapper extends Mapper<UserLogin> {
7+
}

0 commit comments

Comments
 (0)