From ed212d675716e57978ab01e7d8d215c03d3389df Mon Sep 17 00:00:00 2001 From: gaoxq <376340421@qq.com> Date: Wed, 11 Mar 2026 22:19:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E5=B1=8F=E9=A1=B9=E7=9B=AE=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../biz/controller/ChartInfoController.java | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/mini/mybigscreen/biz/controller/ChartInfoController.java b/src/main/java/com/mini/mybigscreen/biz/controller/ChartInfoController.java index 28149c0..e664867 100644 --- a/src/main/java/com/mini/mybigscreen/biz/controller/ChartInfoController.java +++ b/src/main/java/com/mini/mybigscreen/biz/controller/ChartInfoController.java @@ -39,19 +39,20 @@ public class ChartInfoController { @PostMapping("setting") public Result save(@RequestBody List configs) { for (ChartConfig config : configs) { - if (!config.getChartId().equals(config.getOldChartId())){ - LambdaQueryWrapper newQuery = new LambdaQueryWrapper() - .eq(ChartInfo::getChartId, config.getChartId()) - .eq(ChartInfo::getChartCode, config.getChartCode()); - ChartInfo newChartInfo = chartInfoService.getOne(newQuery); - newChartInfo.setSort(config.getSort()); - chartInfoService.updateById(newChartInfo); - LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper() - .eq(ChartInfo::getChartId, config.getOldChartId()) - .eq(ChartInfo::getChartCode, config.getChartCode()) - .set(ChartInfo::getSort, null); - chartInfoService.update(updateWrapper); - } + LambdaQueryWrapper newQuery = new LambdaQueryWrapper() + .eq(ChartInfo::getChartId, config.getChartId()) + .eq(ChartInfo::getChartCode, config.getChartCode()); + ChartInfo newChartInfo = chartInfoService.getOne(newQuery); + newChartInfo.setSort(config.getSort()); + chartInfoService.updateById(newChartInfo); + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper() + .eq(ChartInfo::getChartId, config.getOldChartId()) + .eq(ChartInfo::getChartCode, config.getChartCode()) + .notIn(ChartInfo::getChartId, configs.stream() + .map(ChartConfig::getChartId) + .toList()) + .set(ChartInfo::getSort, null); + chartInfoService.update(updateWrapper); } return Result.success(new Message("配置保存成功", 200)); }