mybatis 删除数据

去 xml

@DeleteProvider(type = RulesProvider.class, method = "batchDelete")
int deleteStandardRule(@Param("rolesId") String ids);

class RulesProvider {
    /* 批量删除 */
    public String batchDelete(Map map) {
        String id= (String)map.get("rolesId");
        StringBuilder sb = new StringBuilder();
        sb.append("delete from devops_rules where id in (");
        String [] ids=id.split(",");
        for (int i = 0; i < ids.length; i++) {
            sb.append("'").append(ids[i]).append("'");
            if (i < ids.length - 1) {
                sb.append(",");
            }
        }
        sb.append(")");
        return sb.toString();
    }
}
@Delete({"<script>",
        "delete from devops_rules_detail where id in ",
        "<foreach collection='detailId' item='id' separator=',' open='(' close=')'>",
        "#{id,jdbcType=INTEGER}",
       "</foreach>",
        "</script>"})
int deleteStandardRuleDetail(@Param("detailId") String[] detailId);