Myibatis Mapper配置文件写错导致的错误

### SQL: select * from customer WHERE limit ?,? ### Cause: com.mysql.jdbc.ex

改正前、

<select id="querycustomerinfo" parameterType="QueryVo" resultType="Customer">
         select * from customer 
         <where>
             <if test="custName!=null and custName!=''">
             and cust_name link "%" #{custName} "%"
             </if>
             <if test="custSource!=null and custSource!=''">
              and cust_source=#{custSource}
             </if>
             <if test="custIndustry!=null and custIndustry!=''">
              and cust_industry=#{custIndustry}
             </if>
             <if test="custLevel!=null and custLevel!=''">
              and cust_level=#{custLevel}
             </if>
                  limit #{start},#{rows}
          </where>
   
     </select>

改正后

<select id="querycustomerinfo" parameterType="QueryVo" resultType="Customer">
         select * from customer 
         <where>
             <if test="custName!=null and custName!=''">
             and cust_name link "%" #{custName} "%"
             </if>
             <if test="custSource!=null and custSource!=''">
              and cust_source=#{custSource}
             </if>
             <if test="custIndustry!=null and custIndustry!=''">
              and cust_industry=#{custIndustry}
             </if>
             <if test="custLevel!=null and custLevel!=''">
              and cust_level=#{custLevel}
             </if>
            
          </where>
          limit #{start},#{rows}
     </select>

错误在于 limit #{start},#{rows}放在<where>便签里select * from customer WHERE limit ?,?

猜你喜欢

转载自blog.csdn.net/oschina_40730821/article/details/80464612
今日推荐