UserDetailRepo.java 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package com.izouma.nineth.repo;
  2. import com.izouma.nineth.domain.UserDetail;
  3. import org.springframework.data.jpa.repository.JpaRepository;
  4. import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
  5. import org.springframework.data.jpa.repository.Modifying;
  6. import org.springframework.data.jpa.repository.Query;
  7. import javax.transaction.Transactional;
  8. public interface UserDetailRepo extends JpaRepository<UserDetail, Long>, JpaSpecificationExecutor<UserDetail> {
  9. @Query("update UserDetail t set t.del = true where t.userId = ?1")
  10. @Modifying
  11. @Transactional
  12. void softDelete(Long id);
  13. @Query("select count(a) from Asset a where a.userId = ?1 and a.status = 'NORMAL'")
  14. Long findNftCountById(Long id);
  15. @Query("select count(a) from Asset a where a.userId = ?1 and a.status = 'NORMAL' and (a.name like '%房产%' or a.name like '%建筑%')")
  16. Long findBuildCountById(Long id);
  17. @Query("select count(a) from Asset a where a.userId = ?1 and a.status = 'NORMAL' and a.name like '%土地%'")
  18. Long findPlotCountById(Long id);
  19. @Query("select u.followers from User u where u.id = ?1")
  20. Long findFansCountById(Long id);
  21. @Query("select count(a) from Asset a where a.userId = ?1 and a.status = 'NORMAL' and a.name like '%绿洲灵气%'")
  22. Long findReikiCountById(Long id);
  23. @Query("select count(a) from Asset a where a.userId = ?1 and a.status = 'NORMAL' and a.name like '%勋章%'")
  24. Long findMedalCountById(Long id);
  25. @Query("select sum(c.likes) from Collection c where c.ownerId = ?1")
  26. Long findPersonalHeatCountById(Long id);
  27. }