MyBatis中传递数组和list时if-test判空和判断长度的写法

xml:

<if test="state != null and state.size > 0">
      AND t.state IN
      <foreach item="state" index="index" collection="state" open="(" separator="," close=")">
        #{state}
      foreach>
if>

array数组:

<if test="array != null and array.length >0">

list集合:

<if test="list != null and list.size() > 0">

你可能感兴趣的:(java)