|
@@ -0,0 +1,38 @@
|
|
|
|
|
+package com.izouma.nineth.repo;
|
|
|
|
|
+
|
|
|
|
|
+import com.izouma.nineth.domain.UserDetail;
|
|
|
|
|
+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 javax.transaction.Transactional;
|
|
|
|
|
+
|
|
|
|
|
+public interface UserDetailRepo extends JpaRepository<UserDetail, Long>, JpaSpecificationExecutor<UserDetail> {
|
|
|
|
|
+ @Query("update UserDetail t set t.del = true where t.userId = ?1")
|
|
|
|
|
+ @Modifying
|
|
|
|
|
+ @Transactional
|
|
|
|
|
+ void softDelete(Long id);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ @Query("select count(a) from Asset a where a.userId = ?1 and a.status = 'NORMAL'")
|
|
|
|
|
+ Long findNftCountById(Long id);
|
|
|
|
|
+
|
|
|
|
|
+ @Query("select count(a) from Asset a where a.userId = ?1 and a.status = 'NORMAL' and a.name like '%房产%' or a.name like '%建筑%'")
|
|
|
|
|
+ Long findBuildCountById(Long id);
|
|
|
|
|
+
|
|
|
|
|
+ @Query("select count(a) from Asset a where a.userId = ?1 and a.status = 'NORMAL' and a.name like '%土地%'")
|
|
|
|
|
+ Long findPlotCountById(Long id);
|
|
|
|
|
+
|
|
|
|
|
+ @Query("select u.followers from User u where u.id = ?1")
|
|
|
|
|
+ Long findFansCountById(Long id);
|
|
|
|
|
+
|
|
|
|
|
+ @Query("select count(a) from Asset a where a.userId = ?1 and a.status = 'NORMAL' and a.name like '%绿洲灵气%'")
|
|
|
|
|
+ Long findReikiCountById(Long id);
|
|
|
|
|
+
|
|
|
|
|
+ @Query("select count(a) from Asset a where a.userId = ?1 and a.status = 'NORMAL' and a.name like '%勋章%'")
|
|
|
|
|
+ Long findMedalCountById(Long id);
|
|
|
|
|
+
|
|
|
|
|
+ @Query("select sum(c.likes) from Collection c where c.ownerId = ?1")
|
|
|
|
|
+ Long findPersonalHeatCountById(Long id);
|
|
|
|
|
+}
|