update tablename set xxx = xxx,yyy=yyy,zzz=zzz where id in (xxx,xxx,xxx)
在数据库中是这样的sql语句,放入mybatis中怎么写?
另怎么给mybatis传入数据
我从前台接收的是 String xxx,String yyy ,String zzz,String id
id是1,2,3 这种的string。。
帮忙指出问题以及怎么解决,。。
我这个不够清楚吗 你说的具体的值怎么写我不太理解
<update id="batchUpdate" parameterType="java.util.List">
UPDATE STUDENT
<set>
<if test="bannerName != null">
t.banner_name = #{bannerName},
</if>
<if test="bannerUrl != null">
t.banner_url = #{bannerUrl},
</if>
</set>
WHERE id IN
<foreach collection="list" item="item" index="index" open="(" separator="," close=")" >
#{item}
</foreach>
update user set password=#{newPassword} where userid=#{userId} 这种形式
直接把id字符串传过去就行了
update table set xx=#{xx},yy=#{xx},zz=#{zz} where id in (#{id})
你怎么写的贴代码看看
update tablename set xxx = #{xxx},yyy=#{yyy},zzz=#{zzz} where id in (#{xxx}) 就行了
你的属性名要跟数据库的字段现对应,才能查询