当前使用版本(必填,否则不予处理) 3.5.2
该问题是如何引起的?(确定最新版也有问题再提!!!) 当使用Wrappers,没有一个条件,但使用了oderby排序,执行是会拼接上一个where,导致执行报错
重现步骤(如果有就写完整) Page subscribeVersionVOPage = this.baseMapper.selectSubList(page, Wrappers.lambdaQuery(OpSubscribeVersion.class).orderByDesc(SuperEntity::getCreateTime));
// 如果不加 .orderByDesc(SuperEntity::getCreateTime) 这个会正常执行,不回拼接 where
报错信息 nested exception is java.sql.SQLException: sql injection violation, dbType mysql, , druid-version 1.2.11, syntax error: syntax error, error in :'RDER BY create_time DESC) TOTAL', expect ), actual BY, pos 192, line 5, column 23, token BY : SELECT COUNT() FROM (select a., (select count(eas.id) from op_enterprise eas where eas.sub_id=a.id ) as count from op_subscribe_version a WHERE ORDER BY create_time DESC) TOTAL
Comment From: miemieYaho
selectSubList不是你自己写的xml吗?
Comment From: Fyuxuan
@miemieYaho 是自己写的xml,就很简单的sql
select
a.*,
b.xxx
from aa a
LEFT JOIN bb b on a.b_id = b.id
<where>
${ew.sqlSegment}
</where>
Comment From: miemieYaho
去掉where再ew.customSqlSegment