Merge branch 'v1.7' of github.com:dataease/dataease into v1.7

This commit is contained in:
taojinlong 2022-01-24 17:24:21 +08:00
commit 10d2cd431f

View File

@ -75,13 +75,14 @@ public class ChartViewService {
checkName(chartView); checkName(chartView);
long timestamp = System.currentTimeMillis(); long timestamp = System.currentTimeMillis();
chartView.setUpdateTime(timestamp); chartView.setUpdateTime(timestamp);
int i = chartViewMapper.updateByPrimaryKeySelective(chartView); if (ObjectUtils.isEmpty(chartView.getId())) {
if (i == 0) {
chartView.setId(UUID.randomUUID().toString()); chartView.setId(UUID.randomUUID().toString());
chartView.setCreateBy(AuthUtils.getUser().getUsername()); chartView.setCreateBy(AuthUtils.getUser().getUsername());
chartView.setCreateTime(timestamp); chartView.setCreateTime(timestamp);
chartView.setUpdateTime(timestamp); chartView.setUpdateTime(timestamp);
chartViewMapper.insertSelective(chartView); chartViewMapper.insertSelective(chartView);
} else {
chartViewMapper.updateByPrimaryKeySelective(chartView);
} }
Optional.ofNullable(chartView.getId()).ifPresent(id -> { Optional.ofNullable(chartView.getId()).ifPresent(id -> {
CacheUtils.remove(JdbcConstants.VIEW_CACHE_KEY, id); CacheUtils.remove(JdbcConstants.VIEW_CACHE_KEY, id);
@ -216,8 +217,10 @@ public class ChartViewService {
if (ObjectUtils.isEmpty(view)) { if (ObjectUtils.isEmpty(view)) {
throw new RuntimeException(Translator.get("i18n_chart_delete")); throw new RuntimeException(Translator.get("i18n_chart_delete"));
} }
List<ChartViewFieldDTO> xAxis = new Gson().fromJson(view.getXAxis(), new TypeToken<List<ChartViewFieldDTO>>() {}.getType()); List<ChartViewFieldDTO> xAxis = new Gson().fromJson(view.getXAxis(), new TypeToken<List<ChartViewFieldDTO>>() {
List<ChartViewFieldDTO> yAxis = new Gson().fromJson(view.getYAxis(), new TypeToken<List<ChartViewFieldDTO>>() {}.getType()); }.getType());
List<ChartViewFieldDTO> yAxis = new Gson().fromJson(view.getYAxis(), new TypeToken<List<ChartViewFieldDTO>>() {
}.getType());
if (StringUtils.equalsIgnoreCase(view.getType(), "chart-mix")) { if (StringUtils.equalsIgnoreCase(view.getType(), "chart-mix")) {
List<ChartViewFieldDTO> yAxisExt = new Gson().fromJson(view.getYAxisExt(), new TypeToken<List<ChartViewFieldDTO>>() { List<ChartViewFieldDTO> yAxisExt = new Gson().fromJson(view.getYAxisExt(), new TypeToken<List<ChartViewFieldDTO>>() {
}.getType()); }.getType());