<resultMap id="TestResult" type="Test">
<id property="id" column="id" />
<result property="testName" column="test_name" />
<!-- 一对多映射 -->
<collection property="testMoreList" ofType="TestMore">
<result property="id" column="test_more_id" />
<result property="testMoreName" column="test_more_name" />
<!-- 一对一映射 -->
<association property="testOne" javaType="TestOne">
<id property="id" column="test_one_id" />
<result property="testOneName" column="test_one_name" />
</association>
</collection>
</resultMap>
Mybatis一对多和一对一映射记录
最新推荐文章于 2024-07-22 14:15:06 发布