package com.loan.system.repository; import com.loan.system.domain.entity.Customer; import com.loan.system.domain.entity.CustomersOther; import com.loan.system.domain.entity.User; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import javax.transaction.Transactional; import java.util.List; /** * @author EdwinXu * @date 2020/9/2 - 15:35 * @Description */ public interface CustomerRepository extends JpaRepository { boolean existsByMobileAndIsDelete(String mobile,Boolean isDelete); @Query("select c from Customer c where c.mobile = ?1 and c.isDelete = ?2") Customer findByMobile(String mobile,Boolean isDelete); List findByIsDelete(Boolean isDelete); Customer findByIdAndIsDelete(Long id, Boolean isDelete); @Query("select c from Customer c where (c.mobile = ?1 or c.name = ?1) and c.isDelete = ?2") Customer findByKey(String key, boolean b); @Transactional @Modifying @Query("update Customer c set c.marriedStatus = ?2 where c.id = ?1") void updateMarriedStatusById(Long customerId, String marriedStatus); @Query("select co from Customer co where co.id = ?1 and co.isDelete = ?2") Customer findByCustomerId(Long customerId , Boolean isDelete); }