package cn.iocoder.yudao.module.inspection.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.inspection.entity.DelInspectionInfo;
import cn.iocoder.yudao.module.inspection.service.IDelInspectionInfoService;
import cn.iocoder.yudao.util.ExcelUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import cn.iocoder.yudao.module.core.controller.BaseController;

/**
 * 【请填写功能名称】Controller
 *
 * @author ruoyi
 * @date 2024-05-08
 */
@RestController
@RequestMapping("/admin-api/system/delInfo")
public class DelInspectionInfoController extends BaseController
{
    @Autowired
    private IDelInspectionInfoService delInspectionInfoService;

    /**
     * 查询【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('system:info:list')")
    @GetMapping("/list")
    public CommonResult list(DelInspectionInfo delInspectionInfo,
                             @RequestParam(value = "pageNum" ,required = false ,defaultValue = "1") Integer pageNum,
                             @RequestParam(value ="pageSize" ,required = false ,defaultValue = "10") Integer pageSize)
    {
        Page<DelInspectionInfo> page = new Page<>(pageNum, pageSize);
        IPage<DelInspectionInfo> list = delInspectionInfoService.selectDelInspectionInfoList(page,delInspectionInfo);
        return success(list);
    }

    /**
     * 导出【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('system:info:export')")
    @PostMapping("/export")
    public void export(HttpServletResponse response, DelInspectionInfo delInspectionInfo,
                       @RequestParam(value = "pageNum" ,required = false ,defaultValue = "1") Integer pageNum,
                       @RequestParam(value ="pageSize" ,required = false ,defaultValue = "10") Integer pageSize)
    {
        Page<DelInspectionInfo> page = new Page<>(pageNum, pageSize);
        IPage<DelInspectionInfo> list = delInspectionInfoService.selectDelInspectionInfoList(page,delInspectionInfo);
        ExcelUtil<DelInspectionInfo> util = new ExcelUtil<DelInspectionInfo>(DelInspectionInfo.class);
        util.exportExcel(response, list.getRecords(), "【请填写功能名称】数据");
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:info:query')")
    @GetMapping(value = "/{id}")
    public CommonResult getInfo(@PathVariable("id") Long id)
    {
        return success(delInspectionInfoService.selectDelInspectionInfoById(id));
    }

    /**
     * 新增【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:info:add')")
    @PostMapping
    public CommonResult add(@RequestBody DelInspectionInfo delInspectionInfo)
    {
        return toAjax(delInspectionInfoService.insertDelInspectionInfo(delInspectionInfo));
    }

    /**
     * 修改【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:info:edit')")
    @PutMapping
    public CommonResult edit(@RequestBody DelInspectionInfo delInspectionInfo)
    {
        return toAjax(delInspectionInfoService.updateDelInspectionInfo(delInspectionInfo));
    }

    /**
     * 删除【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:info:remove')")
	@DeleteMapping("/{ids}")
    public CommonResult remove(@PathVariable Long[] ids)
    {
        return toAjax(delInspectionInfoService.deleteDelInspectionInfoByIds(ids));
    }
}
