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.BigDataComputeServices;
import com.zyc.system.service.IBigDataComputeServicesService;
import com.zyc.common.utils.poi.ExcelUtil;
import com.zyc.common.core.page.TableDataInfo;

/**
 * 大数据计算服务Controller
 * 
 * @author zyc
 * @date 2024-12-26
 */
@RestController
@RequestMapping("/system/BigDataComputeServicesController")
public class BigDataComputeServicesController extends BaseController
{
    @Autowired
    private IBigDataComputeServicesService bigDataComputeServicesService;

    /**
     * 查询大数据计算服务列表
     */
    @PreAuthorize("@ss.hasPermi('system:services:list')")
    @GetMapping("/list")
    public TableDataInfo list(BigDataComputeServices bigDataComputeServices)
    {
        startPage();
        List<BigDataComputeServices> list = bigDataComputeServicesService.selectBigDataComputeServicesList(bigDataComputeServices);
        return getDataTable(list);
    }

    /**
     * 导出大数据计算服务列表
     */
    @PreAuthorize("@ss.hasPermi('system:services:export')")
    @Log(title = "大数据计算服务", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BigDataComputeServices bigDataComputeServices)
    {
        List<BigDataComputeServices> list = bigDataComputeServicesService.selectBigDataComputeServicesList(bigDataComputeServices);
        ExcelUtil<BigDataComputeServices> util = new ExcelUtil<BigDataComputeServices>(BigDataComputeServices.class);
        util.exportExcel(response, list, "大数据计算服务数据");
    }

    /**
     * 获取大数据计算服务详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:services:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id)
    {
        return success(bigDataComputeServicesService.selectBigDataComputeServicesById(id));
    }

    /**
     * 新增大数据计算服务
     */
    @PreAuthorize("@ss.hasPermi('system:services:add')")
    @Log(title = "大数据计算服务", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BigDataComputeServices bigDataComputeServices)
    {
        return toAjax(bigDataComputeServicesService.insertBigDataComputeServices(bigDataComputeServices));
    }

    /**
     * 修改大数据计算服务
     */
    @PreAuthorize("@ss.hasPermi('system:services:edit')")
    @Log(title = "大数据计算服务", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BigDataComputeServices bigDataComputeServices)
    {
        return toAjax(bigDataComputeServicesService.updateBigDataComputeServices(bigDataComputeServices));
    }

    /**
     * 删除大数据计算服务
     */
    @PreAuthorize("@ss.hasPermi('system:services:remove')")
    @Log(title = "大数据计算服务", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids)
    {
        return toAjax(bigDataComputeServicesService.deleteBigDataComputeServicesByIds(ids));
    }
}
