• Mybatis怎么在mapper中用多个参数


    原文地址:https://github.com/mybatis/mybatis-3/wiki/FAQ

    How do I use multiple parameters in a mapper?

    Java reflection does not provide a way to know the name of a method parameter so MyBatis names them by default like: param1, param2...
    If you want to give them a name use the @param annotation this way:

    import org.apache.ibatis.annotations.Param;
    public interface UserMapper {
       User selectUser(@Param("username") String username, @Param("hashedPassword") String hashedPassword);
    }

    Now you can use them in your xml like follows:

    <select id=”selectUser” resultType=”User”>
      select id, username, hashedPassword
      from some_table
      where username = #{username}
      and hashedPassword = #{hashedPassword}
    </select>
    

      

  • 相关阅读:
    变量1
    PHP 函数
    发送post请求
    XXE
    CSRF
    Html基础
    暴力破解
    Brup sute
    XSS
    URL 传参转义 (特殊符号转义)
  • 原文地址:https://www.cnblogs.com/zhangmingcheng/p/7341704.html
Copyright © 2020-2023  润新知