zoukankan      html  css  js  c++  java
  • myBatis查询报错 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

    myBatis查询报错

       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

    <select id="selectList" parameterType="com.hanilucky.core.vo.Dep"
            resultMap="BaseResultMap">
            select
            <include refid="Base_Column_List" />
            from dep
            <where>
                <if test="uuid != null">
                    AND UUID = #{uuid,jdbcType=INTEGER}
                </if>    
                <if test="name != null and name != ''">
                    AND NAME = #{name,jdbcType=VARCHAR}
                </if>
                <if test="tele != null and tele != ''">
                    AND TELE = #{tele,jdbcType=VARCHAR}
                </if>
            </where>
        </select>

    标红的NAME是mysql的关键字,解析时报错

    修改时加上``引用(数字1左边的键)

    <select id="selectList" parameterType="com.hanilucky.core.vo.Dep"
            resultMap="BaseResultMap">
            select
            <include refid="Base_Column_List" />
            from dep
            <where>
                <if test="uuid != null">
                    AND UUID = #{uuid,jdbcType=INTEGER}
                </if>
                <if test="name != null and name != ''">
                    AND `NAME` = #{name,jdbcType=VARCHAR}
                </if>
                <if test="tele != null and tele != ''">
                    AND TELE = #{tele,jdbcType=VARCHAR}
                </if>
            </where>
        </select>
  • 相关阅读:
    动态生成java、动态编译、动态加载
    boostrap标签
    Java后端WebSocket的Tomcat实现
    编程过程与规范
    敏捷开发过程
    软件过程模型
    软件过程
    ISO9126 质量模型
    手机淘宝架构演化实践
    蒋勋:知识分子应具备怎样的美学修养
  • 原文地址:https://www.cnblogs.com/covet/p/10149299.html
Copyright © 2011-2022 走看看