The error information is as follows:
Caused by: org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.lang.UnsupportedOperationException
Exception root: resulttype returns the element type in the collection, not the collection itself
The code is as follows:
<!--Check detailed order information-->
<resultMap id="orderDetailMap" type="com.alibaba.fastjson.JSONArray">
<result column="order_code" property="orderCode"/>
<result column="state" property="state"/>
<result column="address" property="address"/>
<result column="received_telephone" property="receivedTelephone"/>
<result column="send_linkman" property="sendLinkman"/>
<result column="send_telephone" property="sendTelephone"/>
<result column="delivery_time" property="deliveryTime"/>
<result column="delivery_time_quantum" property="deliveryTimeQuantum"/>
<result column="greeting_card" property="greetingCard"/>
<result column="show_pay_name" property="showPayName"/>
<result column="pay_time" property="payTime"/>
<result column="order_total_amount" property="orderTotalAmount"/>
<result column="is_invoice" property="isInvoice"/>
<result column="settled_amount" property="settledAmount"/>
<result column="delivery_money" property="deliveryMoney"/>
<collection property="goods" column="order_code" ofType="com.alibaba.fastjson.JSONObject" javaType="List" select="findOrderChildDetail">
<result column="item_sku_code" property="itemSkuCode"/>
<result column="sku_title" property="skuTitle"/>
<result column="sale_price" property="salePrice"/>
<result column="buy_cnt" property="buyCnt"/>
<result column="totalPrice" property="totalPrice"/>
</collection>
</resultMap>
<select id="queryOrderDetail" parameterType="Map" resultMap="orderDetailMap">
SELECT
order_code,
state,
received_linkman,
CONCAT(received_address_area,received_address_desc) AS 'address',
received_telephone,
send_linkman,
send_telephone,
delivery_time,
delivery_time_quantum,
greeting_card,
show_pay_name,
pay_time,
order_total_amount,
is_invoice,
settled_amount,
delivery_money
FROM
order_info
WHERE
account_code = #{accountCode}
AND
order_code = #{orderCode}
LIMIT 1
</select>
<!--Check detailed order information-->
<select id="findOrderChildDetail" parameterType="String" resultType="com.alibaba.fastjson.JSONObject">
SELECT
item_sku_code ,
sku_title ,
sale_price ,
buy_cnt ,
sale_price * buy_cnt AS totalPrice
FROM
order_detail
WHERE
order_code = #{orderCode}
</select>
Error reason:
<resultMap id="orderDetailMap" type="com.alibaba.fastjson.JSONArray">
The JSONArray type in the error, modified to
<resultMap id="orderDetailMap" type="com.alibaba.fastjson.JSONObject">
Note: the type here is the type used in the current development. If the object is used, check whether the type in the resultmap is a list or an object. If it is an associated subquery, modify it to an object