package com.hs.api.controller;

import com.hs.api.common.Result;
import com.hs.api.common.annotations.Token;
import com.hs.api.model.reqmodel.ReqDimValue;
import com.hs.api.model.respmodel.DimValue;
import com.hs.api.service.DicDimService;
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;

import javax.validation.Valid;
import java.util.List;

@Api(tags = "维度数值Api")
@RestController
public class DimController {
    @Autowired
    private DicDimService dicDimService;

    /**
     * 根据pageCode查询维度数值
     *
     * @return
     * @throws Exception
     */
    @PostMapping("dimValue")
    @Token
    @ApiOperation("根据pageCode查询维度数值")
    public Object getdimValueByPageCode(@RequestBody @Valid ReqDimValue reqDimValue) {
        List<DimValue> dimValueList = dicDimService.getByPageCode(reqDimValue.getPageCode(),reqDimValue.getOrgId(),reqDimValue.getDate());
        return Result.success(dimValueList);
    }
}
