fantacy2001 opened a new issue #6753: URL: https://github.com/apache/shardingsphere/issues/6753
mybatis mapper sql
`<update id="updateByStockFreezeDetailList">
update stock_freeze_detail
<trim prefix="set" suffixOverrides=",">
<trim prefix="row_status=case" suffix="end,">
<foreach collection="list" index="index"
item="item">
WHEN (id=#{item.id})
THEN #{item.rowStatus}
</foreach>
</trim>
<trim prefix="update_user=case" suffix="end,">
<foreach collection="list"
index="index" item="item">
WHEN (id=#{item.id})
THEN #{item.updateUser}
</foreach>
</trim>
<trim prefix="update_time=case" suffix="end,">
<foreach collection="list"
index="index" item="item">
WHEN (id=#{item.id})
THEN #{item.updateTime}
</foreach>
</trim>
</trim>
<trim prefix="where" prefixOverrides="AND | OR" >
and tenant_id = #{tenantId,jdbcType=VARCHAR}
and id in
<foreach collection="list" open="(" close=")"
item="item" separator=",">
#{item.id}
</foreach>
</trim>
</update>`
Logic SQL: update stock_freeze_detail
set row_status=case WHEN (id=?)
THEN ?
WHEN (id=?)
THEN ?
WHEN (id=?)
THEN ? end,
update_user=case WHEN (id=?)
THEN ?
WHEN (id=?)
THEN ?
WHEN (id=?)
THEN ? end,
update_time=case WHEN (id=?)
THEN ?
WHEN (id=?)
THEN ?
WHEN (id=?)
THEN ? end
where tenant_id = ?
and id in
(
?
,
?
,
?
)
Actual SQL: ds_0 ::: update stock_freeze_detail
set row_status=case WHEN (id=?)
THEN ?
WHEN (id=?)
THEN ?
WHEN (id=?)
THEN ? end,
update_user=case WHEN (id=?)
THEN ?
WHEN (id=?)
THEN ?
WHEN (id=?)
THEN ? end,
update_time=case WHEN (id=?)
THEN ?
WHEN (id=?)
THEN ?
WHEN (id=?)
THEN ? end
where tenant_id = ?
and id in
(
?
,
?
,
?
) ::: [3, 2, 4, 2, 10, 2, 3, ll, 4, ll, 10, ll, 3,
2020-08-10T17:15:25.979+0800, 4, 2020-08-10T17:15:25.979+0800, 10,
2020-08-10T17:15:25.979+0800, jd, 3, 4, 10]
sharding column : tenant_id
sharding sphere vesion : 4.1.1
shardingjdbc searches for the sharding value, sorts according to the field
in the where condition, and takes the array subscript. so the value of
tenant_id has be finded is '3' , the parameterMarkerIndex is 0
----------------------------------------------------------------
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]
