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.GxtOrderScoreDetail;
import com.ygtx.gxt.service.IGxtOrderScoreDetailService;
import com.ygtx.common.utils.poi.ExcelUtil;
import com.ygtx.common.core.page.TableDataInfo;

/**
 * 工单个人分数明细Controller
 * 
 * @author ouyj
 * @date 2026-01-21
 */
@RestController
@RequestMapping("/gxt/orderScoreDetail")
public class GxtOrderScoreDetailController extends BaseController
{
    @Autowired
    private IGxtOrderScoreDetailService gxtOrderScoreDetailService;

    /**
     * 查询工单个人分数明细列表
     */
    @GetMapping("/list")
    public TableDataInfo list(GxtOrderScoreDetail gxtOrderScoreDetail)
    {
        startPage();
        List<GxtOrderScoreDetail> list = gxtOrderScoreDetailService.selectGxtOrderScoreDetailList(gxtOrderScoreDetail);
        return getDataTable(list);
    }

    /**
     * 导出工单个人分数明细列表
     */
    @Log(title = "工单个人分数明细", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, GxtOrderScoreDetail gxtOrderScoreDetail)
    {
        List<GxtOrderScoreDetail> list = gxtOrderScoreDetailService.selectGxtOrderScoreDetailList(gxtOrderScoreDetail);
        ExcelUtil<GxtOrderScoreDetail> util = new ExcelUtil<GxtOrderScoreDetail>(GxtOrderScoreDetail.class);
        util.exportExcel(response, list, "工单个人分数明细数据");
    }

    /**
     * 获取工单个人分数明细详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(gxtOrderScoreDetailService.selectGxtOrderScoreDetailById(id));
    }

    /**
     * 新增工单个人分数明细
     */
    @Log(title = "工单个人分数明细", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody GxtOrderScoreDetail gxtOrderScoreDetail)
    {
        return toAjax(gxtOrderScoreDetailService.insertGxtOrderScoreDetail(gxtOrderScoreDetail));
    }

    /**
     * 修改工单个人分数明细
     */
    @Log(title = "工单个人分数明细", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody GxtOrderScoreDetail gxtOrderScoreDetail)
    {
        return toAjax(gxtOrderScoreDetailService.updateGxtOrderScoreDetail(gxtOrderScoreDetail));
    }

    /**
     * 删除工单个人分数明细
     */
    @Log(title = "工单个人分数明细", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(gxtOrderScoreDetailService.deleteGxtOrderScoreDetailByIds(ids));
    }
}
