Mybatis-Plus BaseMapper.deleteById(String id) 报错:TypeException: Could not set parameters for mapping
这个错误通常是因为在调用 deleteById 方法时传入了 null 值作为参数,但是该方法参数类型为 String,而 Mybatis-Plus 不支持将 null 值直接映射为 'JdbcType.OTHER' 类型。
解决方法是在调用 deleteById 方法前先判断参数是否为 null,如果为 null,则不执行 deleteById 方法,避免该异常的发生。例如:
if (id != null) {
baseMapper.deleteById(id);
}
原文地址: https://www.cveoy.top/t/topic/oslb 著作权归作者所有。请勿转载和采集!