Java之MyBatis 批量删除数据,两种方式(注解,XML)

x33g5p2x  于2022-02-18 转载在 Java  
字(0.6k)|赞(0)|评价(0)|浏览(292)

1、MyBatis之 XML 批量删除数据

public int deleteSysStudentStuIds(Long[] stuIds);
<delete id="deleteSysStudentStuIds" parameterType="String">
        delete from sys_student where stu_id in
        <foreach item="stuId" collection="array" open="(" separator="," close=")">
            #{stuId}
        </foreach>
</delete>

2、MyBatis之 注解 批量删除数据

@Delete("<script>
        delete from sys_student where stu_id in 
        <foreach collection='array' item='stuId' open='(' separator=',' close=')'>#{stuId}</foreach>
                  </script>")
        
void delete(Long[] stuIds);

相关文章

最新文章

更多