2017-02-13 29 views
0

時運行下面的代碼:實體發現與選擇場給出錯誤味精

<entity-find entity-name="mantle.order.OrderHeaderPartFacilityStatus" list="orderPartList"> 
       <econdition field-name="facilityId" from = "facilityId"/> 
       <econdition field-name="statusId" operator="in" value="OrderPlaced,"/> 

       <!-- <select-field field-name="orderId, "/> --> 
       <!-- <select-field field-name="orderName"/> --> 
       <!-- <select-field field-name="placedDate"/> --> 
       <!-- <select-field field-name="grandTotal"/> --> 
       <!-- <select-field field-name="orderPartSeqId"/> --> 
       <!-- <select-field field-name="facilityId"/> --> 
       <!-- <select-field field-name="facilityName"/> --> 
       <!-- <select-field field-name="partStatusId"/> --> 
       <!-- <order-by field-name="orderPartSeqId"/> --> 
     </entity-find> 

我:

"orderPartList": [ 
    { 
     "enteredByPartyId": null, 
     "salesChannelEnumId": null, 
     "recurrenceInfoId": null, 
     "customerRoleTypeId": "Manager", 
     "billingAccountId": null, 
     "placedDate": "2016-01-01T00:00:00+0000", 
     "telecomContactMechId": null, 
     "postalContactMechId": null, 
     "vendorRoleTypeId": null, 
     "visitId": null, 
     "lastOrderedDate": null, 
     "remainingSubTotal": null, 
     "trackingNumber": null, 
     "otherPartyOrderId": null, 
     "statusId": "OrderPlaced", 
     "giftMessage": null, 
     "entryDate": null, 
     "shippingInstructions": null, 
     "autoCancelDate": null, 
     "estimatedDeliveryDate": null, 
     "customerPartyId": "EX_JOHN_DOE", 
     "validThruDate": null, 
     "carrierPartyId": null, 
     "partTotal": 5.1E+2, 
     "facilityId": "FWorkshopnanneihuan", 
     "syncStatusId": null, 
     "estimatedShipDate": null, 
     "validFromDate": null, 
     "estimatedPickUpDate": null, 
     "externalRevision": null, 
     "orderPartSeqId": "01", 
     "terminalId": null, 
     "shipmentMethodEnumId": null, 
     "shipBeforeDate": null, 
     "parentOrderId": null, 
     "isGift": null, 
     "productStoreId": null, 
     "orderRevision": 26, 
     "dontCancelSetDate": null, 
     "pseudoId": "FWorkshopnanneihuan", 
     "dontCancelSetUserId": null, 
     "systemMessageRemoteId": null, 
     "maySplit": null, 
     "externalId": null, 
     "parentPartSeqId": null, 
     "facilityName": "\u5357\u5185\u73af\u8f66\u95f4", 
     "orderId": "FOJohndoePassat", 
     "vendorPartyId": null, 
     "shipAfterDate": null, 
     "currencyUomId": null, 
     "orderName": "John_doe order 1", 
     "grandTotal": 5.1E+2, 
     "partStatusId": "OrderOpen", 
     "partName": "\u7b2c\u4e00\u90e8\u5206 John doe", 
     "statusDescription": "Placed" 
    } 
], 

但是,當我註釋掉選擇字段標籤,如下:

<entity-find entity-name="mantle.order.OrderHeaderPartFacilityStatus" list="orderPartList"> 
       <econdition field-name="facilityId" from = "facilityId"/> 
       <econdition field-name="statusId" operator="in" value="OrderPlaced,"/> 

       <select-field field-name="orderId, "/> 
       <!-- <select-field field-name="orderName"/> --> 
       <!-- <select-field field-name="placedDate"/> --> 
       <!-- <select-field field-name="grandTotal"/> --> 
       <!-- <select-field field-name="orderPartSeqId"/> --> 
       <!-- <select-field field-name="facilityId"/> --> 
       <!-- <select-field field-name="facilityName"/> --> 
       <!-- <select-field field-name="partStatusId"/> --> 
       <!-- <order-by field-name="orderPartSeqId"/> --> 
     </entity-find> 

然後我得到了以下錯誤味精,這可能表明,選擇SQL不工作:

{"errorCode":500,"errors":"java.lang.IllegalArgumentException: Maps with null keys can't be converted to JSON"} 

有什麼問題嗎? 我正在使用自定義數據運行MoquiDemo-2.0.0。 這可能是一個錯誤或什麼?有人有線索?

回答

0

字段名稱「orderId」無效。逗號用於分隔多個字段名稱,以便將其轉換爲「orderId」和「」的列表,而空字符串不是有效的字段名稱。

類似地,在您對statusId的條件中,@value屬性最後有一個逗號。如果您試圖包含空statusId的記錄,請使用條件。@或-null屬性。對於更有效的查詢,如果這不是您正在查找的內容,請刪除逗號並使用equals運算符(這是默認值,因此您不需要運算符屬性)。

一般來說,這段代碼是草率的。 Moqui試圖容忍有趣的事情並盡力而爲,但無效的字段名稱等仍然無效,你會得到錯誤。您也可能在服務器端日誌中出現更多錯誤或警告,如果某些內容不正常,通常會首先查看這些錯誤或警告。

+0

謝謝你的評論。我使用逗號來提醒我將爲值元組添加更多值。我認爲Moqui會擺脫元組中的空白元素。沒有擺脫空白是相當可觀的,因爲有時人們需要空白作爲有效的價值。正如你所說,我擺脫了逗號,返回值是獲取所有其他字段與空值設置除選定的字段。它是否應該只提取被選擇的字段的值,並只顯示被選中的字段? – jizhi