TDeviceController.java 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. package com.ruoyi.web.controller.business;
  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.business.domain.TDevice;
  19. import com.ruoyi.business.service.ITDeviceService;
  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-03-06
  27. */
  28. @RestController
  29. @RequestMapping("/business/device")
  30. public class TDeviceController extends BaseController
  31. {
  32. @Autowired
  33. private ITDeviceService tDeviceService;
  34. /**
  35. * 查询机构设备列表
  36. */
  37. // @PreAuthorize("@ss.hasPermi('business:device:list')")
  38. @GetMapping("/list")
  39. public TableDataInfo list(TDevice tDevice)
  40. {
  41. startPage();
  42. List<TDevice> list = tDeviceService.selectTDeviceList(tDevice);
  43. return getDataTable(list);
  44. }
  45. /**
  46. * 导出机构设备列表
  47. */
  48. // @PreAuthorize("@ss.hasPermi('business:device:export')")
  49. @Log(title = "机构设备", businessType = BusinessType.EXPORT)
  50. @PostMapping("/export")
  51. public void export(HttpServletResponse response, TDevice tDevice)
  52. {
  53. List<TDevice> list = tDeviceService.selectTDeviceList(tDevice);
  54. ExcelUtil<TDevice> util = new ExcelUtil<TDevice>(TDevice.class);
  55. util.exportExcel(response, list, "机构设备数据");
  56. }
  57. /**
  58. * 获取机构设备详细信息
  59. */
  60. // @PreAuthorize("@ss.hasPermi('business:device:query')")
  61. @GetMapping(value = "/{id}")
  62. public AjaxResult getInfo(@PathVariable("id") Long id)
  63. {
  64. return success(tDeviceService.selectTDeviceById(id));
  65. }
  66. /**
  67. * 新增机构设备
  68. */
  69. // @PreAuthorize("@ss.hasPermi('business:device:add')")
  70. @Log(title = "机构设备", businessType = BusinessType.INSERT)
  71. @PostMapping
  72. public AjaxResult add(@RequestBody TDevice tDevice)
  73. {
  74. return toAjax(tDeviceService.insertTDevice(tDevice));
  75. }
  76. /**
  77. * 修改机构设备
  78. */
  79. // @PreAuthorize("@ss.hasPermi('business:device:edit')")
  80. @Log(title = "机构设备", businessType = BusinessType.UPDATE)
  81. @PutMapping
  82. public AjaxResult edit(@RequestBody TDevice tDevice)
  83. {
  84. return toAjax(tDeviceService.updateTDevice(tDevice));
  85. }
  86. /**
  87. * 删除机构设备
  88. */
  89. // @PreAuthorize("@ss.hasPermi('business:device:remove')")
  90. @Log(title = "机构设备", businessType = BusinessType.DELETE)
  91. @DeleteMapping("/{ids}")
  92. public AjaxResult remove(@PathVariable Long[] ids)
  93. {
  94. return toAjax(tDeviceService.deleteTDeviceByIds(ids));
  95. }
  96. }