mybatis中查询出来的结果对象中的属性有List<String>

我的实体类属性如下:

public class CheckRecordVO {
 private Long id;
 private Long pointId;
 private String pointName;
 private List<String> picture;
 }

Mapper.xml如下:

<resultMap id="CheckRecordResultMap" type="cn.test.user.pojo.vo.CheckRecordVO">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="point_id" jdbcType="BIGINT" property="pointId" />
    <result column="point_name" jdbcType="VARCHAR" property="pointName" />
    <collection property="picture" resultMap="pictureList"/>
  </resultMap>
  <resultMap id="pictureList" type="java.lang.String">
    <result column="url"/>
  </resultMap>
  <select id="selectCheckRecord" resultMap="CheckRecordResultMap">
     select  cr.id, cr.point_id, cp.point_name,i.url
     from check_record cr
     left join check_point cp on cp.point_id = cr.point_id
     left join check_record_image cri on cri.check_record_id = cr.id
     left join image i on i.id = cri.image_id
     where cr.id = #{id}
 </select>

以上是我的解决方案;
总结一下就是collection的用法,在这里插入图片描述

  • 5
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值