Mybatis:MapperXML文件报错(Unable to resolve table 'limit')

  1. Mybatis:MapperXML文件报错(Unable to resolve table ‘limit’)
    1. 解决办法

Mybatis:MapperXML文件报错(Unable to resolve table ‘limit’)

在使用时报错

<select id="selectBySearch" parameterType="life.mhe.community.dto.QuestionQueryDTO" resultMap="BaseResultMap">
        select * from question
        <where>
            <if test="search!=null">
                 title regexp #{search}
            </if>
        </where>
        order by gmt_create desc limit #{page},#{size}
    </select>

解决办法

起初将where和if交换位置依旧报错

类似问题:

[]: https://stackoverflow.com/questions/60575770/

最终将标签改为where关键字解决

where
            <if test="search!=null">
                 title regexp #{search}
            </if>
        order by gmt_create desc limit #{page},#{size}

转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。