<service verb="get" noun="Products"> <implements service="sang.product.ProductServices.get#ProductsWithPagination"/> <in-parameters> <parameter name="productCategoryId" required="true"/> <parameter name="geoId" required="true"/> <parameter name="level" type="Integer" default-value="1"/> </in-parameters> <actions> <set field="cacheKeyName" from="productCategoryId + ‘_‘ + level + ‘_‘ + geoId + ‘_‘ + pageIndex + ‘_‘ + pageSize + ‘_‘ + pageNoLimit + ‘_‘ + orderByField"/> <script> def categoryGeoProductCache = ec.cache.getCache(‘Product_List_By_Category_Geo‘) productList = (List) categoryGeoProductCache.get(cacheKeyName) </script> <if condition="productList != null"><return/></if> <service-call name="sang.moqui.extend.BasicServices.get#ChildGeoIds" in-map="[ geoId: geoId, level: 20 ]" out-map="context"/> <set field="geoIds" from="geoIds + [geoId]"/> <service-call name="sang.product.CategoryServices.get#ChildProductCategoryIds" out-map="context" in-map="[ productCategoryId: productCategoryId, level: level ]"/> <set field="paginateMap" from="[pageIndex: pageIndex, pageSize: pageSize, pageNoLimit: pageNoLimit, orderByField: orderByField]"/> <entity-find entity-name="sang.product.ProductAndCategoryAndGeo" list="pList" distinct="true" cache="true"> <search-form-inputs input-fields-map="paginateMap"/> <date-filter/> <econdition field-name="statusId" value="ProductOnShelf"/> <econdition field-name="geoId" operator="in" from="geoIds"/> <econdition field-name="productCategoryId" operator="in" from="productCategoryIds"/> <select-field field-name="productId"/> </entity-find> <service-call name="sang.product.ProductServices.get#ProductsByIds" in-map="[productIds: pList.productId]" out-map="context"/> <service-call name="sang.common.CommonServices.add#PaginateResponseHeaders" in-map="[ pageIndex: pageIndex, pageSize: pageSize, totalCount: pListCount, pageMaxIndex: pListPageMaxIndex, pageRangeLow: pListPageRangeLow, pageRangeHigh: pListPageRangeHigh ]"/> <script> categoryGeoProductCache.put(cacheKeyName, productList) </script> </actions> </service>
时间: 2024-10-11 11:36:28