GasThresholdController.java 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package com.huimv.admin.controller;
  2. import com.huimv.admin.common.utils.Result;
  3. import com.huimv.admin.entity.GasThreshold;
  4. import com.huimv.admin.entity.ProtThreshold;
  5. import com.huimv.admin.entity.vo.GasThresholdVo;
  6. import com.huimv.admin.service.IGasThresholdService;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.web.bind.annotation.CrossOrigin;
  9. import org.springframework.web.bind.annotation.RequestBody;
  10. import org.springframework.web.bind.annotation.RequestMapping;
  11. import org.springframework.web.bind.annotation.RestController;
  12. import javax.servlet.http.HttpServletRequest;
  13. import java.util.LinkedList;
  14. import java.util.List;
  15. import java.util.Map;
  16. /**
  17. * <p>
  18. * 气体阈值 前端控制器
  19. * </p>
  20. *
  21. * @author author
  22. * @since 2023-02-21
  23. */
  24. @RestController
  25. @RequestMapping("/gas-threshold")
  26. @CrossOrigin
  27. public class GasThresholdController {
  28. @Autowired
  29. private IGasThresholdService gasThresholdService;
  30. @RequestMapping("/list")
  31. public Result list(HttpServletRequest httpServletRequest, @RequestBody Map<String,String> paramsMap) {
  32. return gasThresholdService.list(httpServletRequest,paramsMap);
  33. }
  34. @RequestMapping("/edit")
  35. public Result list(HttpServletRequest httpServletRequest, @RequestBody GasThresholdVo gasThresholdVo) {
  36. String farmId = gasThresholdVo.getFarmId();
  37. GasThreshold gasThreshold = gasThresholdVo.getPigpen().setFarmId(Integer.parseInt(farmId));
  38. gasThreshold.setGasType(1);
  39. GasThreshold gasThreshold1 = gasThresholdVo.getPeople().setFarmId(Integer.parseInt(farmId));
  40. GasThreshold gasThreshold2 = gasThresholdVo.getAbove().setFarmId(Integer.parseInt(farmId));
  41. GasThreshold gasThreshold3 = gasThresholdVo.getUnder().setFarmId(Integer.parseInt(farmId));
  42. gasThreshold1.setGasType(4);
  43. gasThreshold2.setGasType(2);
  44. gasThreshold3.setGasType(3);
  45. List<GasThreshold> gasThresholds = new LinkedList<>();
  46. gasThresholds.add(gasThreshold);
  47. gasThresholds.add(gasThreshold1);
  48. gasThresholds.add(gasThreshold2);
  49. gasThresholds.add(gasThreshold3);
  50. return gasThresholdService.edit(httpServletRequest, gasThresholds);
  51. }
  52. }