Procházet zdrojové kódy

新增查看玩家最高积分

sunkean před 3 roky
rodič
revize
9961cb83a2

+ 3 - 0
src/main/java/com/izouma/nineth/repo/MetaGameProcessRepo.java

@@ -9,4 +9,7 @@ public interface MetaGameProcessRepo extends JpaRepository<MetaGameProcess, Long
 
     @Query(value = "select * from meta_game_process m where m.user_id = ?1 and m.meta_game_copy_id = ?2 order by m.created_at desc limit 1", nativeQuery = true)
     MetaGameProcess findDisconnected(Long userId, Long metaGameCopyId);
+
+    @Query(value = "select * from meta_game_process m where m.user_id = ?1 and m.completed = true order by m.point desc limit 1", nativeQuery = true)
+    MetaGameProcess findTopPoint(Long userId);
 }

+ 10 - 0
src/main/java/com/izouma/nineth/web/MetaGameCopyController.java

@@ -132,5 +132,15 @@ public class MetaGameCopyController extends BaseController {
         }
         return MetaRestResult.returnSuccess(metaGameProcess.isDisconnected());
     }
+
+
+    @GetMapping("/{userId}/findTopPoint")
+    public MetaRestResult<Integer> findTopPoint(@PathVariable Long userId) {
+        MetaGameProcess metaGameProcess = metaGameProcessRepo.findTopPoint(userId);
+        if (Objects.isNull(metaGameProcess)) {
+            return MetaRestResult.returnSuccess(0);
+        }
+        return MetaRestResult.returnSuccess(metaGameProcess.getPoint());
+    }
 }