首页 > 学院 > 开发设计 > 正文

如何在mybatis 中传多个参数,如何在mybatis 中遍历 集合?

2019-11-10 20:51:32
字体:
来源:转载
供稿:网友

如何在mybatis 中传多个参数 List getIdByRand(@Param(“question”) Question question,@Param(“sectionIdList”) List sectionIdList);

@param(“”) 映射参数到 xml 的 传入参数

xml: parameterType=”map” 参数类型要写成map

如何在mybatis 中遍历 集合?

现在要遍历 List sectionIdList=new ArrayList<>(); 这个东西

sectionId=#{}

collection=”” //要遍历的 参数 ,为 传进来的参数 item 在此情景中传进来的是string 的集合 item相当于 for循环中的控制变量 separator 分离来每个循环语句的 这里是OR

open,close 用来开始和关闭这个集合的。

examp:

sectionId=#{sectionId}

循环展开: ( sectionId=” or sectionId=” or sectionId=”’

)


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表