大屏页面初始化
This commit is contained in:
18
src/main/java/com/mini/mybigscreen/Model/ChartConfig.java
Normal file
18
src/main/java/com/mini/mybigscreen/Model/ChartConfig.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package com.mini.mybigscreen.Model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class ChartConfig implements Serializable {
|
||||
|
||||
private Integer sort;
|
||||
private String chartId;
|
||||
private String oldChartId;
|
||||
private String chartName;
|
||||
|
||||
private String chartCode;
|
||||
private Integer oldSort;
|
||||
private String color;
|
||||
}
|
||||
@@ -2,13 +2,15 @@ package com.mini.mybigscreen.biz.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.mini.mybigscreen.Model.ChartConfig;
|
||||
import com.mini.mybigscreen.Model.Message;
|
||||
import com.mini.mybigscreen.Model.Result;
|
||||
import com.mini.mybigscreen.biz.domain.ChartInfo;
|
||||
import com.mini.mybigscreen.biz.service.ChartInfoService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -32,4 +34,23 @@ public class ChartInfoController {
|
||||
.orderByAsc(ChartInfo::getSort);
|
||||
return Result.success(chartInfoService.list(query));
|
||||
}
|
||||
|
||||
@PostMapping("setting")
|
||||
public Result<Message> save(@RequestBody List<ChartConfig> configs) {
|
||||
for (ChartConfig config : configs) {
|
||||
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);
|
||||
}
|
||||
return Result.success(new Message("配置保存成功", 200));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class ChartInfo implements Serializable {
|
||||
* 序号
|
||||
*/
|
||||
@TableField("sort")
|
||||
private Long sort;
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 组件名称
|
||||
|
||||
Reference in New Issue
Block a user