zoukankan      html  css  js  c++  java
  • org.apache.ibatis.binding.BindingException: Parameter 'username' not found. Available parameters are [0, 1, param1, param2]

    ---恢复内容开始---

    1.dao层如下:

    @Select("select id,username,password, phone, email, created, updated from mb_user where username=#{username} and password=#{password}")
    UserEntity loginT(@Param("username") String username, @Param("password") String password);

    2.使用postman传入json参数如下

    {
    "username":"644069",
    "password":"123456"
    }

    3.报错如下:

    ERROR o.a.c.c.C.[.[localhost].[/].[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'username' not found. Available parameters are [0, 1, param1, param2]] with root cause
    org.apache.ibatis.binding.BindingException: Parameter 'username' not found. Available parameters are [0, 1, param1, param2]

    4.修改如下:

    @Select("select id,username,password, phone, email, created, updated from mb_user where username=#{0} and password=#{1}")
    UserEntity loginT(@Param("username") String username, @Param("password") String password);

    5来源于:http://www.cnblogs.com/durui/p/8279117.html

    ---恢复内容结束---

  • 相关阅读:
    Spring配置自动加载执行多次的解决方法
    获取Excel文件内容,0307通用
    将Json转实体
    将实体转换为map
    Json数据转Map
    获取随机字符串
    将长内容分割,用双主键进行存储
    解决win10开机出现C:WIndowssystem32configsystemprofileDesktop不可用 问题
    2016.2.22
    云中行走
  • 原文地址:https://www.cnblogs.com/jhjlcr/p/11241397.html
Copyright © 2011-2022 走看看