当前使用版本(必填,否则不予处理)

com.baomidou mybatis-plus-boot-starter 3.5.2

该问题是如何引起的?(确定最新版也有问题再提!!!)

使用 ${ew.customSqlSegment} 当没有查询条件时,执行正常。一旦有查询条件。不走自定义sql。

重现步骤(如果有就写完整)

IPage pageAppFileVo(IPage page, @Param(Constants.EW) Wrapper wrapper);

xml:

报错信息

org.springframework.jdbc.BadSqlGrammarException:

Error querying database. Cause: java.sql.SQLSyntaxErrorException: Unknown column 'md5_hash' in 'where clause'

The error may exist in file [D:\workspace\springcloud\tms\target\classes\mappers\TmsAppFileMapper.xml]

The error may involve defaultParameterMap

The error occurred while setting parameters

SQL: SELECT COUNT(*) FROM tms_app_file WHERE (md5_hash = ?)

Cause: java.sql.SQLSyntaxErrorException: Unknown column 'md5_hash' in 'where clause'

; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: Unknown column 'md5_hash' in 'where clause'

Comment From: miemieYaho

select a.a,b.b from tablea a left join tableb b on ...... where a.id = ? and b.id = ?

Comment From: chengqian117

查询条件构造把表名加上就好了