mybatis解决limit无法识别运算符的问题
错误:
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/68e7461f10d926cdc2e68fa4cfd0ec87.png)
limit不能识别运算符,那也就是说,我们要么让它可以识别,要么就直接传值,不要传算式字符串。
#{} 是预编译,传进来的数据会加上“” 当做字符串处理,limit不能识别,报错。${} 就是字符串替换,直接替换占位符 一 般 传 入 数 据 库 对 象 使 用 一般传入数据库对象 使用 一般传入数据库对象使用可能会造成sql注入,此时MyBatis 不会修改或转义字符串,计算过后直接传入数据。如下:
SELECT
nid,ntid,
ntitle,nauthor,
ncreateDate, npicPath,
ncontent,nmodifyDate,
nsummary FROM news
<where>
<if test="null != ntid and ntid != ''">