springboot mybatis注解方式批量insert和使用in语句查询

1、批量插入

 

    @Insert({
            ""
    })
    int insertByBatch(@Param(value = "roles") List roles);

 

通过@Param指定集合参数,item为集合内每个对象,index为集合自然序号

 

2、使用in语句查询

 

    @Select({
            ""
    })
    Integer checkRoleId(@Param(value = "roleIds") List roleIds);

 

查询要特别指定开闭的左右括号

你可能感兴趣的:(springboot mybatis注解方式批量insert和使用in语句查询)