【MyBatis】动态SQL中的参数判空

MyBatis动态SQL中的参数判空

null:未传此参数或传的值为null

int

<if test="id != null">
	`SQL语句`
if>

String

<if test='str!= null and str != ""'>
    `SQL语句`
if>

集合类

使用size()的前提是list不为null


<if test="list!= null and list.size > 0 ">
	`SQL语句`
if>

你可能感兴趣的:(Mybatis,sql,数据库,database,mybatis,java)