package com.ygtx.gxt.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ygtx.common.annotation.Log;
import com.ygtx.common.core.controller.BaseController;
import com.ygtx.common.core.domain.AjaxResult;
import com.ygtx.common.enums.BusinessType;
import com.ygtx.gxt.domain.GxtCoefficientScore;
import com.ygtx.gxt.service.IGxtCoefficientScoreService;
import com.ygtx.common.utils.poi.ExcelUtil;
import com.ygtx.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;

/**
 * 系数与定检台数统计Controller
 * 
 * @author ruoyi
 * @date 2025-11-04
 */
@RestController
@RequestMapping("/gxt/coefficientscore")
@Api(tags = "系数与定检台数统计")
public class GxtCoefficientScoreController extends BaseController
{
    @Autowired
    private IGxtCoefficientScoreService gxtCoefficientScoreService;

    /**
     * 查询系数与定检台数统计列表
     */
    @ApiOperation("查询系数与定检台数统计列表")
    @GetMapping("/list")
    public TableDataInfo list(GxtCoefficientScore gxtCoefficientScore)
    {
        startPage();
        List<GxtCoefficientScore> list = gxtCoefficientScoreService.selectGxtCoefficientScoreList(gxtCoefficientScore);
        return getDataTable(list);
    }

    /**
     * 导出系数与定检台数统计列表
     */
    @Log(title = "系数与定检台数统计", businessType = BusinessType.EXPORT)
    @ApiOperation("导出系数与定检台数统计列表")
    @PostMapping("/export")
    public void export(HttpServletResponse response, GxtCoefficientScore gxtCoefficientScore)
    {
        List<GxtCoefficientScore> list = gxtCoefficientScoreService.selectGxtCoefficientScoreList(gxtCoefficientScore);
        ExcelUtil<GxtCoefficientScore> util = new ExcelUtil<GxtCoefficientScore>(GxtCoefficientScore.class);
        util.exportExcel(response, list, "系数与定检台数统计数据");
    }

    /**
     * 获取系数与定检台数统计详细信息
     */
    @ApiOperation("获取系数与定检台数统计详细信息")
    @ApiImplicitParam(name = "id", value = "主键ID", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(gxtCoefficientScoreService.selectGxtCoefficientScoreById(id));
    }

    /**
     * 新增系数与定检台数统计
     */
    @Log(title = "系数与定检台数统计", businessType = BusinessType.INSERT)
    @ApiOperation("新增系数与定检台数统计")
    @PostMapping
    public AjaxResult add(@RequestBody GxtCoefficientScore gxtCoefficientScore)
    {
        return toAjax(gxtCoefficientScoreService.insertGxtCoefficientScore(gxtCoefficientScore));
    }

    /**
     * 修改系数与定检台数统计
     */
    @Log(title = "系数与定检台数统计", businessType = BusinessType.UPDATE)
    @ApiOperation("修改系数与定检台数统计")
    @PutMapping
    public AjaxResult edit(@RequestBody GxtCoefficientScore gxtCoefficientScore)
    {
        return toAjax(gxtCoefficientScoreService.updateGxtCoefficientScore(gxtCoefficientScore));
    }

    /**
     * 删除系数与定检台数统计
     */
    @Log(title = "系数与定检台数统计", businessType = BusinessType.DELETE)
    @ApiOperation("删除系数与定检台数统计")
    @ApiImplicitParam(name = "ids", value = "主键ID数组", required = true, dataType = "Long[]", paramType = "path", dataTypeClass = Long[].class)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(gxtCoefficientScoreService.deleteGxtCoefficientScoreByIds(ids));
    }
}