54 lines
1.7 KiB
Java
54 lines
1.7 KiB
Java
package com.xkrs.controller;
|
|
|
|
import com.xkrs.common.encapsulation.PromptMessageEnum;
|
|
import com.xkrs.model.qo.GlobalConfigDictQo;
|
|
import com.xkrs.service.GlobalConfigService;
|
|
import org.springframework.context.i18n.LocaleContextHolder;
|
|
import org.springframework.lang.Nullable;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import javax.annotation.Resource;
|
|
import java.util.Locale;
|
|
import java.util.Map;
|
|
|
|
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
|
|
|
/**
|
|
* 全局配置服务
|
|
*/
|
|
@RestController
|
|
public class ConfigGlobalController {
|
|
|
|
private final Locale locale = LocaleContextHolder.getLocale();
|
|
|
|
@Resource
|
|
private GlobalConfigService globalConfigService;
|
|
|
|
@GetMapping("/selectGlobalConfigDict")
|
|
public String selectGlobalConfigDict() {
|
|
return globalConfigService.selectGlobalConfigDict();
|
|
}
|
|
|
|
@GetMapping("/selectGlobalConfigValue")
|
|
public String selectGlobalConfigValue(@RequestParam(value = "code") Long code) {
|
|
Long value = globalConfigService.selectGlobalConfigValue(code);
|
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, value, locale);
|
|
}
|
|
|
|
@GetMapping("/selectGlobalConfig")
|
|
public String selectGlobalConfig(@RequestParam(required = false, value = "code") Long code) {
|
|
return globalConfigService.selectGlobalConfig(code);
|
|
}
|
|
|
|
@PostMapping("/globalConfig")
|
|
public String globalConfig(@Nullable @RequestBody Map<Long, Long> configMap) {
|
|
return globalConfigService.globalConfig(configMap);
|
|
}
|
|
|
|
@PostMapping("/globalConfigDict")
|
|
public String globalConfigDict(@RequestBody GlobalConfigDictQo globalConfigDictQo) {
|
|
return globalConfigService.globalConfigDict(globalConfigDictQo);
|
|
}
|
|
|
|
}
|