SeatController.java 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. package com.ruoyi.sim.controller;
  2. import java.util.List;
  3. import javax.servlet.http.HttpServletResponse;
  4. import com.ruoyi.sim.service.impl.SeatService;
  5. import io.swagger.annotations.Api;
  6. import io.swagger.annotations.ApiOperation;
  7. import org.springframework.security.access.prepost.PreAuthorize;
  8. import org.springframework.beans.factory.annotation.Autowired;
  9. import org.springframework.web.bind.annotation.GetMapping;
  10. import org.springframework.web.bind.annotation.PostMapping;
  11. import org.springframework.web.bind.annotation.PutMapping;
  12. import org.springframework.web.bind.annotation.DeleteMapping;
  13. import org.springframework.web.bind.annotation.PathVariable;
  14. import org.springframework.web.bind.annotation.RequestBody;
  15. import org.springframework.web.bind.annotation.RequestMapping;
  16. import org.springframework.web.bind.annotation.RestController;
  17. import com.ruoyi.common.annotation.Log;
  18. import com.ruoyi.common.core.controller.BaseController;
  19. import com.ruoyi.common.core.domain.AjaxResult;
  20. import com.ruoyi.common.enums.BusinessType;
  21. import com.ruoyi.sim.domain.Seat;
  22. import com.ruoyi.common.utils.poi.ExcelUtil;
  23. import com.ruoyi.common.core.page.TableDataInfo;
  24. /**
  25. * 座Controller
  26. *
  27. * @author tom
  28. * @date 2024-12-13
  29. */
  30. @RestController
  31. @RequestMapping("/sim/seat")
  32. @Api("座Controller")
  33. public class SeatController extends BaseController {
  34. @Autowired
  35. private SeatService seatService;
  36. /**
  37. * 查询座列表
  38. */
  39. // @PreAuthorize("@ss.hasPermi('sim:seat:list')")
  40. @GetMapping("/list")
  41. public TableDataInfo list(Seat seat) {
  42. startPage();
  43. List<Seat> list = seatService.selectSeatList(seat);
  44. return getDataTable(list);
  45. }
  46. /**
  47. * 查询全部座列表
  48. */
  49. // @PreAuthorize("@ss.hasPermi('sim:seat:list')")
  50. @GetMapping("/listAll")
  51. // @ApiOperation("[老师][轮询]查询全部座列表")
  52. public TableDataInfo listAll() {
  53. Seat seat = new Seat();
  54. startPage();
  55. List<Seat> list = seatService.selectSeatList(seat);
  56. return getDataTable(list);
  57. }
  58. /**
  59. * 导出座列表
  60. */
  61. // @PreAuthorize("@ss.hasPermi('sim:seat:export')")
  62. // @Log(title = "座", businessType = BusinessType.EXPORT)
  63. @PostMapping("/export")
  64. public void export(HttpServletResponse response, Seat seat) {
  65. List<Seat> list = seatService.selectSeatList(seat);
  66. ExcelUtil<Seat> util = new ExcelUtil<Seat>(Seat.class);
  67. util.exportExcel(response, list, "座数据");
  68. }
  69. /**
  70. * 获取座详细信息
  71. */
  72. // @PreAuthorize("@ss.hasPermi('sim:seat:query')")
  73. @GetMapping(value = "/{seatId}")
  74. public AjaxResult getInfo(@PathVariable("seatId") Long seatId) {
  75. return success(seatService.selectSeatBySeatId(seatId));
  76. }
  77. /**
  78. * 新增座
  79. */
  80. // @PreAuthorize("@ss.hasPermi('sim:seat:add')")
  81. // @Log(title = "座", businessType = BusinessType.INSERT)
  82. @PostMapping
  83. public AjaxResult add(@RequestBody Seat seat) {
  84. return toAjax(seatService.insertSeat(seat));
  85. }
  86. /**
  87. * 修改座
  88. */
  89. // @PreAuthorize("@ss.hasPermi('sim:seat:edit')")
  90. // @Log(title = "座", businessType = BusinessType.UPDATE)
  91. @PutMapping
  92. public AjaxResult edit(@RequestBody Seat seat) {
  93. return toAjax(seatService.updateSeat(seat));
  94. }
  95. /**
  96. * 删除座
  97. */
  98. // @PreAuthorize("@ss.hasPermi('sim:seat:remove')")
  99. // @Log(title = "座", businessType = BusinessType.DELETE)
  100. @DeleteMapping("/{seatIds}")
  101. public AjaxResult remove(@PathVariable Long[] seatIds) {
  102. return toAjax(seatService.deleteSeatBySeatIds(seatIds));
  103. }
  104. // -------------------------------- tom add --------------------------------
  105. @GetMapping("/listAllEnable")
  106. @ApiOperation("获取所有没有被禁用的座列表")
  107. public AjaxResult listAllEnable() {
  108. return seatService.listAllEnableAj();
  109. }
  110. }