package com.sf.deploy.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.sf.common.annotation.Log;
import com.sf.common.core.controller.BaseController;
import com.sf.common.core.domain.AjaxResult;
import com.sf.common.enums.BusinessType;
import com.sf.deploy.domain.SysApkInfo;
import com.sf.deploy.service.ISysApkInfoService;
import com.sf.common.utils.poi.ExcelUtil;
import com.sf.common.core.page.TableDataInfo;

/**
 * 安装包管理（新）Controller
 * 
 * @author ztzh
 * @date 2024-04-11
 */
@RestController
@RequestMapping("/deploy/INFO")
public class SysApkInfoController extends BaseController
{
    @Autowired
    private ISysApkInfoService sysApkInfoService;

    /**
     * 查询安装包管理（新）列表
     */
    @PreAuthorize("@ss.hasPermi('deploy:INFO:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysApkInfo sysApkInfo)
    {
        startPage();
        List<SysApkInfo> list = sysApkInfoService.selectSysApkInfoList(sysApkInfo);
        return getDataTable(list);
    }

    /**
     * 导出安装包管理（新）列表
     */
    @PreAuthorize("@ss.hasPermi('deploy:INFO:export')")
    @Log(title = "安装包管理（新）", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysApkInfo sysApkInfo)
    {
        List<SysApkInfo> list = sysApkInfoService.selectSysApkInfoList(sysApkInfo);
        ExcelUtil<SysApkInfo> util = new ExcelUtil<SysApkInfo>(SysApkInfo.class);
        util.exportExcel(response, list, "安装包管理（新）数据");
    }

    /**
     * 获取安装包管理（新）详细信息
     */
    @PreAuthorize("@ss.hasPermi('deploy:INFO:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(sysApkInfoService.selectSysApkInfoById(id));
    }

    /**
     * 新增安装包管理（新）
     */
    @PreAuthorize("@ss.hasPermi('deploy:INFO:add')")
    @Log(title = "安装包管理（新）", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysApkInfo sysApkInfo)
    {
        return toAjax(sysApkInfoService.insertSysApkInfo(sysApkInfo));
    }

    /**
     * 修改安装包管理（新）
     */
    @PreAuthorize("@ss.hasPermi('deploy:INFO:edit')")
    @Log(title = "安装包管理（新）", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysApkInfo sysApkInfo)
    {
        return toAjax(sysApkInfoService.updateSysApkInfo(sysApkInfo));
    }

    /**
     * 删除安装包管理（新）
     */
    @PreAuthorize("@ss.hasPermi('deploy:INFO:remove')")
    @Log(title = "安装包管理（新）", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(sysApkInfoService.deleteSysApkInfoByIds(ids));
    }
}
