package com.ruoyi.hezhi.controller; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.hezhi.domain.TbDownload; import com.ruoyi.hezhi.service.ITbDownloadService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.util.List; /** * 在线下载Controller * * @author ruoyi * @date 2024-10-30 */ @RestController @RequestMapping("/hezhi/download") public class TbDownloadController extends BaseController { @Autowired private ITbDownloadService tbDownloadService; /** * 查询在线下载列表 */ @PreAuthorize("@ss.hasPermi('hezhi:download:list')") @GetMapping("/list") public TableDataInfo list(TbDownload tbDownload) { startPage(); List list = tbDownloadService.selectTbDownloadList(tbDownload); return getDataTable(list); } /** * 导出在线下载列表 */ @PreAuthorize("@ss.hasPermi('hezhi:download:export')") @Log(title = "在线下载", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, TbDownload tbDownload) { List list = tbDownloadService.selectTbDownloadList(tbDownload); ExcelUtil util = new ExcelUtil(TbDownload.class); util.exportExcel(response, list, "在线下载数据"); } /** * 获取在线下载详细信息 */ @PreAuthorize("@ss.hasPermi('hezhi:download:query')") @GetMapping(value = "/{downloadId}") public AjaxResult getInfo(@PathVariable("downloadId") Long downloadId) { return success(tbDownloadService.selectTbDownloadByDownloadId(downloadId)); } /** * 新增在线下载 */ @PreAuthorize("@ss.hasPermi('hezhi:download:add')") @Log(title = "在线下载", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody TbDownload tbDownload) { return toAjax(tbDownloadService.insertTbDownload(tbDownload)); } /** * 修改在线下载 */ @PreAuthorize("@ss.hasPermi('hezhi:download:edit')") @Log(title = "在线下载", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody TbDownload tbDownload) { return toAjax(tbDownloadService.updateTbDownload(tbDownload)); } /** * 删除在线下载 */ @PreAuthorize("@ss.hasPermi('hezhi:download:remove')") @Log(title = "在线下载", businessType = BusinessType.DELETE) @DeleteMapping("/{downloadIds}") public AjaxResult remove(@PathVariable Long[] downloadIds) { return toAjax(tbDownloadService.deleteTbDownloadByDownloadIds(downloadIds)); } }