查看控制台,如果是
java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and name like concat('%','张','%')...

则进入EmployeeMapper.xml修改sql语句为:
<select id="pageQuery" resultType="com.sky.entity.Employee">
select * from employee
<where>
<if test="name != null and name != '' ">
-- like 模糊查询
name like concat('%',#{name},'%')
</if>
</where>
order by create_time desc
</select>
重新运行启动即可
文章讲述了在处理MySQL数据库时遇到的SQLSyntaxErrorException,焦点在于EmployeeMapper.xml文件中使用了不正确的SQL模糊查询语法。作者解决了问题,通过修改`namelikeconcat`部分,修复了查询并成功重新运行了应用。
2238





