TCanteenSubmenuController.java 3.6 KB

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