在使用SpringBoot+MybatisPlus框架的后端项目调用SQL Server的存储过程时报错:
Mapper层xml中的代码为:
在命令行调用存储过程时,可以顺利执行,但是在mapper中调用就抛异常时抛异常:Nested exception is org.apache.ibatis.exceptions.PersistenceException
在仔细检查过代码逻辑,确认代码无误(各个地方逻辑能通、参数能传)
最终确认结果为:mybatisplus不识别sql查询语句中的返回使用函数,如:max(),count()等。
解决办法:在mapper函数上加上如下配置:
@InterceptorIgnore(tenantLine = "1")