druid-spring-boot-starter版本号:1.1.22 com.alibaba.druid.sql.parser.ParserException: syntax error, expect RPAREN, actual COLONCOLON commodity_sku_price at com.alibaba.druid.sql.parser.SQLExprParser.accept(SQLExprParser.java:1657) at com.alibaba.druid.sql.parser.SQLExprParser.methodRest(SQLExprParser.java:811) at com.alibaba.druid.sql.parser.SQLExprParser.primaryRest(SQLExprParser.java:776) at com.alibaba.druid.sql.dialect.postgresql.parser.PGExprParser.primaryRest(PGExprParser.java:238) at com.alibaba.druid.sql.parser.SQLExprParser.parseSelectItem(SQLExprParser.java:1949) at com.alibaba.druid.sql.parser.SQLSelectParser.parseSelectList(SQLSelectParser.java:359) at com.alibaba.druid.sql.dialect.postgresql.parser.PGSelectParser.query(PGSelectParser.java:107)
[alibaba/druid]Sql在服务端能正常执行但druid抛出异常
回答
能否把完整的SQL语句粘贴到这里?
能否把完整的SQL语句粘贴到这里?
稍等哈
select count() FROM (select MAX(sub_order.stadium_id) stadium_id, sub_order.commodity_sku_id commodity_sku_id, MAX(sub_order.commodity_sku_title) commodity_sku_name, MAX(sub_order.commodity_product_type) order_type, SUM(sub_order.commodity_sku_amount) amount, SUM(sub_order.commodity_sku_price sub_order.commodity_sku_amount)/SUM(sub_order.commodity_sku_amount) unit_price, SUM(sub_order.commodity_sku_price sub_order.commodity_sku_amount) receivable_payment, SUM(case when (sub_order.commodity_sku_price sub_order.commodity_sku_amount - sub_order.discount) > 0 then (sub_order.commodity_sku_price * sub_order.commodity_sku_amount - sub_order.discount) else 0 end) merchant_discount, SUM(sub_order.payment) + sum(0) turnover_revenue, 0 as membership_card_discount, SUM(sub_order.payment) payment, 0 as compensation, SUM(sub_order.payment)/SUM(sub_order.commodity_sku_amount) capitation_price from gs_order_sub_order sub_order
and sub_order.refund_status != 1 AND sub_order.stadium_id = #{request.stadiumId} AND sub_order.gmt_create = ]]> TO_TIMESTAMP(#{startTime}) AND sub_order.gmt_create TO_TIMESTAMP(#{endTime}) and sub_order.commodity_product_type in #{item.value} GROUP BY sub_order.commodity_sku_id
) rst1
left JOIN
(
SELECT
pay_origin.commodity_sku_id,
SUM(case WHEN pay_origin.pay_meth = 'pay1' THEN pay_origin.turnover_revenue else 0 end) alipay_code_amount,
SUM(case WHEN pay_origin.pay_meth = 'pay2' THEN pay_origin.turnover_revenue else 0 end) wechat_code_amount,
SUM(case WHEN pay_origin.pay_meth = 'pay3' THEN pay_origin.turnover_revenue else 0 end) cash_amount,
SUM(case WHEN pay_origin.pay_meth = 'pay4' THEN pay_origin.turnover_revenue else 0 end) alipay_online_amount,
SUM(case WHEN pay_origin.pay_meth = 'pay5' THEN pay_origin.turnover_revenue else 0 end) payafter_amount,
SUM(case WHEN pay_origin.pay_meth = 'pay6' THEN pay_origin.turnover_revenue else 0 end) store_value_card_amount,
SUM(case WHEN pay_origin.pay_meth = 'pay7' THEN pay_origin.turnover_revenue else 0 end) other_amount
FROM
(
select
sub_order.commodity_sku_id commodity_sku_id,
SUM(sub_order.payment) + sum(0) turnover_revenue,
(case WHEN charge.payment_method = 1 and charge.platform = 1 THEN 'pay1'
WHEN charge.payment_method = 1 and charge.platform = 2 THEN 'pay2'
WHEN charge.payment_method = 2 THEN 'pay3'
WHEN charge.payment_method = 3 THEN 'pay4'
WHEN charge.payment_method = 4 THEN 'pay5'
WHEN charge.payment_method = 5 THEN 'pay6'
ELSE 'pay7' END) pay_meth
FROM gs_order_sub_order sub_order
left JOIN gs_order_charge charge on sub_order.order_id = charge.order_id
group by sub_order.commodity_sku_id, pay_meth
) pay_origin
GROUP by pay_origin.commodity_sku_id
) rst2 on rst1.commodity_sku_id = rst2.commodity_sku_id
left join gs_stadium stadium on rst1.stadium_id = stadium.id