报错信息:
java.lang.IllegalArgumentException: Result Maps collection does not contain value for com.central.user.mapper.SysRoleMenuMapper.SysMenu
错误出在mapper.xml文件中,查询返回类型是List,那么在mapper.xml中的返回要用resultType指定类,而不能使用resultMap
List<SysMenu> findMenusByRoleIds(@Param("roleIds") List<Long> roleIds);
<select id="findMenusByRoleIds" resultType="com.central.common.model.SysMenu">
SELECT DISTINCT p.*
FROM
sys_menu p
left JOIN sys_role_menu rp on p.key = rp.privilege_key
WHERE
rp.role_id IN
<foreach collection="roleIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
order by p.create_time desc
</select>