<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.x.x.XXXDao" >
<resultMap id="ResultMap" type="com.x.x.XXXDTO">
<result column="item" property="attribute" jdbcType="jdbcType"/>
<result column="item" property="attribute" jdbcType="jdbcType"/>
<!-- collection 标签需放在最后 -->
<collection property="items" resultMap="ItemsMap"/>
</resultMap>
<resultMap id="ItemsMap" type="com.x.x.XXXDTOxxDto">
<result column="item" property="item" jdbcType="jdbcType"/>
<result column="item" property="item" jdbcType="jdbcType"/>
<result column="item" property="item" jdbcType="jdbcType"/>
</resultMap>
</mapper>
Mybatis resultMap用法之查询返对象中的属性包含 List
于 2023-06-06 17:26:48 首次发布
该文档展示了MyBatis中的一段mapper配置,包括两个resultMap,一个用于主对象`XXXDTO`,另一个用于集合属性`items`的子对象`XXXDTOxxDto`。配置详细指定了列名、属性名和JDBC类型。
摘要由CSDN通过智能技术生成