package com.zyc.web.controller.api;

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.zyc.common.annotation.Log;
import com.zyc.common.core.controller.BaseController;
import com.zyc.common.core.domain.AjaxResult;
import com.zyc.common.enums.BusinessType;
import com.zyc.system.domain.GovernmentCloudDedicatedLine;
import com.zyc.system.service.IGovernmentCloudDedicatedLineService;
import com.zyc.common.utils.poi.ExcelUtil;
import com.zyc.common.core.page.TableDataInfo;

/**
 * 政务云专线Controller
 * 
 * @author zyc
 * @date 2024-12-26
 */
@RestController
@RequestMapping("/system/GovernmentCloudDedicatedLineController")
public class GovernmentCloudDedicatedLineController extends BaseController
{
    @Autowired
    private IGovernmentCloudDedicatedLineService governmentCloudDedicatedLineService;

    /**
     * 查询政务云专线列表
     */
    @PreAuthorize("@ss.hasPermi('system:line:list')")
    @GetMapping("/list")
    public TableDataInfo list(GovernmentCloudDedicatedLine governmentCloudDedicatedLine)
    {
        startPage();
        List<GovernmentCloudDedicatedLine> list = governmentCloudDedicatedLineService.selectGovernmentCloudDedicatedLineList(governmentCloudDedicatedLine);
        return getDataTable(list);
    }

    /**
     * 导出政务云专线列表
     */
    @PreAuthorize("@ss.hasPermi('system:line:export')")
    @Log(title = "政务云专线", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, GovernmentCloudDedicatedLine governmentCloudDedicatedLine)
    {
        List<GovernmentCloudDedicatedLine> list = governmentCloudDedicatedLineService.selectGovernmentCloudDedicatedLineList(governmentCloudDedicatedLine);
        ExcelUtil<GovernmentCloudDedicatedLine> util = new ExcelUtil<GovernmentCloudDedicatedLine>(GovernmentCloudDedicatedLine.class);
        util.exportExcel(response, list, "政务云专线数据");
    }

    /**
     * 获取政务云专线详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:line:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id)
    {
        return success(governmentCloudDedicatedLineService.selectGovernmentCloudDedicatedLineById(id));
    }

    /**
     * 新增政务云专线
     */
    @PreAuthorize("@ss.hasPermi('system:line:add')")
    @Log(title = "政务云专线", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody GovernmentCloudDedicatedLine governmentCloudDedicatedLine)
    {
        return toAjax(governmentCloudDedicatedLineService.insertGovernmentCloudDedicatedLine(governmentCloudDedicatedLine));
    }

    /**
     * 修改政务云专线
     */
    @PreAuthorize("@ss.hasPermi('system:line:edit')")
    @Log(title = "政务云专线", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody GovernmentCloudDedicatedLine governmentCloudDedicatedLine)
    {
        return toAjax(governmentCloudDedicatedLineService.updateGovernmentCloudDedicatedLine(governmentCloudDedicatedLine));
    }

    /**
     * 删除政务云专线
     */
    @PreAuthorize("@ss.hasPermi('system:line:remove')")
    @Log(title = "政务云专线", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids)
    {
        return toAjax(governmentCloudDedicatedLineService.deleteGovernmentCloudDedicatedLineByIds(ids));
    }
}
