首页 > 其他 > 详细

mybatis 查询返回的类型中字段类型为 List<xx>

时间:2021-07-23 16:15:17      阅读:20      评论:0      收藏:0      [点我收藏+]

mapper.xml

<resultMap id="xxDtoResultMap"
           type="com.xx.xxDto">
    <id property="id" column="id" jdbcType="INTEGER"/>
    <result property="roomCount" column="room_count" jdbcType="INTEGER"/>
    <collection property="roomIds" ofType="Integer">
        <result column="room_ids"/>
    </collection>
</resultMap>

<select id="list" resultMap="xxDtoResultMap">
    select
    id
    count(xx.id) as room_count,
    room.id as room_ids
    ....
</select>

参考

select-list-of-integers-as-collection-inside-another-result-map-in-mybatis

mybatis 对象 List List属性 映射

mybatis 查询返回的类型中字段类型为 List<xx>

原文:https://www.cnblogs.com/myesn/p/15048406.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!