package com.lz.modules.performance.controller;


import com.alibaba.fastjson.JSONObject;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R;
import com.lz.common.utils.StringUtil;
import com.lz.modules.flow.entity.ResultDimension;
import com.lz.modules.flow.model.ResultDimensionDto;
import com.lz.modules.flow.service.ResultDimensionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/resultDimension")
@Api(tags = "考核维度类型")
public class ResultDimensionController {


    @Autowired
    private ResultDimensionService resultDimensionService;



    @GetMapping("/getDimensions")
    @ApiOperation("获取维度类型")
    @ApiResponses({@ApiResponse(code = 200, message = "成功", response = ResultDimensionDto.class)})
    public R getDimensions() {
        List<ResultDimension> resultDimensions
         = resultDimensionService.selectResultDimensionAll();
        return R.ok().put("data",resultDimensions);
    }

     @RequestMapping("/getById")
     public R getById(@RequestBody ResultDimension resultDimension) {
        resultDimension = resultDimensionService.selectResultDimensionById(resultDimension.getId());
        return R.ok().put("resultDimension",resultDimension);
     }


     @RequestMapping("/update")
     public R update(@RequestBody ResultDimension resultDimension) {
        resultDimensionService.updateResultDimensionById(resultDimension);
        return R.ok();
     }


     @RequestMapping("/save")
        public R save(@RequestBody ResultDimension resultDimension) {
        resultDimensionService.insertResultDimension(resultDimension);
        return R.ok();
     }


    @RequestMapping("/delete")
    public R list(@RequestBody Long id) {
        resultDimensionService.deleteResultDimensionById(id);
        return R.ok();
     }
}
