package com.hs.api.controller;

import com.hs.api.common.Result;
import com.hs.api.common.annotations.Token;
import com.hs.api.model.reqmodel.SysConfigReq;
import com.hs.api.service.SysConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "系统配置 Api")
@RestController
public class SysConfigController {
    @Autowired
    private SysConfigService sysConfigService;

    /**
     * 根据key查询系统配置
     *
     * @return
     */
    @PostMapping("getSysConfigByKey")
    @Token
    @ApiOperation("根据key查询系统配置")
    public Result<Boolean> sysConfigReq(@RequestBody SysConfigReq sysConfigReq) {
        boolean state = sysConfigService.getSysConfigStateByKey(sysConfigReq.getKey());
        return Result.success(state);
    }
}
