mybatis中collection子查询注入参数为null

具体实现参照网上,但是可能遇到注入参数为null的情况,经过查阅及自己测试记录一下:

<collection property="projectList" column="{projectId=project_id}" javaType="ArrayList" ofType="Project" select="selectProjectList"/>
  • 但是在没有<if test="">这种情况下,有时不能有别名,否则会出现注入参数为空
 <collection property="projectList" column="project_id" javaType="ArrayList" ofType="Project" select="selectProjectList"/>
具体原因不明
原文地址:https://www.cnblogs.com/jaxlove-it/p/7238536.html