mybatis 传入对象 对象包含两个list属性

 在入参对象中定义了 tradeDirections 和 ids 两个list;

调用该方法。入参为对象

 分别以tradeDirections 和 ids作为查询条件

    <select id="listByTradeDicDate" parameterType="com.win.dfbp.biz.outside.other.pledgedrepo.vo.request.RepoConstructionListReqVO"
            resultType="com.win.dfbp.biz.outside.other.pledgedrepo.entity.BooRepoContractInstruction">
        SELECT <include refid="Base_Column_List"/>
        FROM boo_repo_contract_instruction
        WHERE delete_flag = '0'
        <if test='null != tradeDirections and tradeDirections.size() > 0'>
            AND trade_direction IN
            <foreach collection="tradeDirections" item="item" index="index" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
        <if test='null != ids and ids.size() > 0'>
            AND id IN
            <foreach collection="ids" item="item" index="index" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
    </select>

如果出现了The expression 'xxx' evaluated to a null value  这样的错误。解决方法如下:

1.查看if test 语句是否正确,注意 if test= '  '  后面跟的是单引号, 如果是if test = "   " 则不会生效,导致该判断list是否为空失败。从而出现错误。

2.确定入参类型 ,如上,我的入参类型 parameterType 后面是对象的引用。

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值