package com.loan.system.repository;


import com.loan.system.domain.entity.LoanCase;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

public interface LoanCaseRepository extends JpaRepository<LoanCase,Long> {
    LoanCase findByIdAndIsDelete(Long customerId,boolean isDelete);

    @Modifying
    @Transactional
    @Query("update LoanCase set updateTime = ?3 where id = ?1 and isDelete = ?2")
    void updateUpdatetimeByIdAndIsDeleted(Long id,boolean isDelete,String updateTime);

    @Modifying
    @Transactional
    @Query("UPDATE LoanCase SET updateTime = ?3, isDelete = ?2 WHERE id = ?1 AND isDelete = ?2")
    void logic_delete(Long id, boolean isDelete, String updateTime);


}
