猫妈狗爸伴宠师小程序后端代码
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.

104 lines
3.7 KiB

1 month ago
  1. package com.ruoyi.model.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.model.domain.AppCleanItems;
  20. import com.ruoyi.model.service.IAppCleanItemsService;
  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-10
  28. */
  29. @RestController
  30. @RequestMapping("/model/AppCleanItems")
  31. public class AppCleanItemsController extends BaseController
  32. {
  33. @Autowired
  34. private IAppCleanItemsService appCleanItemsService;
  35. /**
  36. * 查询清洁物品列表
  37. */
  38. @PreAuthorize("@ss.hasPermi('model:AppCleanItems:list')")
  39. @GetMapping("/list")
  40. public TableDataInfo list(AppCleanItems appCleanItems)
  41. {
  42. startPage();
  43. List<AppCleanItems> list = appCleanItemsService.selectAppCleanItemsList(appCleanItems);
  44. return getDataTable(list);
  45. }
  46. /**
  47. * 导出清洁物品列表
  48. */
  49. @PreAuthorize("@ss.hasPermi('model:AppCleanItems:export')")
  50. @Log(title = "清洁物品", businessType = BusinessType.EXPORT)
  51. @PostMapping("/export")
  52. public void export(HttpServletResponse response, AppCleanItems appCleanItems) throws IOException {
  53. List<AppCleanItems> list = appCleanItemsService.selectAppCleanItemsList(appCleanItems);
  54. ExcelUtil<AppCleanItems> util = new ExcelUtil<AppCleanItems>(AppCleanItems.class);
  55. util.exportExcel(response, list, "清洁物品数据");
  56. }
  57. /**
  58. * 获取清洁物品详细信息
  59. */
  60. @PreAuthorize("@ss.hasPermi('model:AppCleanItems:query')")
  61. @GetMapping(value = "/{cleanItemsId}")
  62. public AjaxResult getInfo(@PathVariable("cleanItemsId") Long cleanItemsId)
  63. {
  64. return success(appCleanItemsService.selectAppCleanItemsByCleanItemsId(cleanItemsId));
  65. }
  66. /**
  67. * 新增清洁物品
  68. */
  69. @PreAuthorize("@ss.hasPermi('model:AppCleanItems:add')")
  70. @Log(title = "清洁物品", businessType = BusinessType.INSERT)
  71. @PostMapping
  72. public AjaxResult add(@RequestBody AppCleanItems appCleanItems)
  73. {
  74. return toAjax(appCleanItemsService.insertAppCleanItems(appCleanItems));
  75. }
  76. /**
  77. * 修改清洁物品
  78. */
  79. @PreAuthorize("@ss.hasPermi('model:AppCleanItems:edit')")
  80. @Log(title = "清洁物品", businessType = BusinessType.UPDATE)
  81. @PutMapping
  82. public AjaxResult edit(@RequestBody AppCleanItems appCleanItems)
  83. {
  84. return toAjax(appCleanItemsService.updateAppCleanItems(appCleanItems));
  85. }
  86. /**
  87. * 删除清洁物品
  88. */
  89. @PreAuthorize("@ss.hasPermi('model:AppCleanItems:remove')")
  90. @Log(title = "清洁物品", businessType = BusinessType.DELETE)
  91. @DeleteMapping("/{cleanItemsIds}")
  92. public AjaxResult remove(@PathVariable Long[] cleanItemsIds)
  93. {
  94. return toAjax(appCleanItemsService.deleteAppCleanItemsByCleanItemsIds(cleanItemsIds));
  95. }
  96. }