zoukankan      html  css  js  c++  java
  • MyBatis传入多个参数

    http://www.cnblogs.com/ningheshutong/p/5828854.html

    http://www.2cto.com/database/201409/338155.html

    总得来说,单个参数不用说,多个参数不是通过具体的Entity就是通过Map。

    Q:能不能用逗号隔开传递parameterType="java.lang.String,java.lang.String"?

    A:http://mybatis-user.963551.n3.nabble.com/parameterType-for-multiple-parameters-td3636195.html

    More:When you say interface I hope you mean your mapper interface.  If so 
    you just need to name your parameters with the @Param annotation. 
    This will then place the parameters into a map for you.  You can 
    actually just leave off the parameterType attribute it you want.  It 
    is not check nor enforced.  I like to use them just to be able to see 
    what is coming in.  "map" should still work for you. 

    parameterType不是必须出现在XML的语句里的,它既不用来检查什么也不是强制的关键字,完全可以抛弃不写。

    要想传两个参数,只需要用@Param修饰一下参数的名字,底层框架就会把他们封装到"map"类型里了(也就是说你都不用自己搞什么new XXMap()的工作)。

    本人也用代码验证过了,超过1个参数,必须得用@Param修饰一下(并且得给参数指定一个与在XML中使用时相同的名字)。

  • 相关阅读:
    【算法】 冒泡排序
    【算法】 插入排序
    【算法】 斐波那契数列
    【C#】 RBAC 权限框架
    【jQuery】 实用 js
    【jQuery】 Ajax
    【jQuery】 常用函数
    【jQuery】 资料
    【jQuery】 效果
    Linaro/Yocto/Openwrt
  • 原文地址:https://www.cnblogs.com/rgqancy/p/6182617.html
Copyright © 2011-2022 走看看