老师,请问下,通用mapper怎么设置不更新和不插入空字符串?
来源:8-19 规则持久化02-推模式

靈靇
2020-12-15
老师,请问下,通用mapper怎么设置不更新和不插入空字符串?
这边通过insertSelective和UpdateByPrimaryKeySelectiveMapper发现前端传过来的空字符会更新和插入,应该null和空字符都不插入才对吧
写回答
1回答
-
大目
2020-12-16
您好,直接判断下就OK了。
if(入参不是null) {
insertSelective / UpdateByPrimaryKey
}
通用mapper不会管你是不是想要插入的是空还是不是空。
012020-12-29
相似问题