package com.huatek.busi.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.huatek.busi.entity.LogoSetting;
import com.huatek.busi.service.ILogoSettingService;
import com.huatek.busi.vo.LogoSettingVo;
import com.huatek.torch.frame.tools.ConstantUtil;
import com.huatek.torch.frame.tools.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Api(tags = {"平台logo设置管理接口"})
@RestController
@RequestMapping("/api/logoSetting")
public class LogoSettingController {

    @Reference(check = false)
    ILogoSettingService logoSettingService;

    @ApiOperation(value = "显示平台logo设置信息",httpMethod="POST", notes= "显示平台logo设置信息", produces = "application/json;charset=utf-8", response= Map.class)
    @PostMapping(value = "/list", produces = { "application/json;charset=utf-8" })
    public Map<String, Object> findOne(){
        LogoSetting logoSetting = logoSettingService.findOne();
        return ResultUtil.put(ConstantUtil.REQUEST_SUCCESS, "BUSINESS.QUERY.SUCCESS", logoSetting);
    }

    @ApiOperation(value = "新增或更新平台logo设置信息",httpMethod="POST", notes= "新增或更新平台logo设置信息", produces = "application/json;charset=utf-8", response= Map.class)
    @PostMapping(value = "/saveOrUpdate", produces = { "application/json;charset=utf-8" })
    public Map<String, Object> saveOrUpdate(@RequestHeader("token") String token, @RequestBody LogoSettingVo logoSettingVo){
        return logoSettingService.saveOrUpdate(token, logoSettingVo);
    }
}
