mybatis如何编写不为空字符串或null呢?
下文笔者讲述mybatis中if test判断空字符串及null的方法及示例分享
使用 if test "字段 !=null and 字段 !='' " 即可对字段是否为空或null进行判断例:mybatis中对字符串是否为空及null判断的示例
<sql id="public_Info">
<if test="productId != null and productId !=''" >
and a.product_id = #{productId,jdbcType=VARCHAR}
</if>
<if test="pageSize != null and pageNum !=null " >
ORDER BY a.product_id DESC limit #{pageNum},#{pageSize}
</if>
</sql>
版权声明
本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。


