ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds

    技术2022-07-11  82

    ERROR 1064 (42000): 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 xxx

    错误原因为使用了mysql关键字 在sql语句中使用``将表名列名引起来 如:select `desc` from `key` t1 where t1.`id` = 1

    当使用mybatis-plus时,用了关键字作为表的列名,注意在实体类中加上@TableField注解并指定对应列名

    @TableField(value="desc") private String desc;
    Processed: 0.017, SQL: 9