You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
guandan-data-dashboard/src/backend/src/main/java/com/datadashboard/controller/PlayerController.java

30 lines
1.1 KiB

package com.datadashboard.controller;
import com.datadashboard.common.PageResult;
import com.datadashboard.common.Result;
import com.datadashboard.entity.Player;
import com.datadashboard.service.PlayerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
// PlayerController.java
@RestController
@RequestMapping("/player")
public class PlayerController {
@Autowired
private PlayerService playerService;
@GetMapping("/list")
public Result<PageResult<Player>> getPlayerList(
@RequestParam("page") int page,
@RequestParam("size") int size) {
PageResult<Player> pageResult = playerService.getPagePlayers(page, size);
// ✅ 关键修改:这里用 Result.success() 代替 new Result()
return Result.success(pageResult); // ← 这一行已修正
}
}