使用@Modifying + @Query 实现springData 对数据的 update delete
public interface ICustomer extends JpaRepository<Customer, Long> { @Modifying @Query("delete Customer where isLogicDel = 0 and dispatchDate = ?1 ") public int deleteCustomer(Date dispatchDate); @Modifying @Query("update Customer d set d.isLogicDel = 1 where d.member.id = ?1 and d.dispatchDate = ?2 ") public int updateCustomer(Long memberId, Date dispatchDate); }
时间: 2024-10-06 00:12:09