Mybatis框架中的resultMap高级映射---特殊问题(版本mybatis-3.5.5)

多表关联查询时遇到的问题与结论:当使用多表关联查询时collection中的property属性(menuIds)不能为数组(Integer[]),只能写成集合List


封装类
@Data
public class SysRoleMenu implements Serializable{

    private static final long serialVersionUID = 8377897338767610433L;
    private Integer id;
    private String name;
    private String note;
    private Integer[] menuIds; //应该改成List
}
数据层接口方法Dao

基于id查询,返回一个SysRoleMenu类型的对象

SysRoleMenu selectRole(Integer id);
XML中的SQL语句

    
    
    
       
        
    


嵌套查询时collection中的property属性(menuIds)可以是数组(Integer[]),也可以是集合List

你可能感兴趣的:(java,springboot,mybatis)