猫妈狗爸伴宠师小程序后端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
3.5 KiB

1 year ago
  1. package com.ruoyi.catdog.controller;
  2. import java.io.IOException;
  3. import java.util.List;
  4. import javax.servlet.http.HttpServletResponse;
  5. import org.springframework.security.access.prepost.PreAuthorize;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.web.bind.annotation.GetMapping;
  8. import org.springframework.web.bind.annotation.PostMapping;
  9. import org.springframework.web.bind.annotation.PutMapping;
  10. import org.springframework.web.bind.annotation.DeleteMapping;
  11. import org.springframework.web.bind.annotation.PathVariable;
  12. import org.springframework.web.bind.annotation.RequestBody;
  13. import org.springframework.web.bind.annotation.RequestMapping;
  14. import org.springframework.web.bind.annotation.RestController;
  15. import com.ruoyi.common.annotation.Log;
  16. import com.ruoyi.common.core.controller.BaseController;
  17. import com.ruoyi.common.core.domain.AjaxResult;
  18. import com.ruoyi.common.enums.BusinessType;
  19. import com.ruoyi.catdog.domain.CleanItems;
  20. import com.ruoyi.catdog.service.ICleanItemsService;
  21. import com.ruoyi.common.utils.poi.ExcelUtil;
  22. import com.ruoyi.common.core.page.TableDataInfo;
  23. /**
  24. * 清洁物品Controller
  25. *
  26. * @author ruoyi
  27. * @date 2025-03-02
  28. */
  29. @RestController
  30. @RequestMapping("/catdog/items")
  31. public class CleanItemsController extends BaseController
  32. {
  33. @Autowired
  34. private ICleanItemsService cleanItemsService;
  35. /**
  36. * 查询清洁物品列表
  37. */
  38. @PreAuthorize("@ss.hasPermi('catdog:items:list')")
  39. @GetMapping("/list")
  40. public TableDataInfo list(CleanItems cleanItems)
  41. {
  42. startPage();
  43. List<CleanItems> list = cleanItemsService.selectCleanItemsList(cleanItems);
  44. return getDataTable(list);
  45. }
  46. /**
  47. * 导出清洁物品列表
  48. */
  49. @PreAuthorize("@ss.hasPermi('catdog:items:export')")
  50. @Log(title = "清洁物品", businessType = BusinessType.EXPORT)
  51. @PostMapping("/export")
  52. public void export(HttpServletResponse response, CleanItems cleanItems) throws IOException {
  53. List<CleanItems> list = cleanItemsService.selectCleanItemsList(cleanItems);
  54. ExcelUtil<CleanItems> util = new ExcelUtil<CleanItems>(CleanItems.class);
  55. util.exportExcel(response, list, "清洁物品数据");
  56. }
  57. /**
  58. * 获取清洁物品详细信息
  59. */
  60. @PreAuthorize("@ss.hasPermi('catdog:items:query')")
  61. @GetMapping(value = "/{cleanItemsId}")
  62. public AjaxResult getInfo(@PathVariable("cleanItemsId") Long cleanItemsId)
  63. {
  64. // return success(cleanItemsService.selectCleanItemsByCleanItemsId(cleanItemsId));
  65. return null;
  66. }
  67. /**
  68. * 新增清洁物品
  69. */
  70. @PreAuthorize("@ss.hasPermi('catdog:items:add')")
  71. @Log(title = "清洁物品", businessType = BusinessType.INSERT)
  72. @PostMapping
  73. public AjaxResult add(@RequestBody CleanItems cleanItems)
  74. {
  75. return toAjax(cleanItemsService.insertCleanItems(cleanItems));
  76. }
  77. /**
  78. * 修改清洁物品
  79. */
  80. @PreAuthorize("@ss.hasPermi('catdog:items:edit')")
  81. @Log(title = "清洁物品", businessType = BusinessType.UPDATE)
  82. @PutMapping
  83. public AjaxResult edit(@RequestBody CleanItems cleanItems)
  84. {
  85. return toAjax(cleanItemsService.updateCleanItems(cleanItems));
  86. }
  87. /**
  88. * 删除清洁物品
  89. */
  90. @PreAuthorize("@ss.hasPermi('catdog:items:remove')")
  91. @Log(title = "清洁物品", businessType = BusinessType.DELETE)
  92. @DeleteMapping("/{cleanItemsIds}")
  93. public AjaxResult remove(@PathVariable Long[] cleanItemsIds)
  94. {
  95. return toAjax(cleanItemsService.deleteCleanItemsByCleanItemsIds(cleanItemsIds));
  96. }
  97. }