【mybatis】mybatis 多条件参数和 in list使用
作者:互联网
一、前言:
最近用到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>
标签:list,Param,manager,参数,value,mybatis,newUser,id 来源: https://blog.csdn.net/Mrerlou/article/details/120991392