Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d4aa917

Browse files
committed
spring例子的通用Mapper改为拦截器形式。
1 parent e4d81ff commit d4aa917

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

src/main/resources/applicationContext.xml

+9-17
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,15 @@
7373
<property name="typeAliasesPackage" value="com.isea533.mybatis.model"/>
7474
<property name="plugins">
7575
<array>
76+
<bean class="com.github.abel533.mapperhelper.MapperInterceptor">
77+
<property name="properties">
78+
<value>
79+
mappers=com.github.abel533.mapper.Mapper
80+
IDENTITY=MYSQL
81+
notEmpty=true
82+
</value>
83+
</property>
84+
</bean>
7685
<bean class="com.github.pagehelper.PageHelper">
7786
<property name="properties">
7887
<value>
@@ -116,21 +125,4 @@
116125
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
117126
<property name="dataSource" ref="dataSource"/>
118127
</bean>
119-
120-
<bean class="com.github.abel533.mapperhelper.MapperHelper"
121-
depends-on="sqlSession" init-method="initMapper" scope="singleton" lazy-init="false">
122-
<!--通用Mapper接口-->
123-
<property name="mappers">
124-
<array>
125-
<value>${mapper.Mapper}</value>
126-
</array>
127-
</property>
128-
<!--必须注入sqlSession-->
129-
<property name="sqlSessions" ref="sqlSession"/>
130-
<!--对于一般的getAllIfColumnNode,是否判断!='',默认不判断-->
131-
<!--该参数会影响所有使用getAllIfColumnNode方法的地方-->
132-
<!--具体到Mapper<T>,影响3个方法:select,selectCount,delete-->
133-
<property name="notEmpty" value="true"/>
134-
<property name="IDENTITY" value="MYSQL"/>
135-
</bean>
136128
</beans>

0 commit comments

Comments
 (0)