CustomerRepository.java 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package com.loan.system.repository;
  2. import com.loan.system.domain.entity.Customer;
  3. import com.loan.system.domain.entity.CustomersOther;
  4. import com.loan.system.domain.entity.User;
  5. import org.springframework.data.jpa.repository.JpaRepository;
  6. import org.springframework.data.jpa.repository.Modifying;
  7. import org.springframework.data.jpa.repository.Query;
  8. import javax.transaction.Transactional;
  9. import java.util.List;
  10. /**
  11. * @author EdwinXu
  12. * @date 2020/9/2 - 15:35
  13. * @Description
  14. */
  15. public interface CustomerRepository extends JpaRepository<Customer,Long> {
  16. boolean existsByMobileAndIsDelete(String mobile,Boolean isDelete);
  17. @Query("select c from Customer c where c.mobile = ?1 and c.isDelete = ?2")
  18. Customer findByMobile(String mobile,Boolean isDelete);
  19. List<Customer> findByIsDelete(Boolean isDelete);
  20. Customer findByIdAndIsDelete(Long id, Boolean isDelete);
  21. @Query("select c from Customer c where (c.mobile = ?1 or c.name = ?1) and c.isDelete = ?2")
  22. Customer findByKey(String key, boolean b);
  23. @Transactional
  24. @Modifying
  25. @Query("update Customer c set c.marriedStatus = ?2 where c.id = ?1")
  26. void updateMarriedStatusById(Long customerId, String marriedStatus);
  27. @Query("select co from Customer co where co.id = ?1 and co.isDelete = ?2")
  28. Customer findByCustomerId(Long customerId , Boolean isDelete);
  29. }