惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Security Affairs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Jina AI
Jina AI
P
Palo Alto Networks Blog
GbyAI
GbyAI
大猫的无限游戏
大猫的无限游戏
A
Arctic Wolf
Hugging Face - Blog
Hugging Face - Blog
小众软件
小众软件
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
Blog — PlanetScale
Blog — PlanetScale
S
Schneier on Security
V
Vulnerabilities – Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
雷峰网
雷峰网
T
Tenable Blog
人人都是产品经理
人人都是产品经理
T
Tor Project blog
C
Cyber Attacks, Cyber Crime and Cyber Security
AWS News Blog
AWS News Blog
Microsoft Security Blog
Microsoft Security Blog
J
Java Code Geeks
Scott Helme
Scott Helme
SecWiki News
SecWiki News
C
CERT Recently Published Vulnerability Notes
Recorded Future
Recorded Future
I
InfoQ
Security Archives - TechRepublic
Security Archives - TechRepublic
Help Net Security
Help Net Security
Cloudbric
Cloudbric
C
Check Point Blog
Engineering at Meta
Engineering at Meta
TaoSecurity Blog
TaoSecurity Blog
B
Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园_首页
N
News and Events Feed by Topic
云风的 BLOG
云风的 BLOG
MyScale Blog
MyScale Blog
腾讯CDC
量子位
Application and Cybersecurity Blog
Application and Cybersecurity Blog
K
Kaspersky official blog
Vercel News
Vercel News
F
Full Disclosure
T
Troy Hunt's Blog
Forbes - Security
Forbes - Security
S
Security @ Cisco Blogs

博客园 - 疯子110

Vue3 + Vite + Ts 报错:Property ‘ ‘ does not exist on type ‘never‘ activiti部署流程后act_re_procdef表中无流程定义信息 【转】openEuler欧拉系统重置密码 【转】nginx开启https导致springboot无法获取正确浏览器请求地址问题 【转】SLF4J(W): No SLF4J providers were found. 解决方法 vue项目放在springboot项目里后,刷新页面会显示whitelabel error page Vue3 echarts tooltip添加点击事件(最简版) Vue3富文本编辑器wangEditor 5使用总结【转载】 解决 vue3 中 Proxy(Object) 对象无法直接读取或使用 centos7-分区2T以上大硬盘[转】 Vue3 - 项目中使用 debugger 在 chrome 谷歌浏览器中失效 vue项目error Unexpected ‘debugger‘ statement no-debugger报错 vue项目中 报错 error ‘xxx‘ is assigned a value but never used 在vue中使用leaflet加载地图【转载】 无法加载文件 D:\Program Files\xxxxx\vue.ps1,因为在此系统上禁止运行脚本”的解决方法 - 疯子110 Vue3安装配置+VSCode开发环境搭建,超详细保姆级教程(图文) 【转】将postgresql表名和字段名统一转换为小写 【cesium重新梳理】1.cesium知识整理 【cesium】修改底图颜色为蓝色科技范儿
关于mybatis进行sql查询字段值为null而不显示问题解决办法
疯子110 · 2025-03-20 · via 博客园 - 疯子110

有时候进行数据库查询操作的时候,查询结果中一条参数或者有某几个参数为null,这种情况下,参数名都不会返回,解决办法如下:

第一种:mybatis返回值resultType="map" 改成实体类返回

第二种:还是用map接收,默认查询为控的字段不显示,

所以在修改配置:

如果配置文件是mybatis-config,则加上 :

<setting name="callSettersOnNulls" value="true"/>

如果使用的是spring-boot那么在application.yml加上:

mybatis.configuration.call-setters-on-nulls=true,如下图所示

mybatis:
configuration:
call-setters-on-nulls: true

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD SQL Map Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>

<settings>
<setting name="cacheEnabled" value="true" /><!-- 全局映射器启用缓存 -->
<setting name="useGeneratedKeys" value="true" />
<setting name="defaultExecutorType" value="REUSE" />
<setting name="callSettersOnNulls" value="true"/>
</settings>
还有其他的方法,楼主只列举了最方便的两种
————————————————

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

原文链接:https://blog.csdn.net/a1029573879a/article/details/79271345