mybatis 怎么 返回 null 值 返回类型 是个map
1个回答
展开全部
创建mybatis-config.xml
1
2
3
4
5
6
7
8
9
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<!-- 当返回数据类型为map,设置callSettersOnNulls会把值为null的key也返回 -->
<setting name="callSettersOnNulls" value="true"/>
</settings>
</configuration>
在配置数据源的配置文件中,配置Mybatis的SqlSessionFactoryBean
1
2
3
4
5
6
7
8
9
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation" value="classpath:/META-INF/spring/mybatis-config.xml" />
<property name="mapperLocations">
<array>
<value>classpath*:/yunnex/saofu/shop/beibao/mappe
1
2
3
4
5
6
7
8
9
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<!-- 当返回数据类型为map,设置callSettersOnNulls会把值为null的key也返回 -->
<setting name="callSettersOnNulls" value="true"/>
</settings>
</configuration>
在配置数据源的配置文件中,配置Mybatis的SqlSessionFactoryBean
1
2
3
4
5
6
7
8
9
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation" value="classpath:/META-INF/spring/mybatis-config.xml" />
<property name="mapperLocations">
<array>
<value>classpath*:/yunnex/saofu/shop/beibao/mappe
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询