1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper  PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"  "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!--namespace对应mapper接口所在的位置-->
<mapper namespace="com.dy.pipIrrGlobal.daoDemo.DemoAuthMapper">
    <resultMap id="authMap" type="com.dy.pipIrrGlobal.pojoDemo.DemoAuth">
        <id property="id" column="id" />
        <result property="num" column="num"/>
        <result property="name" column="name"/>
        <result property="type" column="type"/>
    </resultMap>
 
 
    <!-- fetchType="lazy" 还需要配置aggressiveLazyLoading=false -->
    <resultMap id="selectAll" extends="authMap" type="com.dy.pipIrrGlobal.pojoDemo.DemoAuth">
        <collection property="roleList" fetchType="lazy" column="{authId=id}" select="com.dy.pipIrrGlobal.daoDemo.DemoRoleMapper.selectByAuthId" />
    </resultMap>
 
 
    <select id="selectAll"  resultMap="selectAll">
        select * from demo_auth
    </select>
 
 
</mapper>