package com.kcim.web;

import com.kcim.common.util.Result;
import com.kcim.service.CenterService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: CostAccount
 * @description: 公用接口 用于调用中台开放接口
 * @author: Wang.YS
 * @create: 2023-10-18 17:11
 **/
@RestController
@Api(tags = "成本开放接口用于调用中台")
@RequestMapping("common")
@AllArgsConstructor
public class CommonController {

    CenterService centerService;

    @GetMapping("getAllDict")
    @ApiOperation("获取所有字典")
    public Result getAllDict(){
        return Result.ok(centerService.getAllDict());
    }

    @GetMapping("getDict")
    @ApiOperation("获取指定字典")
    public Result getDict(@RequestParam String dictType){
        return Result.ok(centerService.getDict(dictType));
    }

    @GetMapping("getSystemDict")
    @ApiOperation("获取成本系统所有字典")
    public Result getSystemDict(){
        return Result.ok(centerService.getAllDictBySystemId());
    }

    @GetMapping("getCenterDict")
    @ApiOperation("获取中台指定字典")
    public Result getCenterDict(@RequestParam String dictType){
        return Result.ok(centerService.getCenterDict(dictType));
    }



}
