Browse Source

封装接口返回数据方法

crazycat 2 years ago
parent
commit
915f694993
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/main/java/com/welampiot/controller/ElectricBoxController.java

+ 3 - 0
src/main/java/com/welampiot/controller/ElectricBoxController.java

@@ -90,7 +90,10 @@ public class ElectricBoxController {
     @PostMapping("/airSwitchDetail")
     public BaseResult<AirSwitchInfoDTO> airSwitchDetail(HttpServletRequest request){
         Integer id = request.getParameter("id") == null ? 0 : Integer.parseInt(request.getParameter("id"));
+        Integer version = request.getParameter("version") == null ? 0 : Integer.parseInt(request.getParameter("version"));
+        if (id == 0) return toolUtils.response("0001",version);
         AirSwitchDetailVO airSwitchDetail = airSwitchInfoService.getAirSwitchDetail(id);
+        if (airSwitchDetail == null) return toolUtils.response("0001",version);
         return BaseResult.success(airSwitchDetail);
     }
 }