XZhi commented on issue #5210:
URL: https://github.com/apache/shardingsphere/issues/5210#issuecomment-620452376
@kimmking hi I got the same issue, but a little difference is that the
insert into clause contains two placeholders
`#{item.receivedCount,jdbcType=INTEGER} + #{item.baseCount,jdbcType=INTEGER}`
at values segment. The code is as below:
`
<insert id="batchInsertOrUpdate" parameterType="xxx.UserTemplateStat">
INSERT INTO user_template_stat (
coupon_template_id,
user_id,
channel_code,
received_count
)
VALUES
<foreach collection="userTemplateStats" item="item" separator=",">
(
#{item.couponTemplateId,jdbcType=INTEGER},
#{item.userId,jdbcType=VARCHAR},
<choose>
<when test="item.channelCode != null">
#{item.channelCode,jdbcType=VARCHAR},
</when>
<otherwise>
'',
</otherwise>
</choose>
#{item.receivedCount,jdbcType=INTEGER} +
#{item.baseCount,jdbcType=INTEGER}
)
</foreach>
ON DUPLICATE KEY UPDATE
<trim suffixOverrides=",">
received_count = received_count + VALUES(received_count)
</trim>
</insert>
`
After the sql rewrite, there are 2 parameters(4 parameters before rewrite)
and the parameters for ` #{item.receivedCount,jdbcType=INTEGER} +
#{item.baseCount,jdbcType=INTEGER}` are parsed incorrectly. Here is debug
information for InsertValueContext, the CommonExpressonSegment is not a
ParameterMarkerExpressionSegment.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]