package com.gkhy.testFourierSpecialGasMonitor.domain.account.repository.jpa;
|
|
import com.gkhy.testFourierSpecialGasMonitor.domain.account.entity.User;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.Modifying;
|
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.stereotype.Repository;
|
|
import java.time.LocalDateTime;
|
import java.util.List;
|
|
@Repository
|
public interface UserRepository extends JpaRepository<User,Long> , JpaSpecificationExecutor<User> {
|
|
@Query(value = "select u from User u where u.name = :name and u.status in (1,2)")
|
User findUserByName(String name);
|
|
List<User> findAllByIdIn(List<Long> userIdList);
|
|
@Modifying
|
@Query(value = "update User u set u.hash = :hash ,u.salt = :salt ,u.gmtModified = :time where u.id = :uid")
|
Integer updatePassword(Long uid, String hash, String salt, LocalDateTime time);
|
|
@Modifying
|
@Query(value = "update User u set u.status = :status ,u.gmtModified = :time where u.id = :uid")
|
Integer updateUserStatus(Long uid,Byte status,LocalDateTime time);
|
|
/*@Modifying
|
@Query(value = "update User u set u.roleId = :roleId ,u.gmtModified = :time where u.id = :uid")
|
Integer updateUserRole(Long uid,Long roleId,LocalDateTime time);*/
|
|
@Query(value = "select u from User u where u.phone = :phone and u.status in (1,2)")
|
User findUserByPhone(String phone);
|
|
@Query(value = "select u from User u where u.idType = :idType and u.idSerial = :idSerial and u.status in (1,2)")
|
User findByIdTypeAndIdSerial(Byte idType,String idSerial);
|
|
@Query("update User u set u.phone = :phone where u.id = :uid")
|
@Modifying
|
Integer updateUserPhone(Long uid,String phone);
|
/**
|
* 用户列表
|
*/
|
@Query(value = "select * from sys_user where status in (1,2)", nativeQuery = true)
|
List<User> getUserList();
|
|
@Query(value = "select u from User u where u.realName like %:name% and u.status in (1,2)")
|
List<User> getUsersByRealName(String name);
|
|
/**
|
* 用户列表
|
*/
|
@Query(value = "select * from sys_user where id = :evaluateUserId and status in (1,2)", nativeQuery = true)
|
User getUserInfoByIdAndSellInfo(Long evaluateUserId);
|
@Query(value = "select u from User u where u.id = :uid and u.status in (1,2)")
|
User getById(Long uid);
|
|
User findUserByIdAndStatus(Long userId, Byte status);
|
}
|