相关文章推荐
儒雅的炒饭  ·  让 Spyder ...·  1 年前    · 
彷徨的铁链  ·  Unknown custom ...·  1 年前    · 
安静的春卷  ·  Java抽象(abstract)类·  2 年前    · 
	<if test="status != null and status.size()>0" >
      and s.orderstatus in 
      <foreach collection="status" item="listItem" open="(" close=")" separator="," >
        #{listItem}
      </foreach>

建议对特殊字符进行处理

	<if test="status != null and status.size() &gt; 0" >
      and s.orderstatus in 
      <foreach collection="status" item="listItem" open="(" close=")" separator="," >
        #{listItem}
      </foreach>
                                    &lt;if test="null != staffCodeList and staffCodeList.size &gt; 0"&gt;and gui.USER_CODE not in&lt;foreach collection="staffCodeList" item="staffCode" open="(" separator=","  close=")&quo
                                    今天做项目突然在mybatis的配置文件中使用到了list作为参数,发现判断list的长度时报了错,才发现应该使用size()方法。记录一下希望你们能解决遇到的问题。
                                    在mybtis 的xml文件中判断集合大小有两种写法,说是两种其实也可以说是一种.
1.list.siez() 方法
 <if test="term.list!=null and term.list.size()>0 ">
            value in <foreach item="id" index="index" collection="term.list"      open="("  separator="," close=")"> #{id} </f
在mapper.xml中用if test 判断此集合是否为的写法如下:
<if test="costsIds != null and costsIds.size()!=0 ">
            and  standard_costs_id in
            <foreach item="item" collection="costsIds" separator="," open="(" close=")">
<if test="list!= null and list.size()>0" >
      and s.orderstatus in 
      <foreach collection="list" item="item" open="(" close=")" separator="," >
        #{item}
      </foreach>