ProBasicWindpowerstationController.java 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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.ProBasicWindpowerstation;
  5. import com.gyee.backconfig.service.auto.IProBasicWindpowerstationService;
  6. import com.gyee.backconfig.vo.WindpowerstationAdmVo;
  7. import com.gyee.common.model.StringUtils;
  8. import org.springframework.web.bind.annotation.*;
  9. import javax.annotation.Resource;
  10. import java.util.Arrays;
  11. import java.util.List;
  12. /**
  13. * <p>
  14. * 场站表 前端控制器
  15. * </p>
  16. *
  17. * @author wang
  18. * @since 2022-10-15
  19. */
  20. @RestController
  21. @RequestMapping("//pro-basic-windpowerstation")
  22. public class ProBasicWindpowerstationController {
  23. @Resource
  24. private IProBasicWindpowerstationService proBasicWindpowerstationService;
  25. /**
  26. * 查询
  27. *
  28. * @param id
  29. * @param name
  30. * @param code
  31. * @param companyId
  32. * @param pageNum
  33. * @param pageSize
  34. * @return
  35. */
  36. @GetMapping(value = "/List")
  37. public R findList(@RequestParam(value = "id", required = false) String id,
  38. @RequestParam(value = "name", required = false) String name,
  39. @RequestParam(value = "code", required = false) String code,
  40. @RequestParam(value = "companyId", required = false) String companyId,
  41. @RequestParam(value = "pageNum", required = true) String pageNum,
  42. @RequestParam(value = "pageSize", required = true) String pageSize) {
  43. IPage<ProBasicWindpowerstation> list = proBasicWindpowerstationService.getList(id, name, code, companyId, pageNum, pageSize);
  44. if (null != list) {
  45. return R.ok().data(list);
  46. } else {
  47. return R.error().data("查询失败!");
  48. }
  49. }
  50. /**
  51. * 插入(批量)
  52. *
  53. * @param proBasicWindpowerstation
  54. * @return
  55. */
  56. @PostMapping(value = "/add")
  57. public R addAll(@RequestBody ProBasicWindpowerstation proBasicWindpowerstation) {
  58. boolean b = proBasicWindpowerstationService.saveOrUpdate(proBasicWindpowerstation);
  59. if (b) {
  60. return R.ok().data(b);
  61. } else {
  62. return R.error().data("保存失败!");
  63. }
  64. }
  65. /**
  66. * 批量删除
  67. *
  68. * @param ids
  69. * @return
  70. */
  71. @DeleteMapping(value = "/{ids}")
  72. public R deleteAll(@PathVariable("ids") String ids) {
  73. String[] strings = ids.split(",");
  74. boolean b = proBasicWindpowerstationService.removeByIds(Arrays.asList(strings));
  75. if (b) {
  76. return R.ok().data(b);
  77. } else {
  78. return R.error().data("删除失败!");
  79. }
  80. }
  81. /**
  82. * 行政管理区域风电场列表
  83. * @param id
  84. * @param regionId
  85. * @param regionId
  86. * @return
  87. */
  88. @CrossOrigin(origins = "*", maxAge = 3600)
  89. @GetMapping(value = "/getAdmList")
  90. public R getAdmList(
  91. @RequestParam(value = "id",required = false) String id,
  92. @RequestParam(value = "regionId",required = false) String regionId,
  93. @RequestParam(value = "companyId",required = false) String companyId){
  94. try {
  95. List<WindpowerstationAdmVo> list = proBasicWindpowerstationService.getList(id,regionId,companyId);
  96. if (null != list){
  97. return R.ok().data(list);
  98. }else {
  99. return R.error().data("查询失败!");
  100. }
  101. } catch (Exception e) {
  102. e.printStackTrace();
  103. return R.error().data("查询失败!");
  104. }
  105. }
  106. }