package com.ruoyi.reportpub.controller;

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

import org.springframework.security.access.prepost.PreAuthorize;
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.ruoyi.common.annotation.Log;

import java.util.Arrays;

import com.ruoyi.common.core.controller.BaseController;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.reportpub.domain.RzgLocarnoStatisticsInfo;
import com.ruoyi.reportpub.service.IRzgLocarnoStatisticsInfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 专利公开-洛迦诺统计Controller
 *
 * @author ruoyi
 * @date 2023-03-27
 */
@RestController
@RequestMapping("/reportpub/rzgLocarnoStatisticsInfo")
public class RzgLocarnoStatisticsInfoController extends BaseController {
    private final IRzgLocarnoStatisticsInfoService rzgLocarnoStatisticsInfoService;

    public RzgLocarnoStatisticsInfoController(IRzgLocarnoStatisticsInfoService rzgLocarnoStatisticsInfoService) {
        this.rzgLocarnoStatisticsInfoService = rzgLocarnoStatisticsInfoService;
    }


    /**
     * 查询专利公开-洛迦诺统计列表
     *
     * @param rzgLocarnoStatisticsInfo 专利公开-洛迦诺统计
     * @return 专利公开-洛迦诺统计集合
     * @date 2023-03-27
     */
    @PreAuthorize("@ss.hasPermi('reportpub:rzgLocarnoStatisticsInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(RzgLocarnoStatisticsInfo rzgLocarnoStatisticsInfo) {
        startPage();
        List<RzgLocarnoStatisticsInfo> list = rzgLocarnoStatisticsInfoService.queryList(rzgLocarnoStatisticsInfo);
        return getDataTable(list);
    }


    /**
     * 导出专利公开-洛迦诺统计列表
     *
     * @param rzgLocarnoStatisticsInfo 专利公开-洛迦诺统计
     * @date 2023-03-27
     */
    @PreAuthorize("@ss.hasPermi('reportpub:rzgLocarnoStatisticsInfo:export')")
    @Log(title = "专利公开-洛迦诺统计", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, RzgLocarnoStatisticsInfo rzgLocarnoStatisticsInfo) {
        List<RzgLocarnoStatisticsInfo> list = rzgLocarnoStatisticsInfoService.list(new QueryWrapper<>());
        ExcelUtil<RzgLocarnoStatisticsInfo> util = new ExcelUtil<>(RzgLocarnoStatisticsInfo. class);
        util.exportExcel(response, list, "专利公开-洛迦诺统计数据");
    }

    /**
     * 获取专利公开-洛迦诺统计详细信息
     *
     * @param id 主键id
     * @return 结果
     * @date 2023-03-27
     */
    @PreAuthorize("@ss.hasPermi('reportpub:rzgLocarnoStatisticsInfo:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success(rzgLocarnoStatisticsInfoService.getById(id));
    }


    /**
     * 新增专利公开-洛迦诺统计信息
     *
     * @param rzgLocarnoStatisticsInfo 专利公开-洛迦诺统计
     * @return 结果
     * @date 2023-03-27
     */
    @PreAuthorize("@ss.hasPermi('reportpub:rzgLocarnoStatisticsInfo:add')")
    @Log(title = "专利公开-洛迦诺统计", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody RzgLocarnoStatisticsInfo rzgLocarnoStatisticsInfo) {
        return toAjax(rzgLocarnoStatisticsInfoService.save(rzgLocarnoStatisticsInfo));
    }


    /**
     * 修改专利公开-洛迦诺统计信息
     *
     * @param rzgLocarnoStatisticsInfo 专利公开-洛迦诺统计
     * @return 结果
     * @date 2023-03-27
     */
    @PreAuthorize("@ss.hasPermi('reportpub:rzgLocarnoStatisticsInfo:edit')")
    @Log(title = "专利公开-洛迦诺统计", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody RzgLocarnoStatisticsInfo rzgLocarnoStatisticsInfo) {
        return toAjax(rzgLocarnoStatisticsInfoService.updateById(rzgLocarnoStatisticsInfo));
    }


    /**
     * 删除专利公开-洛迦诺统计信息
     *
     * @param ids 主键ids
     * @return 结果
     * @date 2023-03-27
     */
    @PreAuthorize("@ss.hasPermi('reportpub:rzgLocarnoStatisticsInfo:remove')")
    @Log(title = "专利公开-洛迦诺统计", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(rzgLocarnoStatisticsInfoService.removeByIds(Arrays.asList(ids)));
    }


}
