PatrolInspectionDeviceController.java 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. package com.bizmatics.controller.web;
  2. import com.bizmatics.common.core.bean.ApiResult;
  3. import com.bizmatics.model.PatrolInspectionDevice;
  4. import com.bizmatics.model.vo.PatrolInspectionDeviceVo;
  5. import com.bizmatics.service.PatrolInspectionDeviceService;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.web.bind.annotation.*;
  8. import org.springframework.web.multipart.MultipartFile;
  9. import javax.servlet.http.HttpServletRequest;
  10. import java.util.List;
  11. /**
  12. * 巡检管理-巡检设备
  13. *
  14. * @author ya
  15. * @since 2021-10-15
  16. */
  17. @RestController
  18. @RequestMapping("/patrolInspectionDevice")
  19. public class PatrolInspectionDeviceController {
  20. @Autowired
  21. private PatrolInspectionDeviceService patrolInspectionDeviceService;
  22. /**
  23. * 巡检管理-巡检设备-新增
  24. *
  25. * @param inspectionDeviceName 巡检设备名称
  26. * @param siteId 站点ID
  27. * @param deviceTypeId 设备类型
  28. * @return
  29. */
  30. @GetMapping("patrolInspectionDeviceAdd")
  31. public ApiResult<Void> patrolInspectionDeviceAdd(@RequestParam String inspectionDeviceName,
  32. @RequestParam Integer siteId,
  33. @RequestParam Integer deviceTypeId
  34. ) {
  35. patrolInspectionDeviceService.patrolInspectionDeviceAdd(inspectionDeviceName, siteId, deviceTypeId);
  36. return ApiResult.success();
  37. }
  38. /**
  39. * 巡检管理-巡检设备-修改
  40. *
  41. * @param patrolInspectionDevice
  42. * @return
  43. */
  44. @PostMapping("patrolInspectionDeviceUpdate")
  45. public ApiResult<Void> patrolInspectionDeviceUpdate(@RequestBody PatrolInspectionDevice patrolInspectionDevice
  46. ) {
  47. patrolInspectionDeviceService.patrolInspectionDeviceUpdate(patrolInspectionDevice);
  48. return ApiResult.success();
  49. }
  50. /**
  51. * 巡检管理-巡检设备-注销
  52. *
  53. * @param id 巡检设备ID
  54. * @return
  55. */
  56. @GetMapping("patrolInspectionDeviceDel")
  57. public ApiResult<Void> patrolInspectionDeviceDel(@RequestParam Integer id
  58. ) {
  59. patrolInspectionDeviceService.patrolInspectionDeviceDel(id);
  60. return ApiResult.success();
  61. }
  62. /**
  63. * 巡检管理-巡检设备-列表与回显查询
  64. *
  65. * @param id 巡检设备ID
  66. * @param siteId 站点ID
  67. * @param inspectionDeviceName 巡检设备名称
  68. * @return
  69. */
  70. @GetMapping("patrolInspectionDeviceList")
  71. public ApiResult<List<PatrolInspectionDeviceVo>> patrolInspectionDeviceList(@RequestParam(value = "id", required = false, defaultValue = "0") Integer id,
  72. @RequestParam(value = "siteId", required = false, defaultValue = "0") Integer siteId,
  73. @RequestParam(required = false) String inspectionDeviceName
  74. ) {
  75. return ApiResult.success(patrolInspectionDeviceService.patrolInspectionDeviceList(inspectionDeviceName, siteId, id));
  76. }
  77. /**
  78. * 通用图片上传
  79. *
  80. * @param file 图片
  81. * @param request
  82. * @return
  83. */
  84. @PostMapping("pictureUpload")
  85. public ApiResult<String> pictureUpload(@RequestParam(value = "file", required = false) MultipartFile file, HttpServletRequest request
  86. ) {
  87. return ApiResult.success(patrolInspectionDeviceService.pictureUpload(file, request));
  88. }
  89. }