一、前言:
最近用到mybatis 框架,有个需求,有个查询有多个条件,mybatis中参数为list集合时使用 mybatis in查询
二、具体实施:
1. sql 语句
update hiveShow set manager = '张三' where manager = 'lisi' and id in (10, 20, 45);
2. Mapper层

void updateHiveDatabaseAsset(@Param(value = "originUser") String originUser, @Param(value = "newUser") String newUser, @Param(value = "rid") List<Integer> ridList);
3. xml

<update id="updateHiveDatabaseAsset">
update hiveShow set manager = #{newUser}
<where>
manager = #{originUser}
AND id in
<foreach collection="rid" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</where>
</update>
最后
以上就是精明篮球最近收集整理的关于【mybatis】mybatis 多条件参数和 in list使用的全部内容,更多相关【mybatis】mybatis内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复