工作框架各种使用整理---自己处理分页

<service verb="get" noun="Products">
        <in-parameters>
            <auto-parameters entity-name="mantle.product.Product"/>
            <parameter name="pageIndex" type="Integer" default-value="0"/>
            <parameter name="pageSize" type="Integer" default-value="100"/>
            <parameter name="pageNoLimit" type="Boolean" default-value="false"/>
            <parameter name="orderByField" type="String"/>
        </in-parameters>
        <out-parameters>
            <parameter name="ProductList" type="List"><parameter name="product" type="Map">
                <auto-parameters entity-name="mantle.product.Product"/>
            </parameter></parameter>
        </out-parameters>
        <actions>
            <entity-find entity-name="mantle.product.Product" list="ProductList">
                <search-form-inputs/>
            </entity-find>
            <service-call name="zs.common.CommonServices.add#PaginateResponseHeaders" in-map="[pageIndex:pageIndex,
                pageSize:pageSize, totalCount:ProductListCount,pageMaxIndex:ProductListPageMaxIndex,
                pageRangeLow:ProductListPageRangeLow, pageRangeHigh:ProductListPageRangeHigh]"/>
        </actions>
    </service>
 1  <service verb="add" noun="PaginateResponseHeaders">
 2         <in-parameters>
 3             <parameter name="pageIndex" type="Integer" required="true"/>
 4             <parameter name="pageSize" type="Integer" required="true"/>
 5             <parameter name="totalCount" type="Integer" required="true"/>
 6             <parameter name="pageMaxIndex" type="Integer" required="true"/>
 7             <parameter name="pageRangeLow" type="Integer" required="true"/>
 8             <parameter name="pageRangeHigh" type="Integer" required="true"/>
 9         </in-parameters>
10         <actions>
11             <script>
12                 <!--// calculate the pagination values-->
13                 <!--int maxIndex = Double.valueOf((new BigDecimal(totalCount-1)).divide(new BigDecimal(pageSize), 0, BigDecimal.ROUND_DOWN).intValue())-->
14                 <!--int pageRangeLow = (pageIndex * pageSize) + 1-->
15                 <!--int pageRangeHigh = (pageIndex * pageSize) + pageSize-->
16                 <!--if (pageRangeHigh > totalCount) pageRangeHigh = totalCount-->
17 
18                 ec.web.response.addHeader("X-Page-Index", String.valueOf(pageIndex))
19                 ec.web.response.addHeader("X-Page-Size", String.valueOf(pageSize))
20                 ec.web.response.addHeader("X-Page-Max-Index", String.valueOf(pageMaxIndex))
21                 ec.web.response.addHeader("X-Page-Range-Low", String.valueOf(pageRangeLow))
22                 ec.web.response.addHeader("X-Page-Range-High", String.valueOf(pageRangeHigh))
23                 ec.web.response.addHeader("X-Total-Count", String.valueOf(totalCount))
24             </script>
25         </actions>
26     </service>

 



posted @ 2016-07-05 11:29  霓裳梦竹  阅读(200)  评论(0编辑  收藏  举报