package com.ruoyi.controller; import java.util.List; import javax.annotation.Resource; 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.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.cs.domain.CsAnnex; import com.ruoyi.cs.service.ICsAnnexService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** * 附件Controller * * @author ruoyi * @date 2024-04-30 */ @RestController @RequestMapping("/cs/csAnnex") public class CsAnnexController extends BaseController { @Resource private ICsAnnexService csAnnexService; /** * 查询附件列表 */ @PreAuthorize("@ss.hasPermi('cs:csAnnex:list')") @GetMapping("/list") public TableDataInfo list(CsAnnex csAnnex) { startPage(); csAnnex.setDelFlag("0"); List list = csAnnexService.selectCsAnnexList(csAnnex); return getDataTable(list); } /** * 导出附件列表 */ @PreAuthorize("@ss.hasPermi('cs:csAnnex:export')") @Log(title = "附件", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, CsAnnex csAnnex) { List list = csAnnexService.selectCsAnnexList(csAnnex); ExcelUtil util = new ExcelUtil(CsAnnex.class); util.exportExcel(response, list, "附件数据"); } /** * 获取附件详细信息 */ @PreAuthorize("@ss.hasPermi('cs:csAnnex:query')") @GetMapping(value = "/{annexId}") public AjaxResult getInfo(@PathVariable("annexId") String annexId) { return AjaxResult.success(csAnnexService.selectCsAnnexByAnnexId(annexId)); } /** * 新增附件 */ @PreAuthorize("@ss.hasPermi('cs:csAnnex:add')") @Log(title = "附件", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody CsAnnex csAnnex) { return toAjax(csAnnexService.insertCsAnnex(csAnnex)); } /** * 修改附件 */ @PreAuthorize("@ss.hasPermi('cs:csAnnex:edit')") @Log(title = "附件", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody CsAnnex csAnnex) { return toAjax(csAnnexService.updateCsAnnex(csAnnex)); } /** * 删除附件 */ @PreAuthorize("@ss.hasPermi('cs:csAnnex:remove')") @Log(title = "附件", businessType = BusinessType.DELETE) @DeleteMapping("/{annexIds}") public AjaxResult remove(@PathVariable String[] annexIds) { return toAjax(csAnnexService.deleteCsAnnexByAnnexIds(annexIds)); } }