package com.dcs.hnyz.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.dcs.common.annotation.Log;
import com.dcs.common.core.controller.BaseController;
import com.dcs.common.core.domain.AjaxResult;
import com.dcs.common.enums.BusinessType;
import com.dcs.hnyz.domain.DcsGroupTaskLine;
import com.dcs.hnyz.service.IDcsGroupTaskLineService;
import com.dcs.common.utils.poi.ExcelUtil;
import com.dcs.common.core.page.TableDataInfo;

/**
 * 任务动作组明细Controller
 *
 * @author wuhb
 * @date 2025-08-04
 */
@RestController
@RequestMapping("/hnyz/groupTaskLine")
public class DcsGroupTaskLineController extends BaseController
{
    @Autowired
    private IDcsGroupTaskLineService dcsGroupTaskLineService;

    /**
     * 查询任务动作组明细列表
     */
    @PreAuthorize("@ss.hasPermi('hnyz:groupTaskLine:list')")
    @GetMapping("/list")
    public TableDataInfo list(DcsGroupTaskLine dcsGroupTaskLine)
    {
        startPage();
        List<DcsGroupTaskLine> list = dcsGroupTaskLineService.selectDcsGroupTaskLineList(dcsGroupTaskLine);
        return getDataTable(list);
    }

    /**
     * 导出任务动作组明细列表
     */
    @PreAuthorize("@ss.hasPermi('hnyz:groupTaskLine:export')")
    @Log(title = "任务动作组明细", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DcsGroupTaskLine dcsGroupTaskLine)
    {
        List<DcsGroupTaskLine> list = dcsGroupTaskLineService.selectDcsGroupTaskLineList(dcsGroupTaskLine);
        ExcelUtil<DcsGroupTaskLine> util = new ExcelUtil<DcsGroupTaskLine>(DcsGroupTaskLine.class);
        util.exportExcel(response, list, "任务动作组明细数据");
    }

    /**
     * 获取任务动作组明细详细信息
     */
    @PreAuthorize("@ss.hasPermi('hnyz:groupTaskLine:query')")
    @GetMapping(value = "/{lineId}")
    public AjaxResult getInfo(@PathVariable("lineId") Long lineId)
    {
        return success(dcsGroupTaskLineService.selectDcsGroupTaskLineByLineId(lineId));
    }

    /**
     * 新增任务动作组明细
     */
    @PreAuthorize("@ss.hasPermi('hnyz:groupTaskLine:add')")
    @Log(title = "任务动作组明细", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DcsGroupTaskLine dcsGroupTaskLine)
    {
        return toAjax(dcsGroupTaskLineService.insertDcsGroupTaskLine(dcsGroupTaskLine));
    }

    /**
     * 修改任务动作组明细
     */
    @PreAuthorize("@ss.hasPermi('hnyz:groupTaskLine:edit')")
    @Log(title = "任务动作组明细", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DcsGroupTaskLine dcsGroupTaskLine)
    {
        return toAjax(dcsGroupTaskLineService.updateDcsGroupTaskLine(dcsGroupTaskLine));
    }

    /**
     * 删除任务动作组明细
     */
    @PreAuthorize("@ss.hasPermi('hnyz:groupTaskLine:remove')")
    @Log(title = "任务动作组明细", businessType = BusinessType.DELETE)
	@DeleteMapping("/{lineIds}")
    public AjaxResult remove(@PathVariable Long[] lineIds)
    {
        return toAjax(dcsGroupTaskLineService.deleteDcsGroupTaskLineByLineIds(lineIds));
    }
}
