Skip to content

Commit

Permalink
♻️ : 관리자 페이지 유저 필터링 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
imenuuu committed Jan 29, 2024
1 parent 4b474ed commit 08a2a3e
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public interface UserRepository extends JpaRepository<User,Long> {

Long countBy();

@Query(value = "SELECT U.id 'userId', name, birth, socialType, gender, phoneNumber,email," +
@Query(value = "SELECT U.id 'userId', name, birth, socialType, gender, phoneNumber,email,nickname," +
"If((select exists (select * from UserCard UC where UC.userId=U.id)),'true','false')'card'," +
"(select count(*) from DonationUser DU where DU.userId = U.id)'donationCnt'," +
"COALESCE((SELECT SUM(DU.price) FROM DonationUser DU WHERE DU.userId = U.id), 0) AS totalAmount,U.status, U.createdAt " +
Expand All @@ -66,7 +66,7 @@ public interface UserRepository extends JpaRepository<User,Long> {
"FROM User U where U.status = :value and name LIKE concat('%',:content,'%') order by createdAt desc" ,nativeQuery = true, countQuery = "select count(*) from User where status = :value and name LIKE concat('%',:content,'%')")
Page<UserList> getUserListByStatusAndName(Pageable pageable,@Param("value") String value,@Param("content") String content);

@Query(value = "SELECT U.id 'userId', name, birth, socialType, gender, phoneNumber,email," +
@Query(value = "SELECT U.id 'userId', name, birth, socialType, gender, phoneNumber,email,nickname," +
"If((select exists (select * from UserCard UC where UC.userId=U.id)),'true','false')'card'," +
"(select count(*) from DonationUser DU where DU.userId = U.id)'donationCnt'," +
"COALESCE((SELECT SUM(DU.price) FROM DonationUser DU WHERE DU.userId = U.id), 0) AS totalAmount,U.status, U.createdAt " +
Expand Down Expand Up @@ -104,33 +104,33 @@ public interface UserRepository extends JpaRepository<User,Long> {

Long countByStatus(Status status);

@Query(value = "SELECT U.id 'userId', name, birth, socialType, gender, phoneNumber,email," +
@Query(value = "SELECT U.id 'userId', name, birth, socialType, gender, phoneNumber,email,nickname," +
"If((select exists (select * from UserCard UC where UC.userId=U.id)),'true','false')'card'," +
"(select count(*) from DonationUser DU where DU.userId = U.id)'donationCnt'," +
"COALESCE((SELECT SUM(DU.price) FROM DonationUser DU WHERE DU.userId = U.id), 0) AS totalAmount,U.status, U.createdAt " +
"FROM User U where email LIKE concat('%',:content,'%') order by createdAt desc" ,nativeQuery = true, countQuery = "select count(*) from User where email LIKE concat('%',:content,'%')")
Page<UserList> getUserListByEmail(Pageable pageable, String content);
Page<UserList> getUserListByEmail(Pageable pageable,@Param("content") String content);

@Query(value = "SELECT U.id 'userId', name, birth, socialType, gender, phoneNumber,email," +
@Query(value = "SELECT U.id 'userId', name, birth, socialType, gender, phoneNumber,email, nickname, " +
"If((select exists (select * from UserCard UC where UC.userId=U.id)),'true','false')'card'," +
"(select count(*) from DonationUser DU where DU.userId = U.id)'donationCnt'," +
"COALESCE((SELECT SUM(DU.price) FROM DonationUser DU WHERE DU.userId = U.id), 0) AS totalAmount,U.status, U.createdAt " +
"FROM User U where phoneNumber LIKE concat('%',:content,'%') order by createdAt desc" ,nativeQuery = true, countQuery = "select count(*) from User where phoneNumber LIKE concat('%',:content,'%')")
Page<UserList> getUserListByPhone(Pageable pageable, String content);
Page<UserList> getUserListByPhone(Pageable pageable,@Param("content") String content);

@Query(value = "SELECT U.id 'userId', name, birth, socialType, gender, phoneNumber,email," +
@Query(value = "SELECT U.id 'userId', name, birth, socialType, gender, phoneNumber,email,nickname," +
"If((select exists (select * from UserCard UC where UC.userId=U.id)),'true','false')'card'," +
"(select count(*) from DonationUser DU where DU.userId = U.id)'donationCnt'," +
"COALESCE((SELECT SUM(DU.price) FROM DonationUser DU WHERE DU.userId = U.id), 0) AS totalAmount,U.status, U.createdAt " +
"FROM User U where nickname LIKE concat('%',:content,'%') order by createdAt desc" ,nativeQuery = true, countQuery = "select count(*) from User where nickname LIKE concat('%',:content,'%')")
Page<UserList> getUserListByNickname(Pageable pageable, String content);
Page<UserList> getUserListByNickname(Pageable pageable,@Param("content") String content);

@Query(value = "SELECT U.id 'userId', name, birth, socialType, gender, phoneNumber,email," +
@Query(value = "SELECT U.id 'userId', name, birth, socialType, gender, phoneNumber,email,nickname," +
"If((select exists (select * from UserCard UC where UC.userId=U.id)),'true','false')'card'," +
"(select count(*) from DonationUser DU where DU.userId = U.id)'donationCnt'," +
"COALESCE((SELECT SUM(DU.price) FROM DonationUser DU WHERE DU.userId = U.id), 0) AS totalAmount,U.status, U.createdAt " +
"FROM User U where U.id LIKE concat('%',:content,'%') order by createdAt desc" ,nativeQuery = true, countQuery = "select count(*) from User where id LIKE concat('%',:content,'%')")
Page<UserList> getUserListById(Pageable pageable, String content);
Page<UserList> getUserListById(Pageable pageable,@Param("content") String content);

public interface UserList {
Long getUserId();
Expand Down

0 comments on commit 08a2a3e

Please sign in to comment.