ProEconEquipmentmodelController.java 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. package com.gyee.backconfig.controller;
  2. import com.baomidou.mybatisplus.core.metadata.IPage;
  3. import com.gyee.backconfig.config.R;
  4. import com.gyee.backconfig.model.auto.ProEconEquipmentmodel;
  5. import com.gyee.backconfig.service.auto.IProEconEquipmentmodelService;
  6. import io.swagger.annotations.Api;
  7. import io.swagger.annotations.ApiOperation;
  8. import org.springframework.web.bind.annotation.*;
  9. import javax.annotation.Resource;
  10. import java.util.Arrays;
  11. /**
  12. * <p>
  13. * 设备型号 前端控制器
  14. * </p>
  15. *
  16. * @author wang
  17. * @since 2022-10-15
  18. */
  19. @RestController
  20. @RequestMapping("//pro-econ-equipmentmodel")
  21. @Api(value = "设备型号配置" ,tags = "设备型号配置")
  22. public class ProEconEquipmentmodelController {
  23. @Resource
  24. private IProEconEquipmentmodelService proEconEquipmentmodelService;
  25. /**
  26. * 查询
  27. * @param id
  28. * @param nemCode
  29. * @param name
  30. * @param pageNum
  31. * @param pageSize
  32. * @return
  33. */
  34. @GetMapping(value = "/list")
  35. @ApiOperation(value = "设备型号-列表", notes = "设备型号-列表")
  36. public R findList(@RequestParam(value = "id", required = false) String id,
  37. @RequestParam(value = "nemCode", required = false) String nemCode,
  38. @RequestParam(value = "name", required = false) String name,
  39. @RequestParam(value = "pageNum", required = true) String pageNum,
  40. @RequestParam(value = "pageSize", required = true) String pageSize) {
  41. IPage<ProEconEquipmentmodel> list = proEconEquipmentmodelService.list(id, nemCode, name, pageNum, pageSize);
  42. if (null != list) {
  43. return R.ok().data(list);
  44. } else {
  45. return R.error().data("查询失败!");
  46. }
  47. }
  48. /**
  49. * 添加
  50. * @param proEconEquipmentmodel
  51. * @return
  52. */
  53. @PostMapping(value = "/add")
  54. @ApiOperation(value = "设备型号-新增or修改", notes = "设备型号-新增or修改")
  55. public R addAll(@RequestBody ProEconEquipmentmodel proEconEquipmentmodel) {
  56. boolean b = proEconEquipmentmodelService.saveOrUpdate(proEconEquipmentmodel);
  57. if (b) {
  58. return R.ok().data(b);
  59. } else {
  60. return R.error().data("保存失败!");
  61. }
  62. }
  63. /**
  64. * 删除
  65. * @param ids
  66. * @return
  67. */
  68. @DeleteMapping(value = "/{ids}")
  69. @ApiOperation(value = "设备型号-新增or修改", notes = "设备型号-新增or修改")
  70. public R deleteAll(@PathVariable("ids") String ids) {
  71. String[] strings = ids.split(",");
  72. boolean b = proEconEquipmentmodelService.removeByIds(Arrays.asList(strings));
  73. if (b) {
  74. return R.ok().data(b);
  75. } else {
  76. return R.error().data("删除失败!");
  77. }
  78. }
  79. }