def batchDelete(Class entityClass,ids){ entityClass.executeUpdate("delete ${entityClass.name} where id in(:ids)",[ids:ids*.toLong()]) //还需清除sessionFactory缓存中数据 entityClass.withSession{ session -> ids.each{ id -> session.sessionFactory.evict(entityClass,id) } } }