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.ResultGrade;
import com.lz.modules.flow.model.ResultGradeDto;
import com.lz.modules.flow.service.ResultGradeService;
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("/resultGrade")
@Api(tags = "考核等级")
public class ResultGradeController {


    @Autowired
    private ResultGradeService resultGradeService;



    @GetMapping("/get375")
    @ApiOperation("获取3.75分等级列表")
    @ApiResponses({@ApiResponse(code = 200, message = "成功", response = ResultGradeDto.class)})
    public R get375() {
        List<ResultGradeDto> resultGradeDtos = resultGradeService.selectResultGradeByGroupId(1L);
        return R.ok().put("data",resultGradeDtos);
    }


     @RequestMapping("/getById")
     public R getById(@RequestBody ResultGrade resultGrade) {
        resultGrade = resultGradeService.selectResultGradeById(resultGrade.getId());
        return R.ok().put("data",resultGrade);
     }


     @RequestMapping("/update")
     public R update(@RequestBody ResultGrade resultGrade) {
        resultGradeService.updateResultGradeById(resultGrade);
        return R.ok();
     }


     @RequestMapping("/save")
        public R save(@RequestBody ResultGrade resultGrade) {
        resultGradeService.insertResultGrade(resultGrade);
        return R.ok();
     }


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