package com.xzl.web.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; import com.xzl.system.domain.SysSpiderAttachments; import com.xzl.web.service.ISysSpiderAttachmentsService; 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.xzl.common.annotation.Log; import com.xzl.common.core.controller.BaseController; import com.xzl.common.core.domain.AjaxResult; import com.xzl.common.enums.BusinessType; import com.xzl.common.utils.poi.ExcelUtil; import com.xzl.common.core.page.TableDataInfo; /** * 附件Controller * * @author xzl * @date 2025-11-13 */ @RestController @RequestMapping("/spiderData/attachments") public class SysSpiderAttachmentsController extends BaseController { @Autowired private ISysSpiderAttachmentsService sysSpiderAttachmentsService; /** * 查询附件列表 */ @PreAuthorize("@ss.hasPermi('spiderData:attachments:list')") @GetMapping("/list") public TableDataInfo list(SysSpiderAttachments sysSpiderAttachments) { startPage(); List list = sysSpiderAttachmentsService.selectSysSpiderAttachmentsList(sysSpiderAttachments); return getDataTable(list); } /** * 导出附件列表 */ @PreAuthorize("@ss.hasPermi('spiderData:attachments:export')") @Log(title = "附件", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, SysSpiderAttachments sysSpiderAttachments) { List list = sysSpiderAttachmentsService.selectSysSpiderAttachmentsList(sysSpiderAttachments); ExcelUtil util = new ExcelUtil(SysSpiderAttachments.class); util.exportExcel(response, list, "附件数据"); } /** * 获取附件详细信息 */ @PreAuthorize("@ss.hasPermi('spiderData:attachments:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return success(sysSpiderAttachmentsService.selectSysSpiderAttachmentsById(id)); } /** * 新增附件 */ @PreAuthorize("@ss.hasPermi('spiderData:attachments:add')") @Log(title = "附件", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody SysSpiderAttachments sysSpiderAttachments) { return toAjax(sysSpiderAttachmentsService.insertSysSpiderAttachments(sysSpiderAttachments)); } /** * 修改附件 */ @PreAuthorize("@ss.hasPermi('spiderData:attachments:edit')") @Log(title = "附件", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody SysSpiderAttachments sysSpiderAttachments) { return toAjax(sysSpiderAttachmentsService.updateSysSpiderAttachments(sysSpiderAttachments)); } /** * 删除附件 */ @PreAuthorize("@ss.hasPermi('spiderData:attachments:remove')") @Log(title = "附件", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(sysSpiderAttachmentsService.deleteSysSpiderAttachmentsByIds(ids)); } }