From 8acab73933b8e5bed0c3d58ff04fed82b7f9e952 Mon Sep 17 00:00:00 2001 From: seatonwan9 Date: 星期五, 15 八月 2025 19:07:53 +0800 Subject: [PATCH] sql --- src/main/java/com/webmanage/controller/PointsController.java | 32 ++++++++++++++++++++++---------- 1 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/webmanage/controller/PointsController.java b/src/main/java/com/webmanage/controller/PointsController.java index 942a46d..8f4214f 100644 --- a/src/main/java/com/webmanage/controller/PointsController.java +++ b/src/main/java/com/webmanage/controller/PointsController.java @@ -2,12 +2,10 @@ import com.webmanage.common.PageResult; import com.webmanage.common.Result; -import com.webmanage.dto.AddPointsFlowDTO; -import com.webmanage.dto.PointsFlowQueryDTO; -import com.webmanage.dto.PointsMainQueryDTO; -import com.webmanage.dto.PointsRuleDTO; +import com.webmanage.dto.*; import com.webmanage.entity.Points; import com.webmanage.entity.PointsRule; +import com.webmanage.entity.UserPoints; import com.webmanage.service.PointsFlowService; import com.webmanage.service.PointsRuleService; import com.webmanage.service.PointsService; @@ -91,7 +89,7 @@ @PostMapping("/rule/update") @ApiOperation("淇敼绉垎瑙勫垯") - public Result<Object> updatePointsRule(@Valid @RequestBody PointsRuleDTO pointsRuleDTO) { + public Result<Object> updatePointsRule(@Valid @RequestBody List<PointsRuleDTO> pointsRuleDTO) { try { boolean result = pointsRuleService.updatePointsRule(pointsRuleDTO); if (result) { @@ -252,10 +250,10 @@ @GetMapping("/total/user/{userId}") @ApiOperation("鑾峰彇鐢ㄦ埛绉垎缁熻") - public Result<Object> getUserPointsTotal(@ApiParam("鐢ㄦ埛ID") @PathVariable Long userId) { + public Result<UserPoints> getUserPointsTotal(@ApiParam("鐢ㄦ埛ID") @PathVariable Long userId) { try { - Integer total = pointsFlowService.getUserPointsTotal(userId); - return Result.success(total); + UserPoints userPoints = pointsFlowService.getUserPointsTotal(userId); + return Result.success(userPoints); } catch (Exception e) { log.error("鑾峰彇鐢ㄦ埛绉垎缁熻澶辫触", e); return Result.error("鑾峰彇鐢ㄦ埛绉垎缁熻澶辫触锛�" + e.getMessage()); @@ -264,13 +262,27 @@ @GetMapping("/total/unit/{unitId}") @ApiOperation("鑾峰彇鍗曚綅绉垎缁熻") - public Result<Object> getUnitPointsTotal(@ApiParam("鍗曚綅ID") @PathVariable Long unitId) { + public Result<UserPoints> getUnitPointsTotal(@ApiParam("鍗曚綅ID") @PathVariable Long unitId) { try { - Integer total = pointsFlowService.getUnitPointsTotal(unitId); + UserPoints total = pointsFlowService.getUnitPointsTotal(unitId); return Result.success(total); } catch (Exception e) { log.error("鑾峰彇鍗曚綅绉垎缁熻澶辫触", e); return Result.error("鑾峰彇鍗曚綅绉垎缁熻澶辫触锛�" + e.getMessage()); } } + + // ==================== 绉垎娴佹按鏁版嵁绫荤洰 ==================== + + @GetMapping("/flow/categories") + @ApiOperation("鑾峰彇绉垎娴佹按鏁版嵁绫荤洰鍒楄〃") + public Result<Object> getPointsFlowCategories() { + try { + List<String> categories = pointsFlowService.getPointsFlowCategories(); + return Result.success(categories); + } catch (Exception e) { + log.error("鑾峰彇绉垎娴佹按鏁版嵁绫荤洰澶辫触", e); + return Result.error("鑾峰彇绉垎娴佹按鏁版嵁绫荤洰澶辫触锛�" + e.getMessage()); + } + } } -- Gitblit v1.8.0