mybatis-plush存在则更新

mybatis-plush存在则更新

示例:
@Insert(“INSERT INTO 数据库名字.表名( id, name, setup, cut_before, cut_after, bar, type, cutter, perrow, offsetx, offsety, offset2x, offset2y, offset3x, offset3y) " +
" VALUES ( #{bartemplate.id}, #{bartemplate.name}, #{bartemplate.setup}, #{bartemplate.cutBefore},#{bartemplate.cutAfter}, #{bartemplate.bar}, #{bartemplate.type}, #{bartemplate.cutter}, #{bartemplate.perrow}, #{bartemplate.offsetx}, #{bartemplate.offsety}, #{bartemplate.offset2x}, #{bartemplate.offset2y}, #{bartemplate.offset3x}, #{bartemplate.offset3y}) " +
" on duplicate key update " +
“template_setup = values(setup),cut_before = values(cut_before),cut_after = values(cut_after),” +
" templatebar = values(templatebar),type = values(type),enable_cutter = values(cutter),” +
“perrow = values(perrow),offsetx = values(offsetx),offsety = values(offsety),” +
“offset2x = values(offset2x),offset2y = values(offset2y),offset3x = values(offset3x),offset3y = values(offset3y)”)
int saveOrUpdate(@Param(“bartemplate”) AfOrganizeBartemplate bartemplate);

on duplicate key update 后面的是存在重复,违反了这个主键或者唯一键,那么就更新,以及更新的字段

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值