保存用户自选主题
This commit is contained in:
parent
bba3297181
commit
40f0367ed1
@ -40,14 +40,14 @@ public class ConfigController {
|
|||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建参数配置")
|
@Operation(summary = "创建参数配置")
|
||||||
@PreAuthorize("@ss.hasPermission('infra:config:create')")
|
// @PreAuthorize("@ss.hasPermission('infra:config:create')")
|
||||||
public CommonResult<Long> createConfig(@Valid @RequestBody ConfigSaveReqVO createReqVO) {
|
public CommonResult<Long> createConfig(@Valid @RequestBody ConfigSaveReqVO createReqVO) {
|
||||||
return success(configService.createConfig(createReqVO));
|
return success(configService.createConfig(createReqVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
@Operation(summary = "修改参数配置")
|
@Operation(summary = "修改参数配置")
|
||||||
@PreAuthorize("@ss.hasPermission('infra:config:update')")
|
// @PreAuthorize("@ss.hasPermission('infra:config:update')")
|
||||||
public CommonResult<Boolean> updateConfig(@Valid @RequestBody ConfigSaveReqVO updateReqVO) {
|
public CommonResult<Boolean> updateConfig(@Valid @RequestBody ConfigSaveReqVO updateReqVO) {
|
||||||
configService.updateConfig(updateReqVO);
|
configService.updateConfig(updateReqVO);
|
||||||
return success(true);
|
return success(true);
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
package com.lw.fx.theme;
|
package com.lw.fx.theme;
|
||||||
|
|
||||||
import atlantafx.base.theme.*;
|
import atlantafx.base.theme.*;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.lw.fx.Resources;
|
import com.lw.fx.Resources;
|
||||||
import com.lw.fx.event.DefaultEventBus;
|
import com.lw.fx.event.DefaultEventBus;
|
||||||
import com.lw.fx.event.EventBus;
|
import com.lw.fx.event.EventBus;
|
||||||
@ -88,16 +89,18 @@ public final class ThemeManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setTheme(String themeName) {
|
public void setTheme(String themeName) {
|
||||||
SamplerTheme samplerTheme = getDefaultTheme();
|
SamplerTheme samplerTheme = null;
|
||||||
// 使用Stream查找name为"abc"的SamplerTheme
|
// 使用Stream查找name为"abc"的SamplerTheme
|
||||||
Optional<SamplerTheme> result = getRepository().getAll().stream()
|
Optional<SamplerTheme> result = getRepository().getAll().stream()
|
||||||
.filter(theme -> themeName.equals(theme.getName()))
|
.filter(theme -> StrUtil.equals(themeName,theme.getName()))
|
||||||
.findFirst();
|
.findFirst();
|
||||||
|
|
||||||
// 处理查找到的结果
|
// 处理查找到的结果
|
||||||
if (result.isPresent()) {
|
if (result.isPresent()) {
|
||||||
samplerTheme = result.get();
|
samplerTheme = result.get();
|
||||||
|
|
||||||
|
}else {
|
||||||
|
samplerTheme=getDefaultTheme();
|
||||||
}
|
}
|
||||||
setTheme(samplerTheme);
|
setTheme(samplerTheme);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user