yuehan521
yuehan521
2019-02-14 19:50

mybatis里怎么将一对多的主查询selectById里的两个参数传给关联查询

40
  • spring
  • java
  • java-ee

public interface ClazzMapper {

@Select("SELECT * FROM TB_CLAZZ  WHERE ID = #{id}")
@Results({
    @Result(id=true,column="id",property="id"),
    @Result(column="code",property="code"),
    @Result(column="name",property="name"),
    @Result(column="id",property="students",
    many=@Many(
            select="org.fkit.mapper.StudentMapper.selectByClazzId",
            fetchType=FetchType.LAZY))
})
Clazz selectById(@Param("id")Integer id,@Param("name")String name);

}

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答