package com.ygtx.gxt.controller;

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

import com.ygtx.gxt.domain.GxtUserFanInspectionScore;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
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.GxtUserRepairProjectScore;
import com.ygtx.gxt.service.IGxtUserRepairProjectScoreService;
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/userrepairprojectscore")
@Api(tags = "维修项目得分")
public class GxtUserRepairProjectScoreController extends BaseController
{
    @Autowired
    private IGxtUserRepairProjectScoreService gxtUserRepairProjectScoreService;

    /**
     * 查询维修项目得分列表
     */
    @PreAuthorize("@ss.hasPermi('gxt:userrepairprojectscore:list')")
    @ApiOperation("查询维修项目得分列表")
    @GetMapping("/list")
    public TableDataInfo list(GxtUserRepairProjectScore gxtUserRepairProjectScore)
    {
        startPage();
        List<GxtUserRepairProjectScore> list = gxtUserRepairProjectScoreService.selectGxtUserRepairProjectScoreList(gxtUserRepairProjectScore);
        return getDataTable(list);
    }

    /**
     * 导出维修项目得分列表
     */
    @PreAuthorize("@ss.hasPermi('gxt:userrepairprojectscore:export')")
    @Log(title = "维修项目得分", businessType = BusinessType.EXPORT)
    @ApiOperation("导出维修项目得分列表")
    @PostMapping("/export")
    public void export(HttpServletResponse response, GxtUserRepairProjectScore gxtUserRepairProjectScore)
    {
        List<GxtUserRepairProjectScore> list = gxtUserRepairProjectScoreService.selectGxtUserRepairProjectScoreList(gxtUserRepairProjectScore);
        ExcelUtil<GxtUserRepairProjectScore> util = new ExcelUtil<GxtUserRepairProjectScore>(GxtUserRepairProjectScore.class);
        util.exportExcel(response, list, "维修项目得分数据");
    }

    /**
     * 获取维修项目得分详细信息
     */
    @PreAuthorize("@ss.hasPermi('gxt:userrepairprojectscore: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(gxtUserRepairProjectScoreService.selectGxtUserRepairProjectScoreById(id));
    }

    /**
     * 新增维修项目得分
     */
    @PreAuthorize("@ss.hasPermi('gxt:userrepairprojectscore:add')")
    @Log(title = "维修项目得分", businessType = BusinessType.INSERT)
    @ApiOperation("新增维修项目得分")
    @PostMapping
    public AjaxResult add(@RequestBody GxtUserRepairProjectScore gxtUserRepairProjectScore)
    {
        return toAjax(gxtUserRepairProjectScoreService.insertGxtUserRepairProjectScore(gxtUserRepairProjectScore));
    }

    /**
     * 修改维修项目得分
     */
    @PreAuthorize("@ss.hasPermi('gxt:userrepairprojectscore:edit')")
    @Log(title = "维修项目得分", businessType = BusinessType.UPDATE)
    @ApiOperation("修改维修项目得分")
    @PutMapping
    public AjaxResult edit(@RequestBody GxtUserRepairProjectScore gxtUserRepairProjectScore)
    {
        return toAjax(gxtUserRepairProjectScoreService.updateGxtUserRepairProjectScore(gxtUserRepairProjectScore));
    }

    /**
     * 删除维修项目得分
     */
    @PreAuthorize("@ss.hasPermi('gxt:userrepairprojectscore: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(gxtUserRepairProjectScoreService.deleteGxtUserRepairProjectScoreByIds(ids));
    }
}