merge into table a
using (select #{nsrsbh} lrfsh,
<choose>
<when test="ywlx=='SR'">
#{spfnsrsbh} nsrsbh,
</when>
<otherwise>
#{kpfnsrsbh} nsrsbh,
</otherwise>
</choose>
#{dfyh} khyh, #{dfyhzh} yhzh
from dual) c on (a.nsrsbh = c.nsrsbh
and a.khyh = c.khyh and a.lrfsh=lrfsh)
when not matched then
insert (pzbh, nsrsbh, khyh, yhzh,lrfsh) values (#{uuidxh},
<choose>
<when test="ywlx=='SR'">
#{spfnsrsbh},
</when>
<otherwise>
#{kpfnsrsbh},
</otherwise>
</choose>
#{dfyh}, #{dfyhzh},#{nsrsbh})
WHEN MATCHED THEN
UPDATE SET YHZH = #{dfyhzh}
mybatis 未匹配到数据进行新增,存在即修改
最新推荐文章于 2023-09-13 17:22:45 发布