使用mybatis查询mysql数据库

mybatis中如何引用一个查询的结果作为另一个查询的条件。。。。。。。。。。。。。。。

抱歉。 上面的回复出现了问题
这个的话 可以考虑使用mybatis的高级查询咯 ,

 <resultMap type="com.test.bean.xxx" id="ResultMap">
        <id column="test_id" property="testId" jdbcType="BIGINT" />
        <collection property="tags" column="test_id" javaType="ArrayList"
            ofType="com.test.bean.xxx1" select="com.test.dao.TestMapper.queryAllByTestId"></collection>
    </resultMap>

这个其实就是把第一个查询出来的数据 中的testId作为第二个查询queryAllByTestId的条件了。
不知道是不是楼主想要的。。。

这个的话 可以考虑使用mybatis的高级查询咯 ,


ofType="com.test.bean.xxx1" select="com.test.dao.test1Mapper.queryAllByTestId">

这个其实就是把第一个查询出来的数据 中的testId作为第二个查询queryAllByTestId的条件了。
不知道是不是楼主想要的。。。

这个的话 可以考虑使用mybatis的高级查询咯 ,


ofType="com.test.bean.xxx1" select="com.test.dao.TestMapper.queryAllByTestId">

这个其实就是把第一个查询出来的数据 中的testId作为第二个查询queryAllByTestId的条件了。
不知道是不是楼主想要的。。。