ソースを参照

2022-12-28 修改楼栋过滤没有布局图的数据,添加控制通风厨开关

chaiyunlong 3 年 前
コミット
986bf106ad

+ 22 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabSubMangerController.java

@@ -135,6 +135,28 @@ public class LabSubMangerController extends BaseController {
 
 
     /**
+     * 控制通风厨开关
+     *
+     * @return
+     */
+    @ApiOperation("控制通风厨开关")
+    @PreAuthorize(hasPermi = PerPrefix.LABORATORY_SUBCONTROL + PerFun.SET)
+    @PostMapping("/controlSwitch/{id}")
+    public ResultData controlSwitch(@PathVariable("id") @ApiParam("设备ID") Long id) {
+        Boolean control = false;
+        try {
+            control = subjectManagerService.control(id, Symbol.command.open);
+            Thread.sleep(500);
+            control = subjectManagerService.control(id, Symbol.command.close);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+        return ResultData.result(control,()->"电源控制失败!");
+    }
+
+
+
+    /**
      * 智能报警设备开关
      *
      * @return

+ 1 - 0
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabBuildFloorMapper.xml

@@ -109,6 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         left join lab_build_floor_layout l on t.id = l.floor_id
         left join lab_subject s on l.sub_id = s.id and (s.admin_id = #{adminId} or find_in_set(#{adminId}, s.safe_user_id))
         <where>
+            AND l.`id` IS NOT NULL
             <if test="parentId != null "> and t.parent_id = #{parentId}</if>
             <if test="type != null "> and t.`type` = #{type}</if>
         </where>