1. 程式人生 > >freemarker頁面判斷重複值不輸出

freemarker頁面判斷重複值不輸出

freemarker  介面  table 迴圈的時候判斷是否有重複值出現,如果有不輸出繼續下次迴圈,寫套餐明細用到;

<td >  <#if (item.itemGroupAccounts?size >0)>

                             <#list item.itemGroupAccounts as account> 

//如果迴圈下標是第一個給i賦值等於名稱

                                        <#if account_index == 0>

<#assign i =account.accountName >
  </#if>
<#if(account.dataSource=171)>
<div>${account.accountName!''}:&nbsp;&nbsp; 
${account.amount!''}元</div> 

<#else>

                                                                        //如果名稱相等就把名稱賦值給i(賦不賦值都相等)

<#if (account.accountName=i)>
<#assign i =account.accountName >

<#else>

                                                                                    //不相等輸出名字,把名字賦值給i

${account.accountName!''}:
<#assign i =account.accountName >
</#if>
<div>${account.name!''}&nbsp;&nbsp; &nbsp;
${account.qty!''}次*${account.unitPrice!''}元=${account.amount!''}元</div>

</#if> 

                                                </#list> 

                                </#if> 

                                        <span onclick="editItems('${item.id}')">編輯明細</span>

</td>
<td>
<spanclass="modify-icon" onClick="editItem('${item.id!''}','${item.name!''}')">    </span>
                            <span class="delete-icon" onclick="remove(${item.id})"></span>
</td>
   </tr>
           </#list>
         </#if>

      C場景:                                     當然我在後臺已經按照名稱排好序列了;