ProBasicSubStationController.java 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package com.gyee.runeconomy.controller;
  2. import com.gyee.common.model.StringUtils;
  3. import com.gyee.runeconomy.dto.R;
  4. import com.gyee.runeconomy.dto.ResultMsg;
  5. import com.gyee.runeconomy.model.auto.ProBasicSubStation;
  6. import com.gyee.runeconomy.service.TokenService;
  7. import io.swagger.annotations.ApiOperation;
  8. import org.springframework.web.bind.annotation.GetMapping;
  9. import org.springframework.web.bind.annotation.RequestMapping;
  10. import org.springframework.web.bind.annotation.ResponseBody;
  11. import org.springframework.web.bind.annotation.RestController;
  12. import org.springframework.web.context.request.RequestContextHolder;
  13. import org.springframework.web.context.request.ServletRequestAttributes;
  14. import javax.annotation.Resource;
  15. import javax.servlet.http.HttpServletRequest;
  16. import java.util.List;
  17. /**
  18. * <p>
  19. * 调度场站名称 前端控制器
  20. * </p>
  21. *
  22. * @author wang
  23. * @since 2022-11-22
  24. */
  25. @RestController
  26. @RequestMapping("//substation")
  27. public class ProBasicSubStationController {
  28. @Resource
  29. private TokenService tokenService;
  30. @GetMapping("/queryall")
  31. @ResponseBody
  32. @ApiOperation(value = "获得升压站信息", notes = "获得升压站信息")
  33. public R queryAll() throws Exception {
  34. HttpServletRequest request = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest();
  35. List<ProBasicSubStation> sublist = tokenService.getSubwpls(request);
  36. if (StringUtils.isNotNull(sublist)) {
  37. return R.data(ResultMsg.ok(sublist));
  38. } else {
  39. return R.error(ResultMsg.error());
  40. }
  41. }
  42. }