我在 myBatis 映射器中编写了一个简单的选择:
<select id="listAllOrders" parameterType="java.util.HashMap" resultMap="commonMaps.detailedOrderResultMap">
select
<include refid="commonSql.fragmentOrderFields" />,
<include refid="commonSql.fragmentSummaryPriceInfoFields" />
from graorder order
left outer join grasummarypriceinfo summarypriceinfo on order.totalPrice_id = summarypriceinfo.id
<if test="userGroupId != null">
where order.userGroupId = #{userGroupId}
</if>
order by order_lastUpdated desc
<if test="limit != null">
limit #{limit}
</if>
</select>
运行此查询时的抱怨是:
### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntax
ErrorException: You have an error in your SQL syntax; check the manual that corr
esponds to your MySQL server version for the right syntax to use near 'left oute
r join grasummarypriceinfo summarypriceinfo on order.totalPrice_id = su' at line
33
我简直气馁。我的选择中看不到任何错误...
你有什么线索吗?