package com.reyun.saas.web.controller.user;

import com.reyun.saas.common.framework.ApiRestController;
import com.reyun.saas.common.restResult.RestResult;
import com.reyun.saas.mob.user.service.ViewColumnService;
import com.reyun.saas.security.utils.SecurityUtils;
import com.reyun.saas.web.aop.Log;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;


/**
 * @desc
 * @date
 */
@Slf4j
@Api(value = "/viewColumn", tags = "指标管理")
@ApiRestController("viewColumn")
public class ViewColumnController {
    @Autowired
    private ViewColumnService viewColumnServiceImpl;

    @ApiOperation(value = "指标数据", produces = "application/json",notes = "")
    @GetMapping("find/{os}/{menu}")
    public RestResult find(@PathVariable String menu,@PathVariable String os){
        return viewColumnServiceImpl.find(menu,os,SecurityUtils.getLoginUserId());
    }

    @Log(value = 3, description = "保存选中的指标", type = 11)
    @ApiOperation(value = "保存选中的指标", produces = "application/json",notes = "")
    @GetMapping("save/{os}/{menu}")
    public RestResult save(@PathVariable String menu,@PathVariable String os,String viewcolumn){
        return viewColumnServiceImpl.save(menu,os,viewcolumn,SecurityUtils.getLoginUserId());
    }

}
