freemarker在xml文件中遍历list数据


delete
   from pub_channelpackage
   where channelcode = :channelcode
   and channeltype = :channeltype
   <#if packids?exists && packids??>
    and packid in (
          <#list packids as packageId>
     ${packageId}<#if packageId_has_next>,</#if>
    </#list>)
   </#if>

1.<#if packids?exists && packids??>:表示存在packids对象,并且对象的个数不为0;

2.<#list packids as packageId>:表示list中的成员变量为packageId;

3.<#if packageId_has_next>,</#if>:表示如果循环结束,则不加",".如果不加后面有会多一个",".

或者直接

packid in (:packids)

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM