1.mybatis更新一条数据时,如果某字段为空,则不更新它,使用默认值?

<update id="updateProduct" parameterType="Product" >
update product_
<set>
<if test="name != null">name=#{name},</if>
<if test="price != null">price=#{price}</if>
</set>
where id=#{id}
</update>

2.mybatis如何插入一个list类型的记录?

<insert id="addItem" parameterType="java.util.List">
insert into product_ ( id, itemName, number, remark )
values
        <foreach collection="list" item="item" index= "index" separator =",">
            ( #{item.id}, #{item.itemName}, #{item.number}, #{item.remark} )
        </foreach>
</insert>

SpringBoot 异步编程实战

如果我们需要在 SpringBoot 实现异步编程的话,通过 Spring 提供的两个注解会让这件事情变的非常简单。

  1. @EnableAsync:通过在配置类或者Main类上加@EnableAsync开启对异步方法的支持。
  2. @Async 可以作用在类上或者方法上,作用在类上代表这个类的所有方法都是异步方法。

1. 自定义 TaskExecutor

很多人对于 TaskExecutor 不是太了解,所以我们花一点篇幅先介绍一下这个东西。从名字就能看出它是任务的执行者,它领导执行着线程来处理任务,就像司令官一样,而我们的线程就好比一只只军队一样,这些军队可以异步对敌人进行打击

最新文章

  1. Struts2 JSON
  2. spark reduce类操作
  3. EPANET能做什么,不能做什么
  4. Perl 模块 Getopt::Std 和 Getopt::Long
  5. Ext.Net学习笔记15:Ext.Net GridPanel 汇总(Summary)用法
  6. layer.js子窗口关闭并传数据到父窗的方法
  7. Android和FTP服务器交互,上传下载文件(实例demo)
  8. AngularJs directive &#39;transclude&#39; option 详解
  9. Lottie安卓开源动画库使用
  10. 用Visual Studio2017写静态库
  11. Excel 若某列包含某个字符则特定列显示特定字符
  12. webpackJsonp is not defined
  13. LeetCode之“排序”:Largest Number
  14. 英语口语练习系列-C13-聚会
  15. CSS3无前缀脚本prefixfree.js与Animatable使用介绍
  16. 构建RequestDelegate管道
  17. JS 中div内容的显示和隐藏
  18. Linux 的字符串截取
  19. Android中如何判断升级用户
  20. 学习《深入理解C#》—— 可空类型、可选参数和默认值 (第一章1.3)

热门文章

  1. 洛谷 P1076 寻宝 题解
  2. Chrome安装.crx文件
  3. 历年NOIP回顾
  4. 【转】harbor仓库高可用集群部署说明
  5. SpringBoot JPA懒加载异常 - com.fasterxml.jackson.databind.JsonMappingException: could not initialize proxy
  6. ElasticSearch java客户端更新时出现的错误:NoNodeAvailableException[None of the configured nodes are available
  7. maven引入第三方jar包
  8. hadoop2.9.2 调整jvm
  9. Alpha项目冲刺! Day5-产出
  10. c++比例-libcurl多线程并发时的core【转载】