大屏项目初始化

This commit is contained in:
2026-03-11 21:53:42 +08:00
parent 8069e437dc
commit 429fe75039
4 changed files with 176 additions and 118 deletions

View File

@@ -2,6 +2,7 @@ package com.mini.mybigscreen.biz.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.mini.mybigscreen.Model.ChartConfig;
import com.mini.mybigscreen.Model.Message;
import com.mini.mybigscreen.Model.Result;
@@ -31,27 +32,26 @@ public class ChartInfoController {
public Result<?> getListAll(String chartCode) {
LambdaQueryWrapper<ChartInfo> query = new LambdaQueryWrapper<ChartInfo>()
.eq(StrUtil.isNotBlank(chartCode), ChartInfo::getChartCode, chartCode)
.orderByAsc(ChartInfo::getSort);
.orderByDesc(ChartInfo::getCreateTime);
return Result.success(chartInfoService.list(query));
}
@PostMapping("setting")
public Result<Message> save(@RequestBody List<ChartConfig> configs) {
for (ChartConfig config : configs) {
System.out.println(config);
// LambdaQueryWrapper<ChartInfo> newQuery = new LambdaQueryWrapper<ChartInfo>()
// .eq(ChartInfo::getChartId, config.getChartId())
// .eq(ChartInfo::getChartCode, config.getChartCode());
// ChartInfo newChartInfo = chartInfoService.getOne(newQuery);
// newChartInfo.setSort(config.getSort());
// chartInfoService.updateById(newChartInfo);
// LambdaQueryWrapper<ChartInfo> oldQuery = new LambdaQueryWrapper<ChartInfo>()
// .eq(ChartInfo::getChartId, config.getOldChartId())
// .eq(ChartInfo::getChartCode, config.getChartCode());
// ChartInfo oldChartInfo = chartInfoService.getOne(oldQuery);
// oldChartInfo.setSort(config.getOldSort());
// chartInfoService.updateById(oldChartInfo);
if (!config.getChartId().equals(config.getOldChartId())){
LambdaQueryWrapper<ChartInfo> newQuery = new LambdaQueryWrapper<ChartInfo>()
.eq(ChartInfo::getChartId, config.getChartId())
.eq(ChartInfo::getChartCode, config.getChartCode());
ChartInfo newChartInfo = chartInfoService.getOne(newQuery);
newChartInfo.setSort(config.getSort());
chartInfoService.updateById(newChartInfo);
LambdaUpdateWrapper<ChartInfo> updateWrapper = new LambdaUpdateWrapper<ChartInfo>()
.eq(ChartInfo::getChartId, config.getOldChartId())
.eq(ChartInfo::getChartCode, config.getChartCode())
.set(ChartInfo::getSort, null);
chartInfoService.update(updateWrapper);
}
}
return Result.success(new Message("配置保存成功", 200));
}