如何使用 MyBatis 嵌套 select 收集有关列属性的接受实体?

How to use MyBatis nested select for collection about column attribute accept an entity?

我想使用嵌套 select 来获取列表

<resultMap id="MenuRoleResultMap" type="Role" extends="BaseResultMap">
    <collection property="menus" ofType="Menu" column="id"
            select="MenuMapper.listByRole"/>
</resultMap>

和关于

的 func listByRole
<select id="listByRole" parameterType="Role" resultMap="BaseResultMap">
   SELECT *
   FROM sys_menu m
   LEFT JOIN sys_role_menu srm ON m.id = srm.menu_id
   WHERE m.del_flag = #{DEL_NOT}
     and srm.role_id = #{id}
</select>

我希望这个 func 接受一个关于 Role 的实体来接受更多的参数,而不是 HashMap,但是这个常量 DEL_NOT 是 null

异常日志

org.mybatis.spring.MyBatisSystemException: 
   nested exception is org.apache.ibatis.type.TypeException: 
      Could not set parameters for mapping: 
ParameterMapping{property='DEL_NOT', mode=IN, javaType=int, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. 
Cause: org.apache.ibatis.type.TypeException: 
Error setting non null for parameter #1 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property.  Cause: java.lang.ClassCastException: java.lang.String cannot be cast to  java.lang.Integer

怎么办?

英语真的很难

好的... 我觉得... 我傻

<resultMap id="MenuRoleResultMap" type="Role" extends="BaseResultMap">
  <collection property="menus" ofType="Menu" column="{id = id}"
            select="MenuMapper.listByRole"/>
</resultMap>