CollateralPlanRepository.java 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package com.loan.system.repository;
  2. import com.loan.system.domain.entity.CollateralPlan;
  3. import org.springframework.data.jpa.repository.JpaRepository;
  4. import org.springframework.data.jpa.repository.Modifying;
  5. import org.springframework.data.jpa.repository.Query;
  6. import org.springframework.transaction.annotation.Transactional;
  7. import java.util.List;
  8. public interface CollateralPlanRepository extends JpaRepository<CollateralPlan,Long> {
  9. @Query("select c from CollateralPlan c where c.collateralId = ?1 and c.isDelete = ?2 and c.status='待审批'")
  10. CollateralPlan findByCollateralIdAndIsDelete(Long collateralId, boolean isDelete);
  11. @Query("select c from CollateralPlan c where c.id = ?1 and c.isDelete = ?2")
  12. CollateralPlan findByIdAndIsDelete(Long id, Boolean isDelete);
  13. @Query("select c from CollateralPlan c where c.collateralId = ?1 and c.isDelete = ?2")
  14. List<CollateralPlan> findsByCollateralIdAndIsDelete(Long collateralId, boolean isDelete);
  15. @Query("select c from CollateralPlan c where c.caseId = ?1 and c.isDelete = ?2")
  16. List<CollateralPlan> findByCaseIdAndIsDelete(Long caseId, boolean isDelete);
  17. @Modifying
  18. @Transactional
  19. @Query("update CollateralPlan c set c.isDelete = true where c.id = ?1")
  20. void logic_delete(Long id);
  21. @Modifying
  22. @Transactional
  23. @Query("update CollateralPlan c set c.userId = ?2 , c.updateTime=CURRENT_TIMESTAMP where c.collateralId = ?1")
  24. void updateCollateralUserIdeByid(Long collateralId, Long userId);
  25. @Modifying
  26. @Transactional
  27. @Query("update CollateralPlan c set c.status = ?2 , c.updateTime=CURRENT_TIMESTAMP where c.id = ?1")
  28. void updateCollateralStatusByid(Long collateralId, String status);
  29. @Modifying
  30. @Transactional
  31. @Query("update CollateralPlan c set c.operatorId = ?2 , c.operatorName = ?3 , c.updateTime=CURRENT_TIMESTAMP where c.id = ?1")
  32. void updateCollateraloperatorIdByid(Long collateralId, Long operatorId,String operatorName);
  33. }