map为空时调用keySet()传给jpa导致的bug
2020-09-29 02:00:23 845
userService.deleteNotInId(userMap.keySet());
@Modifying
@Query(value = "DELETE FROM user WHERE id NOT IN (:iqs)", nativeQuery = true)
void deleteNotInId(@Param("ids") Iterable<String> iqs);
当userMap size为0时
预期jpa sql为DELETE FROM user WHERE iq NOT IN ('')
而实际sql为 DELETE FROM user WHERE iq NOT IN (null)