baomidou / mybatis-plus

An powerful enhanced toolkit of MyBatis for simplify development
https://baomidou.com
Apache License 2.0
16.4k stars 4.31k forks source link

[错误报告]: 3.5.2版本如何实现某个mybatis 方法忽略sql语法检查? #6456

Closed tiger822 closed 1 month ago

tiger822 commented 1 month ago

确认

当前程序版本

3.5.2

问题描述

由于有些数据库(如sqlserver)的语法奇特,mybatis plus的语法检查组件完全适应不了,所以希望某些mapper方法能通过注解的方式让其规避sql的语法检查,是否能实现? 百度没找到答案。

比如在sql里面有 set @var1=#{var1}这种语法,语法检查就出异常。

详细堆栈日志

Caused by: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Failed to process, Error SQL: declare @mo varchar(20),@itemno varchar(20),@planReq integer
        set @mo=?
        set @itemno=?
        Set @planReq=(select isnull(sum(PlanReq),0) from ds_mo_mate where mo=@mo and  itemno=@itemno)
....
Caused by: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "set" "SET"
    at line 2, column 9.

Was expecting one of:

    ","
    "."
    ";"
    "="
    "["
    <EOF>

    at net.sf.jsqlparser.parser.CCJSqlParser.generateParseException(CCJSqlParser.java:31234)
miemieYaho commented 1 month ago

net.sf.jsqlparser.parser.ParseException 不能

tiger822 commented 1 month ago

net.sf.jsqlparser.parser.ParseException 不能

我知道,就是想问如何跳过这个检测

miemieYaho commented 1 month ago

只有插件里在用,去掉插件

tiger822 commented 1 month ago

只有插件里在用,去掉插件

请问如何配置可以去掉?

miemieYaho commented 1 month ago

https://baomidou.com/plugins/#%E6%8B%A6%E6%88%AA%E5%BF%BD%E7%95%A5%E6%B3%A8%E8%A7%A3-interceptorignore