• int updateByPrimaryKeySelective(TbItem record);
  • int updateByPrimaryKey(TbItem record);

上面的是逆转工程生成的Mapper接口

对应的xml为

<update id="updateByPrimaryKeySelective" parameterType="com.taotao.pojo.TbItem">
update tb_item
<set>
<if test="title != null">
title = #{title,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.taotao.pojo.TbItem">
update tb_item
set title = #{title,jdbcType=VARCHAR},
where id = #{id,jdbcType=BIGINT}
</update>

updateByPrimaryKeySelective会对字段进行判断再更新(如果为Null就忽略更新),如果你只想更新某一字段,可以用这个方法。

updateByPrimaryKey对你注入的字段全部更新

最新文章

  1. CPPFormatLibary提升效率的优化原理
  2. TCP和UDP之间的区别和联系
  3. Hibernate前置和后置方法
  4. iOS 关于僵尸对象和僵尸指针的那些事儿
  5. struts2验证框架
  6. flexbox in IE (10+ and 9 and 8)
  7. 【转载】Redis多实例及分区
  8. HTML第六天学习笔记
  9. SimpleDateFormat的线程安全问题
  10. [转] HTML中调用JavaScript的几种情况和规范写法
  11. Y5V贴片电容(MLCC)容量范围速查表
  12. sql语句判断两个时间段是否有交集
  13. a java runtime environment(JRE) or java development kit(JDK) must be....
  14. 老李谈HTTP1.1的长连接 1
  15. ●codeforces 553E Kyoya and Train
  16. Python强大的可变参数传递机制
  17. Python档案袋( 面向对象 )
  18. 25. Reverse Nodes in k-Group (JAVA)
  19. Java中常用的加密算法小结
  20. 设计模式学习心得&lt;抽象工厂模式 Abstract Factory&gt;

热门文章

  1. thinkphp中怎么判断是手机端访问还是pc端访问?
  2. &lt;Android 基础(九)&gt; Ndk配置与Demo
  3. 一步步理解typedef
  4. Windows server 2008 sp2 X64安装sharepoint2007出现兼容性问题无法安装 解决办法
  5. Tomcat 中部署 web 应用 ---- Dubbo 服务消费者 Web 应用 war 包的部署
  6. 通过CSS3实现:鼠标悬停图片360度旋转效果
  7. May 7th 2017 Week 19th Sunday
  8. SQL的注入式攻击方式和避免方法
  9. InnoDB多版本(MVCC)实现简要分析
  10. 是否应该提供一个dao.insertIgnoreNull ? (像updateIgnoreNull一样)