package com.cool.store.controller;

import com.cool.store.context.CurrentUserHolder;
import com.cool.store.dao.HyAdvancedSettingDAO;
import com.cool.store.request.AdvancedSettingRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.AdvanceSettingService;
import com.cool.store.vo.AdvancedSettingVO;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author suzhuhong
 * @Date 2023/6/14 20:48
 * @Version 1.0
 */
@RestController
@Slf4j
public class AdvanceSettingController {

    @Resource
    AdvanceSettingService advanceSettingService;

    @GetMapping(path = "/getAdvanceSetting")
    @ApiOperation("查询企业高级设置")
    public ResponseResult<AdvancedSettingVO> getAdvanceSetting(){
        return  ResponseResult.success(advanceSettingService.getAdvancedSettingDetail());
    }

    @GetMapping(path = "/changeAdvanceSetting")
    @ApiOperation("新增或者修改高级设置")
    public ResponseResult<Boolean> getAdvanceSetting(@RequestBody AdvancedSettingRequest advancedSettingRequest){
        return  ResponseResult.success(advanceSettingService.addOrUpdateAdvanceSetting(CurrentUserHolder.getUserId(),advancedSettingRequest));
    }





}
