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