MyBatis用if过滤integer空值问题

<select id="filterProjects" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM project WHERE 1 = 1
        <if test="#{arg0} != null">
            AND pmtypeid = #{arg0}
        </if>
        <if test="#{arg1} != null and #{arg2} != null">
            AND createtime BETWEEN #{arg1} AND #{arg2}
        </if>
        <if test="#{arg3} != null">
            AND pmname LIKE "%"#{arg3}"%"
        </if>
</select>

当传入pmtypeid为空值时,没有返回的数据,但是传入pmtypeid时就会有返回数据。那么当pmtypeid为空的时候MyBatis把它默认为什么值了?

回复
阅读 2.9k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏