问题-MyBatis不识别Integer值为0的数据

问题:使用MyBatis的过程中,发现一个值为0的数据,Mybatis所识别,最后定位才发现,是自己的写法有问题,

    <if test="form.passLine != null and  form.passLine != '' ">
        and is_live =  #{form.passLine,jdbcType=INTEGER}
    </if>
更正成:

   <span style="color:#FF0000;"> <if test="form.passLine != null and  form.passLine != -1 ">
        and is_live =  #{form.passLine,jdbcType=INTEGER}
    </if></span>
完美解决。


以下是代码:

  <select id="countPageByParam" resultType="java.lang.Long">
    select count(id)
    from lms_teacher_info
    where 1=1
    and city_id = #{form.cityId,jdbcType=VARCHAR}
    AND update_time =  #{updateTime,jdbcType=VARCHAR}
    <if test="form.period != null and form.period != '' ">
      and period_fourweek_start = #{form.period,jdbcType=VARCHAR}
    </if>
    <if test="form.schoolId != null and form.schoolId != '' ">
      and school_id = #{form.schoolId,jdbcType=VARCHAR}
    </if>
   <span style="color:#FF0000;"> <if test="form.passLine != null and  form.passLine != -1 ">
        and is_live =  #{form.passLine,jdbcType=INTEGER}
    </if></span>
    <if test="form.streetId != null and form.streetId != '' ">
      and street_id = #{form.streetId,jdbcType=VARCHAR}
    </if>
    <if test="form.districtId != null and form.districtId != '' ">
      and district_id LIKE CONCAT( #{form.districtId,jdbcType=VARCHAR} , '%')
    </if>
    <if test="form.keyword != null and form.keyword !='' ">
      and (
      teacher_name LIKE CONCAT( #{form.keyword,jdbcType=VARCHAR} , '%')
      or teacher_id = #{form.keyword,jdbcType=VARCHAR}
      )
    </if>
  </select>


阅读更多
文章标签: MyBatis
个人分类: 数据库 问题解决
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

不良信息举报

问题-MyBatis不识别Integer值为0的数据

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭