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

/**
 * 鲲鹏桌面云云硬盘存储Controller
 * 
 * @author zyc
 * @date 2024-12-26
 */
@RestController
@RequestMapping("/system/KunpengDesktopCloudStorageController")
public class KunpengDesktopCloudStorageController extends BaseController
{
    @Autowired
    private IKunpengDesktopCloudStorageService kunpengDesktopCloudStorageService;

    /**
     * 查询鲲鹏桌面云云硬盘存储列表
     */
    @PreAuthorize("@ss.hasPermi('system:storage:list')")
    @GetMapping("/list")
    public TableDataInfo list(KunpengDesktopCloudStorage kunpengDesktopCloudStorage)
    {
        startPage();
        List<KunpengDesktopCloudStorage> list = kunpengDesktopCloudStorageService.selectKunpengDesktopCloudStorageList(kunpengDesktopCloudStorage);
        return getDataTable(list);
    }

    /**
     * 导出鲲鹏桌面云云硬盘存储列表
     */
    @PreAuthorize("@ss.hasPermi('system:storage:export')")
    @Log(title = "鲲鹏桌面云云硬盘存储", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, KunpengDesktopCloudStorage kunpengDesktopCloudStorage)
    {
        List<KunpengDesktopCloudStorage> list = kunpengDesktopCloudStorageService.selectKunpengDesktopCloudStorageList(kunpengDesktopCloudStorage);
        ExcelUtil<KunpengDesktopCloudStorage> util = new ExcelUtil<KunpengDesktopCloudStorage>(KunpengDesktopCloudStorage.class);
        util.exportExcel(response, list, "鲲鹏桌面云云硬盘存储数据");
    }

    /**
     * 获取鲲鹏桌面云云硬盘存储详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:storage:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id)
    {
        return success(kunpengDesktopCloudStorageService.selectKunpengDesktopCloudStorageById(id));
    }

    /**
     * 新增鲲鹏桌面云云硬盘存储
     */
    @PreAuthorize("@ss.hasPermi('system:storage:add')")
    @Log(title = "鲲鹏桌面云云硬盘存储", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody KunpengDesktopCloudStorage kunpengDesktopCloudStorage)
    {
        return toAjax(kunpengDesktopCloudStorageService.insertKunpengDesktopCloudStorage(kunpengDesktopCloudStorage));
    }

    /**
     * 修改鲲鹏桌面云云硬盘存储
     */
    @PreAuthorize("@ss.hasPermi('system:storage:edit')")
    @Log(title = "鲲鹏桌面云云硬盘存储", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody KunpengDesktopCloudStorage kunpengDesktopCloudStorage)
    {
        return toAjax(kunpengDesktopCloudStorageService.updateKunpengDesktopCloudStorage(kunpengDesktopCloudStorage));
    }

    /**
     * 删除鲲鹏桌面云云硬盘存储
     */
    @PreAuthorize("@ss.hasPermi('system:storage:remove')")
    @Log(title = "鲲鹏桌面云云硬盘存储", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids)
    {
        return toAjax(kunpengDesktopCloudStorageService.deleteKunpengDesktopCloudStorageByIds(ids));
    }
}
