<select id="currentData" resultMap="departmentMap">
SELECT d.*,e.username eusername ,p.name pname FROM t_department d LEFT JOIN t_employee e ON d.manager_id=e.id
LEFT JOIN t_department p ON d.parent_id=p.id
<include refid="whereSql"></include>
limit #{begin},#{pageSize}
</select>
<resultMap id="departmentMap" type="Department">
<id column="id" property="id"></id>
<result column="sn" property="sn"></result>
<result column="name" property="name"></result>
<result column="dirPath" property="dirPath"></result>
<result column="state" property="state"></result>
<result column="manager_id" property="manager_id"></result>
<result column="parent_id" property="parent_id"></result>
<result column="shop_id" property="shop_id"></result>
<association property="manager" javaType="Employee">
<result column="eusername" property="username"></result>
</association>
<association property="parent" javaType="Department">
<result column="pname" property="name"></result>
</association>
</resultMap>