<!-- 获取店铺列表 -->
<select id="getShopListByPage" resultMap="shopMap">
select * from
<include refid="table_name"></include>
<!-- bind写法:预防SQL注入 通过关键词搜索 -->
<bind name="pattern" value="'%'+keywords+'%'" />
<where>
<if test="keywords != null and keywords != ''">
shop_name like #{pattern}
</if>
</where>
limit #{offset}, #{limit}
</select>
错误原因,where放在if里面,要提出来,有可能是mybats版本原因,提出来换成上面的写法就没报错了