![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
后端学习
GravityQ
小码男
展开
-
mybatis中判断某个字段是否为null或空
MySql 里的IFNULL、NULLIF和ISNULL用法mybatis不能使用IFNULL这些函数,可以用case . . . when . . . then . . . else . . . end代替select id,is_topic_on as topicOn,topic_name as topicName,topic_recommend as topicRecommend,topic_introduction as topicIntroduction,topic_group as topi原创 2020-12-11 15:30:12 · 6223 阅读 · 0 评论 -
异步线程池中加入MDC参数
在项目中需要异步执行任务方法,但是异步执行时会使用另一个线程。因为MDC的参数时基于ThreadLocal的,每个线程都保留一份。这样就造成异步线程的日志id没有或者跟前一个日志id不一致,不便于查询日志。解决方法:自定义任务装饰器,并配置到线程池@Bean("taskExecutor") public Executor taskExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor()原创 2020-12-08 11:36:11 · 2583 阅读 · 0 评论