<!--传递参数为字符串approveStatus =“通过,不通过” item为遍历后的参数1,2,3,4--> <if test="approveStatus != null and approveStatus!=''"> and i.approve_status IN <foreach item="status" collection="approveStatus.split(',')" open="(" separator="," close=")"> #{status} </foreach> </if> <!--传递参数为集合approveStatusList,集合中包含对象user ,approveStatusList={user1,user2 } --> <if test="approveStatusList!= null and approveStatusList.size>0 "> AND operate_user in <foreach collection="approveStatusList" open="(" close=")" separator="," item="user" index="index"> #{user.userName} </foreach> </if> <!--传递参数为数组approveStatus =[通过,不通过] 此时collection必须为array item为传递的数组参数,且参数名要保持一致--> <if test="approveStatus != null and approveStatus!=''"> and i.approve_status IN <foreach item="approveStatus" collection="array" open="(" separator="," close=")"> #{approveStatus} </foreach> </if>
关注"都市百货" 了解南陵
微信咨询wanglf2r(不拉群 发广告者勿加)
热门评论