package com.gxwebsoft.open.controller;

import com.gxwebsoft.common.core.annotation.OperationLog;
import com.gxwebsoft.common.core.utils.CacheClient;
import com.gxwebsoft.common.core.web.ApiResult;
import com.gxwebsoft.common.core.web.BaseController;
import com.gxwebsoft.common.system.entity.Setting;
import com.gxwebsoft.common.system.service.SettingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 系统设置控制器
 *
 * @author WebSoft
 * @since 2022-11-19 13:54:27
 */
@Api(tags = "系统设置管理")
@RestController
@RequestMapping("/api/open/system/setting")
public class OpenSettingController extends BaseController {
    @Resource
    private SettingService settingService;
    @Resource
    private CacheClient cacheClient;

    @ApiOperation("根据key查询系统设置")
    @GetMapping("/{settingKey}")
    public ApiResult<Setting> get(@PathVariable("settingKey") String settingKey) {
      final Setting data = settingService.getData(settingKey);
      return success(settingService.getData(settingKey));
    }
}
