DepartmentMapper.xml的sql配置文件
<resultMap type="com.atChina.bean.Department" id="defineDeptStep">
<id column="deptno" property="deptno"/>
<result column="dname" property="dname"/>
<result column="loc" property="loc"/>
<collection property="emps"
select="com.atChina.dao.EmployeePlusMapper.getEmpsByDep"
column="{deptno}">
</collection>
</resultMap>
<select id="getDepartByDeptnoStep" resultMap="defineDeptStep">
select * from depttest a where a.deptno = #{deptno}
</select>
EmployeePlusMapper.xml的sql配置文件
<select id="getEmpsByDep" resultType="com.atChina.bean.Employee">
select *
from emptest a where a.deptno = #{deptno}
</select>
参数传递多列
如果将多列的值传递过去,可以将多列的值封装map传递
column="{key1=column1, key2=column2}"