方法一;

在application.properties中加一句

逐步走,出错的sql语句就会打印在控制台上。

//在application.properties中加一句
mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl

方法二;

在controller层调取service层的语句上try一下

在catch中写e.printStackTrace(); 在圆圈处打断点

当出问题后,语句会直接从第一个红框处跳到catch中

springboot项目中sql语句出错排除错误方法_java

try {
            int count = actionlogsService.updateAudit(logs);
            if(count>0)flag = true;
            form.setCode("200");
            form.setMessage(ResponseForm.message.SUCCESS);
            form.setData(flag);
        }catch (Exception e){
            form.setCode("400");
            form.setMessage(ResponseForm.message.FAIL);
            e.printStackTrace();
        }

而将错误打印到控制台的那一句命令是 e.printStackTrace();