2017-02-13 40 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