无效空串判断
- Java 中的 BigDecimal 是
0
(零)的话会给判定为空串,很坑。 - Java 中的 Integer 是
0
(零)好像也是会的。 - 所以
不建议加上判断空串
(因为有点无意义
)
<select id="findProduct">
select
product_name
from
product
<if test="price != null and price != '' ">
where product_price = #{price}
</if>
</select>