<!-- column:所对应的外键字段名称;property:对象属性名;select:指向另一查询方法(命名空间+方法名) -->
<!-- 一对一 查询时带出妻子信息 -->
<association column="USER_ID" property="wife" select="com.mapper.WifeMapper.selectByUserId" />
<!-- 一对多 查询时带出所有女朋友信息 -->
<collection column="USER_ID" property="girlList" ofType="com.entity.Girl" select="com.mapper.GirlMapper.selectByUserId">
</collection>
mybatis一对一与一对多 mapper.xml配置
最新推荐文章于 2024-04-15 14:55:08 发布