展开
拓展 关闭
订阅号推广码
GitHub
视频
公告栏 关闭

Mybatis Plus传入参数0不起作用

  • 错误还原:在查询的过程中,传入的workType为0时,该条件不起作用
    <select id="xxx">
        SELECT di.id, di.name, di.work_type, di.updated...
        <where>
            <if test="name != null and name != ''">
                and di.name like concat('%',#{name},'%')
            </if>
            <if test="Id != null and Id != ''">
                and di.id = #{Id}
            </if>
            <if test="workType != null and workType != ''">
                and di.work_type = #{workType}
            </if>
        </where>
        order by di.updated desc
    </select>
  • 解决方案,修改为如下
<if test="workType != null">
    and di.work_type = #{workType}
</if>
posted @ 2023-04-20 20:35  DogLeftover  阅读(175)  评论(0编辑  收藏  举报