<settings>
<!--
name:指定要配置的属性的名字
value:指定设置的属性值
-->
<!-- 开启驼峰命名法,可以将数据库中的下划线映射为驼峰命名 -->
<setting name="mapUnderscoreToCamelCase" value="true"/>
<!-- 开启延迟加载 -->
<setting name="lazyLoadingEnabled" value="true"/>
<!-- 设置按需加载 ,true:不管是否需要都加载,false:按需要加载-->
<setting name="aggressiveLazyLoading" value="false"/>
</settings>
fatchType:设置具体的结果集,按需要加载lazy,或者懒加载eager
<select id="getEmployeeAndDepartmentByAssociationFenbu" resultMap="customMap3">
select * from employees where id=#{id}
</select>
<resultMap type="com.atgui.spring.mybatis.entities.Employee" id="customMap3">
<id column="e_id" property="id"></id>
<result column="last_name" property="lastName"/>
<result column="email" property="email"/>
<result column="salary" property="salary"/>
<result column="dept_id" property="deptId"/>
<association property="dept" select="com.atgui.spring.mybatis.mapper.DepartmentMapper.getDepartmentById"
column="dept_id" fetchType="eager">
</association>