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 org.springframework.web.bind.annotation.RequestParam;
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.GxtUserFanInspectionScore;
import com.ygtx.gxt.service.IGxtUserFanInspectionScoreService;
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-06
 */
@RestController
@RequestMapping("/gxt/userfanscore")
@Api(tags = "维保风机类型检查得分")
public class GxtUserFanInspectionScoreController extends BaseController
{
    @Autowired
    private IGxtUserFanInspectionScoreService gxtUserFanInspectionScoreService;

    /**
     * 查询维保风机类型检查得分列表
     */
    @PreAuthorize("@ss.hasPermi('gxt:userfanscore:list')")
    @ApiOperation("查询维保风机类型检查得分列表")
    @GetMapping("/list")
    public TableDataInfo list(GxtUserFanInspectionScore gxtUserFanInspectionScore)
    {
        startPage();
        List<GxtUserFanInspectionScore> list = gxtUserFanInspectionScoreService.selectGxtUserFanInspectionScoreList(gxtUserFanInspectionScore);
        return getDataTable(list);
    }

    /**
     * 导出维保风机类型检查得分列表
     */
    @PreAuthorize("@ss.hasPermi('gxt:userfanscore:export')")
    @Log(title = "维保风机类型检查得分", businessType = BusinessType.EXPORT)
    @ApiOperation("导出维保风机类型检查得分列表")
    @PostMapping("/export")
    public void export(HttpServletResponse response, GxtUserFanInspectionScore gxtUserFanInspectionScore)
    {
        List<GxtUserFanInspectionScore> list = gxtUserFanInspectionScoreService.selectGxtUserFanInspectionScoreList(gxtUserFanInspectionScore);
        ExcelUtil<GxtUserFanInspectionScore> util = new ExcelUtil<GxtUserFanInspectionScore>(GxtUserFanInspectionScore.class);
        util.exportExcel(response, list, "维保风机类型检查得分数据");
    }

    /**
     * 获取维保风机类型检查得分详细信息
     */
    @PreAuthorize("@ss.hasPermi('gxt:userfanscore:query')")
    @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(gxtUserFanInspectionScoreService.selectGxtUserFanInspectionScoreById(id));
    }

    /**
     * 新增维保风机类型检查得分
     */
    @PreAuthorize("@ss.hasPermi('gxt:userfanscore:add')")
    @Log(title = "维保风机类型检查得分", businessType = BusinessType.INSERT)
    @ApiOperation("新增维保风机类型检查得分")
    @PostMapping
    public AjaxResult add(@RequestBody GxtUserFanInspectionScore gxtUserFanInspectionScore)
    {
        return toAjax(gxtUserFanInspectionScoreService.insertGxtUserFanInspectionScore(gxtUserFanInspectionScore));
    }

    /**
     * 修改维保风机类型检查得分
     */
    @PreAuthorize("@ss.hasPermi('gxt:userfanscore:edit')")
    @Log(title = "维保风机类型检查得分", businessType = BusinessType.UPDATE)
    @ApiOperation("修改维保风机类型检查得分")
    @PutMapping
    public AjaxResult edit(@RequestBody GxtUserFanInspectionScore gxtUserFanInspectionScore)
    {
        return toAjax(gxtUserFanInspectionScoreService.updateGxtUserFanInspectionScore(gxtUserFanInspectionScore));
    }

    /**
     * 删除维保风机类型检查得分
     */
    @PreAuthorize("@ss.hasPermi('gxt:userfanscore:remove')")
    @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(gxtUserFanInspectionScoreService.deleteGxtUserFanInspectionScoreByIds(ids));
    }
}