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

/**
 * APM应用性能管理服务Controller
 * 
 * @author zyc
 * @date 2024-12-26
 */
@RestController
@RequestMapping("/system/ApmApplicationPerformanceManagementServicesController")
public class ApmApplicationPerformanceManagementServicesController extends BaseController
{
    @Autowired
    private IApmApplicationPerformanceManagementServicesService apmApplicationPerformanceManagementServicesService;

    /**
     * 查询APM应用性能管理服务列表
     */
    @PreAuthorize("@ss.hasPermi('system:services:list')")
    @GetMapping("/list")
    public TableDataInfo list(ApmApplicationPerformanceManagementServices apmApplicationPerformanceManagementServices)
    {
        startPage();
        List<ApmApplicationPerformanceManagementServices> list = apmApplicationPerformanceManagementServicesService.selectApmApplicationPerformanceManagementServicesList(apmApplicationPerformanceManagementServices);
        return getDataTable(list);
    }

    /**
     * 导出APM应用性能管理服务列表
     */
    @PreAuthorize("@ss.hasPermi('system:services:export')")
    @Log(title = "APM应用性能管理服务", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ApmApplicationPerformanceManagementServices apmApplicationPerformanceManagementServices)
    {
        List<ApmApplicationPerformanceManagementServices> list = apmApplicationPerformanceManagementServicesService.selectApmApplicationPerformanceManagementServicesList(apmApplicationPerformanceManagementServices);
        ExcelUtil<ApmApplicationPerformanceManagementServices> util = new ExcelUtil<ApmApplicationPerformanceManagementServices>(ApmApplicationPerformanceManagementServices.class);
        util.exportExcel(response, list, "APM应用性能管理服务数据");
    }

    /**
     * 获取APM应用性能管理服务详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:services:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id)
    {
        return success(apmApplicationPerformanceManagementServicesService.selectApmApplicationPerformanceManagementServicesById(id));
    }

    /**
     * 新增APM应用性能管理服务
     */
    @PreAuthorize("@ss.hasPermi('system:services:add')")
    @Log(title = "APM应用性能管理服务", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ApmApplicationPerformanceManagementServices apmApplicationPerformanceManagementServices)
    {
        return toAjax(apmApplicationPerformanceManagementServicesService.insertApmApplicationPerformanceManagementServices(apmApplicationPerformanceManagementServices));
    }

    /**
     * 修改APM应用性能管理服务
     */
    @PreAuthorize("@ss.hasPermi('system:services:edit')")
    @Log(title = "APM应用性能管理服务", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ApmApplicationPerformanceManagementServices apmApplicationPerformanceManagementServices)
    {
        return toAjax(apmApplicationPerformanceManagementServicesService.updateApmApplicationPerformanceManagementServices(apmApplicationPerformanceManagementServices));
    }

    /**
     * 删除APM应用性能管理服务
     */
    @PreAuthorize("@ss.hasPermi('system:services:remove')")
    @Log(title = "APM应用性能管理服务", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids)
    {
        return toAjax(apmApplicationPerformanceManagementServicesService.deleteApmApplicationPerformanceManagementServicesByIds(ids));
    }
}
