mybatis-3 icon indicating copy to clipboard operation
mybatis-3 copied to clipboard

Mapper参数构造bug

Open imaxun opened this issue 2 years ago • 3 comments

<select id="queryList" resultType="com.xxx.entity.ReceivableEntity">
    select * from ims_rec_receivable
    <where>
        tenant_id = #{tenantId}
        <if test="receivableIds != null and !receivableIds.isEmpty()">
            and receivable_id in
            <foreach collection="receivableIds" open="(" separator="," close=")" item="receivableId">
                #{receivableId, jdbcType=VARCHAR}
            </foreach>
        </if>
        <if test="receivableId != null and receivableId != ''">
            and receivable_id = #{receivableId, jdbcType=VARCHAR}
        </if>
    </where>
</select>

问题描述: 当前查询参数对象的receivableId为空但是会默认以 collection="receivableIds" 中的receivableId最后一个参照

imaxun avatar Mar 23 '22 07:03 imaxun

Hello @imaxun ,

Which version do you use? We've fixed a similar issue #966 in 3.4.5. If your problem reproduces in the latest version, please provide a test case or demo project.

harawata avatar Mar 23 '22 19:03 harawata

Okay thank you

imaxun avatar Mar 24 '22 04:03 imaxun

Okay thank you

Already done? If so, Should we close this issue? @imaxun @harawata

awxiaoxian2020 avatar Apr 20 '22 03:04 awxiaoxian2020

Thanks

JohnWangXtu-111 avatar Dec 10 '22 10:12 JohnWangXtu-111

We can close, I assume.

harawata avatar Dec 10 '22 17:12 harawata