Sid*_*ddP 5 java sql ibatis mybatis
这就是我想要的
<update id='stoIncrement' parameterType='java.util.Map'>
update DB set
<if test="#{is_increase} == 1">
count=(select max(count) from DB) +1
</if>
<if test="#{is_increase} == 0">
count=(select max(count) from DB) -1
</if>
where store=#{store}
</update>
Run Code Online (Sandbox Code Playgroud)
这里is_increase是参数映射的键,不是表的实体。
但以上似乎不起作用。有人可以在这方面提供帮助吗?
谢谢
使用这样的集合:
<update id='stoIncrement' parameterType='java.util.Map'>
update DB
<set>
<if test="is_increase !=null and is_increase == 1">
count=(select max(count) from DB) +1 ,
</if>
<if test="is_increase !=null and is_increase == 0">
count=(select max(count) from DB) -1 ,
</if>
</set>
where store=#{store}
</update>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
24965 次 |
| 最近记录: |