File tree 5 files changed +24
-7
lines changed
5 files changed +24
-7
lines changed Original file line number Diff line number Diff line change 22
22
<!-- 编译jdk版本 -->
23
23
<jdk .version>1.6</jdk .version>
24
24
<!-- 依赖版本 -->
25
- <mapper .version>1.1 .0</mapper .version>
26
- <pagehelper .version>3.4 .0</pagehelper .version>
25
+ <mapper .version>2.0 .0</mapper .version>
26
+ <pagehelper .version>3.6 .0</pagehelper .version>
27
27
<mysql .version>5.1.29</mysql .version>
28
28
<spring .version>4.1.2.RELEASE</spring .version>
29
29
</properties >
181
181
<dependency >
182
182
<groupId >com.github.pagehelper</groupId >
183
183
<artifactId >pagehelper</artifactId >
184
- <version >3.5.1 </version >
184
+ <version >${pagehelper.version} </version >
185
185
</dependency >
186
186
<!-- 通用Mapper-->
187
187
<dependency >
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ public List<Country> requestTest7(
55
55
@ RequestParam (value = "pageSize" , required = false , defaultValue = "10" ) int pageSize
56
56
) {
57
57
demoService .test ();
58
+ demoService .testEntityMapper ();
58
59
return demoService .selectPage (pageNum , pageSize );
59
60
}
60
61
}
Original file line number Diff line number Diff line change 24
24
25
25
package com .isea533 .mybatis .service ;
26
26
27
+ import com .github .abel533 .entity .EntityMapper ;
27
28
import com .github .abel533 .mapper .Mapper ;
28
29
import com .isea533 .mybatis .model .Country ;
30
+ import com .isea533 .mybatis .model .UserInfo ;
29
31
import org .springframework .beans .factory .annotation .Autowired ;
30
32
import org .springframework .stereotype .Service ;
31
33
32
34
/**
33
35
* @author liuzh
34
36
*/
35
37
@ Service
36
- public class DemoService extends BaseService <Country >{
38
+ public class DemoService extends BaseService <Country > {
37
39
38
40
@ Autowired
39
41
private Mapper <Country > countryMapper ;
40
42
43
+ @ Autowired
44
+ private EntityMapper entityMapper ;
45
+
41
46
public int save (Country country ) {
42
47
if (country == null ) {
43
48
throw new NullPointerException ("保存的对象不能为空!" );
@@ -51,9 +56,16 @@ public int save(Country country) {
51
56
return super .save (country );
52
57
}
53
58
54
- public void test (){
59
+ public void test () {
55
60
int result = countryMapper .selectCount (null );
56
61
System .out .println (result );
57
62
}
58
63
64
+ public void testEntityMapper (){
65
+ Country country = entityMapper .selectByPrimaryKey (Country .class , 100 );
66
+ int count = entityMapper .count (new Country ());
67
+ System .out .println (country .toString ());
68
+ System .out .println (count );
69
+ }
70
+
59
71
}
Original file line number Diff line number Diff line change 86
86
</bean >
87
87
88
88
<bean class =" org.mybatis.spring.mapper.MapperScannerConfigurer" >
89
- <property name =" basePackage" value =" com.isea533.mybatis.mapper" />
89
+ <property name =" basePackage" value =" com.isea533.mybatis.mapper,com.github.abel533.entity.mapper" />
90
+ </bean >
91
+
92
+ <bean id =" entityMapper" class =" com.github.abel533.entity.EntityMapper" scope =" prototype" >
93
+ <constructor-arg ref =" commonMapper" />
90
94
</bean >
91
95
92
96
<bean id =" sqlSession" class =" org.mybatis.spring.SqlSessionTemplate" scope =" prototype" >
Original file line number Diff line number Diff line change 26
26
jdbc.driverClass = com.mysql.jdbc.Driver
27
27
jdbc.url = jdbc:mysql://localhost:3306/test
28
28
jdbc.user = root
29
- jdbc.password =
29
+ jdbc.password = jj
30
30
31
31
# c3p0
32
32
jdbc.maxPoolSize =50
You can’t perform that action at this time.
0 commit comments