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