运行以下代码时:
<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"
}
],
但是当我取消注释select-field标记时,如下所示:
<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>
然后我收到以下错误消息,这可能表明select sql无法正常工作:
{"errorCode":500,"errors":"java.lang.IllegalArgumentException: Maps with null keys can't be converted to JSON"}
出了什么问题? 我正在使用自定义数据运行MoquiDemo-2.0.0。 它可能是一个bug还是什么?有人有线索吗?
答案 0 :(得分:0)
字段名称&#34; orderId,&#34;无效。逗号用于分隔多个字段名称,因此它将其转换为&#34; orderId&#34;和&#34;&#34;,并且空字符串不是有效的字段名称。
同样在您对statusId的处理中,@ value属性在结尾处有逗号。如果您尝试包含null statusId的记录,请使用econdition。@ or-null属性。要获得更有效的查询,如果不是您要查找的内容,请删除逗号并使用等号运算符(这是默认设置,因此您不需要运算符属性)。
一般来说,这段代码很草率。 Moqui试图容忍有趣的事情并尽力而为,但是无效的字段名称仍然无效,你会得到错误。您可能在服务器端日志中有更多错误或警告,这通常是第一个查看某些内容是否正常工作的地方。