one
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.web.controller.scoring;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -60,15 +61,33 @@ public class ScoreRoomController extends BaseController
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取【请填写功能名称】详细信息
|
||||
* 获取【roomId】详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:room:query')")
|
||||
@GetMapping(value = "/{roomId}")
|
||||
@GetMapping(value = "/id/{roomId}")
|
||||
public AjaxResult getInfo(@PathVariable("roomId") Long roomId)
|
||||
{
|
||||
return success(scoreRoomService.selectScoreRoomByRoomId(roomId));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取【createUser】详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:room:query1')")
|
||||
@GetMapping(value = "/createUser/{createUser}")
|
||||
public AjaxResult getByCreateUser(@PathVariable("createUser") Long createUser)
|
||||
{
|
||||
List<ScoreRoom> rooms = scoreRoomService.selectScoreRoomBycreateUser(createUser);
|
||||
if (rooms == null || rooms.isEmpty()) {
|
||||
return AjaxResult.success("无历史记录,创建新房间", Collections.emptyList());
|
||||
}
|
||||
|
||||
return AjaxResult.success(rooms);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*/
|
||||
|
||||
@@ -34,6 +34,20 @@ public class ScoreRoomUserController extends BaseController
|
||||
@Autowired
|
||||
private IScoreRoomUserService scoreRoomUserService;
|
||||
|
||||
/**
|
||||
* 获取房间内所有用户及其详细对局记录
|
||||
*/
|
||||
@GetMapping("/user-details/{roomId}")
|
||||
public AjaxResult getUserScoresWithDetails(@PathVariable("roomId") Long roomId) {
|
||||
try {
|
||||
List<ScoreRoomUser> result = scoreRoomUserService.getUserScoresWithDetails(roomId);
|
||||
return AjaxResult.success(result);
|
||||
} catch (Exception e) {
|
||||
logger.error("查询房间{}用户得分详情失败", roomId, e);
|
||||
return AjaxResult.error("查询失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*/
|
||||
@@ -62,13 +76,26 @@ public class ScoreRoomUserController extends BaseController
|
||||
/**
|
||||
* 获取【请填写功能名称】详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:query')")
|
||||
@GetMapping(value = "/{roomUserId}")
|
||||
public AjaxResult getInfo(@PathVariable("roomUserId") Long roomUserId)
|
||||
@PreAuthorize("@ss.hasPermi('system:user:query1')")
|
||||
@GetMapping(value = "/userid/{UserId}")
|
||||
public AjaxResult getInfo(@PathVariable("UserId") Long UserId)
|
||||
{
|
||||
return success(scoreRoomUserService.selectScoreRoomUserByRoomUserId(roomUserId));
|
||||
return success(scoreRoomUserService.selectScoreRoomUserByUserId(UserId));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取【请填写功能名称】详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:query')")
|
||||
@GetMapping(value = "/RoomUserId/{RoomUserId}")
|
||||
public AjaxResult getInfo1(@PathVariable("RoomUserId") Long RoomUserId)
|
||||
{
|
||||
return success(scoreRoomUserService.selectScoreRoomUserByRoomUserId(RoomUserId));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*/
|
||||
@@ -86,9 +113,15 @@ public class ScoreRoomUserController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ScoreRoomUser scoreRoomUser)
|
||||
public AjaxResult edit(@RequestBody List<ScoreRoomUser> scoreRoomUsers)
|
||||
{
|
||||
return toAjax(scoreRoomUserService.updateScoreRoomUser(scoreRoomUser));
|
||||
try {
|
||||
List<ScoreRoomUser> result = scoreRoomUserService.updateScoreRoomUser(scoreRoomUsers);
|
||||
return AjaxResult.success("得分提交成功!", result);
|
||||
} catch (Exception e) {
|
||||
logger.error("得分提交失败: {}", e.getMessage());
|
||||
return AjaxResult.error("得分提交失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.ruoyi.web.controller.scoring;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.utils.SimpleResult;
|
||||
@@ -66,7 +68,7 @@ public class ScoreUserController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:query')")
|
||||
@GetMapping(value = "/{userId}")
|
||||
public AjaxResult getInfo(@PathVariable("userId") Long userId)
|
||||
public AjaxResult getInfo(@PathVariable("userId") String userId)
|
||||
{
|
||||
return success(scoreUserService.selectScoreUserByUserId(userId));
|
||||
}
|
||||
@@ -76,10 +78,22 @@ public class ScoreUserController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:add')")
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody ScoreUser scoreUser)
|
||||
{
|
||||
return toAjax(scoreUserService.insertScoreUser(scoreUser));
|
||||
try {
|
||||
ScoreUser newUser = scoreUserService.insertScoreUser(scoreUser);
|
||||
// 构建返回数据
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("userId", newUser.getUserId());
|
||||
data.put("nickName", newUser.getNickName());
|
||||
data.put("avatars", newUser.getAvatars());
|
||||
data.put("openId", newUser.getOpenId());
|
||||
return AjaxResult.success("用户添加成功", data);
|
||||
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("用户添加失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user