package com.securitycontrol.system.base.controller;

import com.securitycontrol.common.core.web.controller.BaseController;
import com.securitycontrol.common.core.web.domain.AjaxResult;
import com.securitycontrol.common.core.web.page.TableDataInfo;
import com.securitycontrol.common.log.annotation.Log;
import com.securitycontrol.common.log.enums.OperationType;
import com.securitycontrol.entity.system.base.dto.TeamQuEvalDto;
import com.securitycontrol.entity.system.base.vo.TeamQuEvalVo;
import com.securitycontrol.system.base.service.ITeamQuEvalService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author：cwchen
 * @date：2024-03-13-17:50
 * @version：1.0
 * @description：班组质量评价-web
 */
@RestController
@RequestMapping("/base/teamQuEval/")
public class TeamQuEvalController extends BaseController {

    @Resource(name = "ITeamQuEvalService")
    private ITeamQuEvalService service;

    @ApiOperation(value = "获取班组质量评价列表")
    @GetMapping("getTeamQuEvalLists")
    @Log(title = "基础管理", menu = "基础管理->班组质量评价", grade = OperationType.QUERY_BUSINESS, details = "查询班组质量评价", type = "业务日志")
    public TableDataInfo getTeamQuEvalLists(TeamQuEvalDto dto) {
        startPage();
        List<TeamQuEvalVo> list = service.getTeamQuEvalLists(dto);
        return getDataTable(list);
    }

    @ApiOperation(value = "新增班组质量评价")
    @PostMapping("addTeamEval")
    @Log(title = "基础管理", menu = "基础管理->班组质量评价", grade = OperationType.ADD_BUSINESS, details = "新增班组质量评价", type = "业务日志")
    public AjaxResult addTeamEval(@RequestBody TeamQuEvalVo vo) {
        return service.addOrUpdateTeamEval(vo);
    }

    @ApiOperation(value = "修改班组质量评价")
    @PostMapping("editTeamEval")
    @Log(title = "基础管理", menu = "基础管理->班组质量评价", grade = OperationType.UPDATE_BUSINESS, details = "修改班组质量评价", type = "业务日志")
    public AjaxResult editTeamEval(@RequestBody TeamQuEvalVo vo) {
        return service.addOrUpdateTeamEval(vo);
    }

    @ApiOperation(value = "班组质量评价详情")
    @GetMapping("getTeamEvalById")
    public AjaxResult getTeamEvalById(TeamQuEvalDto dto) {
        return service.getTeamEvalById(dto);
    }

    @ApiOperation(value = "删除质量评价详情")
    @PostMapping("delTeamEvalById")
    @Log(title = "基础管理", menu = "基础管理->班组质量评价", grade = OperationType.DELETE_BUSINESS, details = "删除班组质量评价", type = "业务日志")
    public AjaxResult delTeamEvalById(@RequestBody TeamQuEvalDto dto) {
        return service.delTeamEvalById(dto);
    }
}
