PosFreightController.java 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. package com.ruoyi.app.order;
  2. import java.util.List;
  3. import jakarta.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.system.domain.PosFreight;
  19. import com.ruoyi.system.service.IPosFreightService;
  20. import com.ruoyi.common.utils.MessageUtils;
  21. import com.ruoyi.common.utils.poi.ExcelUtil;
  22. import com.ruoyi.common.core.page.TableDataInfo;
  23. /**
  24. * freightController
  25. *
  26. * @author ruoyi
  27. * @date 2023-07-15
  28. */
  29. @RestController
  30. @RequestMapping("/system/freight")
  31. public class PosFreightController extends BaseController
  32. {
  33. @Autowired
  34. private IPosFreightService posFreightService;
  35. /**
  36. * 查询freight列表
  37. */
  38. @PreAuthorize("@ss.hasPermi('system:freight:list')")
  39. @GetMapping("/list")
  40. public TableDataInfo list(PosFreight posFreight)
  41. {
  42. startPage();
  43. List<PosFreight> list = posFreightService.selectPosFreightList(posFreight);
  44. return getDataTable(list);
  45. }
  46. /**
  47. * 导出freight列表
  48. */
  49. @PreAuthorize("@ss.hasPermi('system:freight:export')")
  50. @Log(title = "freight", businessType = BusinessType.EXPORT)
  51. @PostMapping("/export")
  52. public void export(HttpServletResponse response, PosFreight posFreight)
  53. {
  54. List<PosFreight> list = posFreightService.selectPosFreightList(posFreight);
  55. ExcelUtil<PosFreight> util = new ExcelUtil<PosFreight>(PosFreight.class);
  56. util.exportExcel(response, list, MessageUtils.message("no.export.excel.freight"));
  57. }
  58. /**
  59. * 获取freight详细信息
  60. */
  61. @PreAuthorize("@ss.hasPermi('system:freight:query')")
  62. @GetMapping(value = "/{id}")
  63. public AjaxResult getInfo(@PathVariable("id") Long id)
  64. {
  65. return success(posFreightService.selectPosFreightById(id));
  66. }
  67. /**
  68. * 新增freight
  69. */
  70. @PreAuthorize("@ss.hasPermi('system:freight:add')")
  71. @Log(title = "freight", businessType = BusinessType.INSERT)
  72. @PostMapping
  73. public AjaxResult add(@RequestBody PosFreight posFreight)
  74. {
  75. return toAjax(posFreightService.insertPosFreight(posFreight));
  76. }
  77. /**
  78. * 修改freight
  79. */
  80. @PreAuthorize("@ss.hasPermi('system:freight:edit')")
  81. @Log(title = "freight", businessType = BusinessType.UPDATE)
  82. @PutMapping
  83. public AjaxResult edit(@RequestBody PosFreight posFreight)
  84. {
  85. return toAjax(posFreightService.updatePosFreight(posFreight));
  86. }
  87. /**
  88. * 删除freight
  89. */
  90. @PreAuthorize("@ss.hasPermi('system:freight:remove')")
  91. @Log(title = "freight", businessType = BusinessType.DELETE)
  92. @DeleteMapping("/{ids}")
  93. public AjaxResult remove(@PathVariable Long[] ids)
  94. {
  95. return toAjax(posFreightService.deletePosFreightByIds(ids));
  96. }
  97. }