package com.ruoyi.catdog.controller; import java.io.IOException; import java.util.List; 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.catdog.domain.CleanItems; import com.ruoyi.catdog.service.ICleanItemsService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** * 清洁物品Controller * * @author ruoyi * @date 2025-03-02 */ @RestController @RequestMapping("/catdog/items") public class CleanItemsController extends BaseController { @Autowired private ICleanItemsService cleanItemsService; /** * 查询清洁物品列表 */ @PreAuthorize("@ss.hasPermi('catdog:items:list')") @GetMapping("/list") public TableDataInfo list(CleanItems cleanItems) { startPage(); List list = cleanItemsService.selectCleanItemsList(cleanItems); return getDataTable(list); } /** * 导出清洁物品列表 */ @PreAuthorize("@ss.hasPermi('catdog:items:export')") @Log(title = "清洁物品", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, CleanItems cleanItems) throws IOException { List list = cleanItemsService.selectCleanItemsList(cleanItems); ExcelUtil util = new ExcelUtil(CleanItems.class); util.exportExcel(response, list, "清洁物品数据"); } /** * 获取清洁物品详细信息 */ @PreAuthorize("@ss.hasPermi('catdog:items:query')") @GetMapping(value = "/{cleanItemsId}") public AjaxResult getInfo(@PathVariable("cleanItemsId") Long cleanItemsId) { // return success(cleanItemsService.selectCleanItemsByCleanItemsId(cleanItemsId)); return null; } /** * 新增清洁物品 */ @PreAuthorize("@ss.hasPermi('catdog:items:add')") @Log(title = "清洁物品", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody CleanItems cleanItems) { return toAjax(cleanItemsService.insertCleanItems(cleanItems)); } /** * 修改清洁物品 */ @PreAuthorize("@ss.hasPermi('catdog:items:edit')") @Log(title = "清洁物品", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody CleanItems cleanItems) { return toAjax(cleanItemsService.updateCleanItems(cleanItems)); } /** * 删除清洁物品 */ @PreAuthorize("@ss.hasPermi('catdog:items:remove')") @Log(title = "清洁物品", businessType = BusinessType.DELETE) @DeleteMapping("/{cleanItemsIds}") public AjaxResult remove(@PathVariable Long[] cleanItemsIds) { return toAjax(cleanItemsService.deleteCleanItemsByCleanItemsIds(cleanItemsIds)); } }