确认

  • [X] 我使用的版本是最新版, 并且使用插件确认过项目里无依赖版本冲突
  • [X] 我已经在 issue 中搜索过, 确认问题没有被提出过
  • [X] 我已经修改标题, 将标题中的 描述 替换为遇到的问题

当前程序版本

3.5.10

问题描述

代码

    @Select("""
            <script>
                select * from `user`
                <where>
                    <if test="true">
                        1=1
                    </if>
                    and 2=2
                    <if test="true">
                        and 3=3
                    </if>
                </where>
            </script>
            """)
    List<Map<String, Object>> test();

生成sql

select * from `user` WHERE 1=1and 2=2and 3=3

and 2=2前后缺少空格

正确的sql应该是

select * from `user` WHERE 1=1 and 2=2 and 3=3

使用3.5.9没问题,原生mybatis:3.5.19也没问题

应该是这里改出的问题 https://github.com/baomidou/mybatis-plus/commit/eddde545e118bb6688bd099dd0f6cf117882dbca#diff-c2e89b02c95139afd78ac601427433fa9aa044985ecc89fb9f2528eae9a39fb1L445

详细堆栈日志

No response

Comment From: nieqiurong

先下载这个包替换下试试,中央仓库不能发快照.

mybatis-plus-core-3.5.10.zip

Comment From: nieqiurong

已发布 3.5.10.1