有时候查询数据时,一条数据需要获取对应关联表的多个ID时,但是又不需要关联表其他字段,可用此办法.
<resultMap type="XXX.XXX.pojo.TaskMessagePojo" id="getNewTaskMessageMap">
<result column="account_item_id" property="accountItemId"/>
<result column="item_id" property="itemId"/>
<collection property="imgUrlList" // 对象中集合的字段名
ofType="string"> // 对象中集合的字段类型
<constructor>
<arg column="img_url" /> //sql中对应的字段列名
</constructor>
</collection>
</resultMap>