wukai 3 недель назад
Родитель
Сommit
ddd547dab5

+ 2 - 0
jjt-admin/src/main/java/com/jjt/biz/controller/AlgorithmConfigController.java

@@ -4,6 +4,7 @@ import java.util.List;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 
+import com.jjt.common.utils.SecurityUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -46,6 +47,7 @@ public class AlgorithmConfigController extends BaseController{
     public TableDataInfo list(AlgorithmConfig algorithmConfig)
     {
         startPage();
+        algorithmConfig.getParams().put("deptId", SecurityUtils.getDeptId());
         List<AlgorithmConfig> list = algorithmConfigService.selectAlgorithmConfigList(algorithmConfig);
         return getDataTable(list);
     }

+ 2 - 0
jjt-admin/src/main/java/com/jjt/biz/controller/DeviceConfigController.java

@@ -7,6 +7,7 @@ import com.jjt.common.core.controller.BaseController;
 import com.jjt.common.core.domain.AjaxResult;
 import com.jjt.common.core.page.TableDataInfo;
 import com.jjt.common.enums.BusinessType;
+import com.jjt.common.utils.SecurityUtils;
 import com.jjt.common.utils.poi.ExcelUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -37,6 +38,7 @@ public class DeviceConfigController extends BaseController {
     @GetMapping("/list")
     public TableDataInfo list(DeviceConfig deviceConfig) {
         startPage();
+        deviceConfig.getParams().put("deptId", SecurityUtils.getDeptId());
         List<DeviceConfig> list = deviceConfigService.selectDeviceConfigList(deviceConfig);
         return getDataTable(list);
     }

+ 21 - 33
jjt-admin/src/main/java/com/jjt/biz/controller/FlowsConfigController.java

@@ -1,28 +1,21 @@
 package com.jjt.biz.controller;
 
-import java.util.List;
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletResponse;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import com.jjt.biz.domain.FlowsConfig;
+import com.jjt.biz.service.IFlowsConfigService;
 import com.jjt.common.annotation.Log;
 import com.jjt.common.core.controller.BaseController;
 import com.jjt.common.core.domain.AjaxResult;
+import com.jjt.common.core.page.TableDataInfo;
 import com.jjt.common.enums.BusinessType;
-import com.jjt.biz.domain.FlowsConfig;
-import com.jjt.biz.service.IFlowsConfigService;
+import com.jjt.common.utils.SecurityUtils;
 import com.jjt.common.utils.poi.ExcelUtil;
-import com.jjt.common.core.page.TableDataInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 /**
  * 流程管理Controller
@@ -30,10 +23,10 @@ import com.jjt.common.core.page.TableDataInfo;
  * @author wukai
  * @date 2025-10-14
  */
-@Api(tags="流程管理")
+@Api(tags = "流程管理")
 @RestController
 @RequestMapping("/biz/fc")
-public class FlowsConfigController extends BaseController{
+public class FlowsConfigController extends BaseController {
     @Resource
     private IFlowsConfigService flowsConfigService;
 
@@ -43,9 +36,9 @@ public class FlowsConfigController extends BaseController{
     @ApiOperation("查询流程管理列表")
     //@PreAuthorize("@ss.hasPermi('biz:fc:list')")
     @GetMapping("/list")
-    public TableDataInfo list(FlowsConfig flowsConfig)
-    {
+    public TableDataInfo list(FlowsConfig flowsConfig) {
         startPage();
+        flowsConfig.getParams().put("deptId", SecurityUtils.getDeptId());
         List<FlowsConfig> list = flowsConfigService.selectFlowsConfigList(flowsConfig);
         return getDataTable(list);
     }
@@ -57,8 +50,7 @@ public class FlowsConfigController extends BaseController{
     //@PreAuthorize("@ss.hasPermi('biz:fc:export')")
     @Log(title = "流程管理", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, FlowsConfig flowsConfig)
-    {
+    public void export(HttpServletResponse response, FlowsConfig flowsConfig) {
         List<FlowsConfig> list = flowsConfigService.selectFlowsConfigList(flowsConfig);
         ExcelUtil<FlowsConfig> util = new ExcelUtil<FlowsConfig>(FlowsConfig.class);
         util.exportExcel(response, list, "流程管理数据");
@@ -70,8 +62,7 @@ public class FlowsConfigController extends BaseController{
     @ApiOperation("获取流程管理详细信息")
     //@PreAuthorize("@ss.hasPermi('biz:fc:query')")
     @GetMapping(value = "/{flowsId}")
-    public AjaxResult getInfo(@PathVariable("flowsId") Long flowsId)
-    {
+    public AjaxResult getInfo(@PathVariable("flowsId") Long flowsId) {
         return success(flowsConfigService.selectFlowsConfigByFlowsId(flowsId));
     }
 
@@ -82,8 +73,7 @@ public class FlowsConfigController extends BaseController{
     //@PreAuthorize("@ss.hasPermi('biz:fc:add')")
     @Log(title = "流程管理", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody FlowsConfig flowsConfig)
-    {
+    public AjaxResult add(@RequestBody FlowsConfig flowsConfig) {
         return toAjax(flowsConfigService.insertFlowsConfig(flowsConfig));
     }
 
@@ -94,8 +84,7 @@ public class FlowsConfigController extends BaseController{
     //@PreAuthorize("@ss.hasPermi('biz:fc:edit')")
     @Log(title = "流程管理", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody FlowsConfig flowsConfig)
-    {
+    public AjaxResult edit(@RequestBody FlowsConfig flowsConfig) {
         return toAjax(flowsConfigService.updateFlowsConfig(flowsConfig));
     }
 
@@ -105,9 +94,8 @@ public class FlowsConfigController extends BaseController{
     @ApiOperation("删除流程管理")
     //@PreAuthorize("@ss.hasPermi('biz:fc:remove')")
     @Log(title = "流程管理", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{flowsIds}")
-    public AjaxResult remove(@PathVariable Long[] flowsIds)
-    {
+    @DeleteMapping("/{flowsIds}")
+    public AjaxResult remove(@PathVariable Long[] flowsIds) {
         return toAjax(flowsConfigService.deleteFlowsConfigByFlowsIds(flowsIds));
     }
 }

+ 21 - 33
jjt-admin/src/main/java/com/jjt/biz/controller/SensorConfigController.java

@@ -1,28 +1,21 @@
 package com.jjt.biz.controller;
 
-import java.util.List;
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletResponse;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import com.jjt.biz.domain.SensorConfig;
+import com.jjt.biz.service.ISensorConfigService;
 import com.jjt.common.annotation.Log;
 import com.jjt.common.core.controller.BaseController;
 import com.jjt.common.core.domain.AjaxResult;
+import com.jjt.common.core.page.TableDataInfo;
 import com.jjt.common.enums.BusinessType;
-import com.jjt.biz.domain.SensorConfig;
-import com.jjt.biz.service.ISensorConfigService;
+import com.jjt.common.utils.SecurityUtils;
 import com.jjt.common.utils.poi.ExcelUtil;
-import com.jjt.common.core.page.TableDataInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 /**
  * 传感器网关配置Controller
@@ -30,10 +23,10 @@ import com.jjt.common.core.page.TableDataInfo;
  * @author wukai
  * @date 2025-10-11
  */
-@Api(tags="传感器网关配置")
+@Api(tags = "传感器网关配置")
 @RestController
 @RequestMapping("/biz/sensorConfig")
-public class SensorConfigController extends BaseController{
+public class SensorConfigController extends BaseController {
     @Resource
     private ISensorConfigService sensorConfigService;
 
@@ -43,9 +36,9 @@ public class SensorConfigController extends BaseController{
     @ApiOperation("查询传感器网关配置列表")
     //@PreAuthorize("@ss.hasPermi('biz:sensorConfig:list')")
     @GetMapping("/list")
-    public TableDataInfo list(SensorConfig sensorConfig)
-    {
+    public TableDataInfo list(SensorConfig sensorConfig) {
         startPage();
+        sensorConfig.getParams().put("deptId", SecurityUtils.getDeptId());
         List<SensorConfig> list = sensorConfigService.selectSensorConfigList(sensorConfig);
         return getDataTable(list);
     }
@@ -57,8 +50,7 @@ public class SensorConfigController extends BaseController{
     //@PreAuthorize("@ss.hasPermi('biz:sensorConfig:export')")
     @Log(title = "传感器网关配置", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, SensorConfig sensorConfig)
-    {
+    public void export(HttpServletResponse response, SensorConfig sensorConfig) {
         List<SensorConfig> list = sensorConfigService.selectSensorConfigList(sensorConfig);
         ExcelUtil<SensorConfig> util = new ExcelUtil<SensorConfig>(SensorConfig.class);
         util.exportExcel(response, list, "传感器网关配置数据");
@@ -70,8 +62,7 @@ public class SensorConfigController extends BaseController{
     @ApiOperation("获取传感器网关配置详细信息")
     //@PreAuthorize("@ss.hasPermi('biz:sensorConfig:query')")
     @GetMapping(value = "/{sensorId}")
-    public AjaxResult getInfo(@PathVariable("sensorId") Long sensorId)
-    {
+    public AjaxResult getInfo(@PathVariable("sensorId") Long sensorId) {
         return success(sensorConfigService.selectSensorConfigBySensorId(sensorId));
     }
 
@@ -82,8 +73,7 @@ public class SensorConfigController extends BaseController{
     //@PreAuthorize("@ss.hasPermi('biz:sensorConfig:add')")
     @Log(title = "传感器网关配置", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody SensorConfig sensorConfig)
-    {
+    public AjaxResult add(@RequestBody SensorConfig sensorConfig) {
         return toAjax(sensorConfigService.insertSensorConfig(sensorConfig));
     }
 
@@ -94,8 +84,7 @@ public class SensorConfigController extends BaseController{
     //@PreAuthorize("@ss.hasPermi('biz:sensorConfig:edit')")
     @Log(title = "传感器网关配置", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody SensorConfig sensorConfig)
-    {
+    public AjaxResult edit(@RequestBody SensorConfig sensorConfig) {
         return toAjax(sensorConfigService.updateSensorConfig(sensorConfig));
     }
 
@@ -105,9 +94,8 @@ public class SensorConfigController extends BaseController{
     @ApiOperation("删除传感器网关配置")
     //@PreAuthorize("@ss.hasPermi('biz:sensorConfig:remove')")
     @Log(title = "传感器网关配置", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{sensorIds}")
-    public AjaxResult remove(@PathVariable Long[] sensorIds)
-    {
+    @DeleteMapping("/{sensorIds}")
+    public AjaxResult remove(@PathVariable Long[] sensorIds) {
         return toAjax(sensorConfigService.deleteSensorConfigBySensorIds(sensorIds));
     }
 }

+ 12 - 5
jjt-admin/src/main/resources/mapper/biz/AlgorithmConfigMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.jjt.biz.mapper.AlgorithmConfigMapper">
-    
+
     <resultMap type="AlgorithmConfig" id="AlgorithmConfigResult">
         <result property="algoId"    column="ALGO_ID"    />
         <result property="houseId"    column="HOUSE_ID"    />
@@ -24,14 +24,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectAlgorithmConfigList" parameterType="AlgorithmConfig" resultMap="AlgorithmConfigResult">
         <include refid="selectAlgorithmConfigVo"/>
-        <where>  
+        <where>
             <if test="houseId != null "> and HOUSE_ID = #{houseId}</if>
             <if test="houseName != null  and houseName != ''"> and HOUSE_NAME like concat('%', #{houseName}, '%')</if>
             <if test="houseCode != null  and houseCode != ''"> and HOUSE_CODE = #{houseCode}</if>
             <if test="algoName != null  and algoName != ''"> and ALGO_NAME like concat('%', #{algoName}, '%')</if>
+            <if test="params.deptId != null and params.deptId!=''">
+                and house_id in(
+                SELECT house_id FROM house_config WHERE dept_id IN( select dept_id
+                from sys_dept
+                where FIND_IN_SET(#{params.deptId}, ancestors) OR dept_id=#{params.deptId})
+                )
+            </if>
         </where>
     </select>
-    
+
     <select id="selectAlgorithmConfigByAlgoId" parameterType="Long" resultMap="AlgorithmConfigResult">
         <include refid="selectAlgorithmConfigVo"/>
         where ALGO_ID = #{algoId}
@@ -87,9 +94,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteAlgorithmConfigByAlgoIds" parameterType="String">
-        delete from algorithm_config where ALGO_ID in 
+        delete from algorithm_config where ALGO_ID in
         <foreach item="algoId" collection="array" open="(" separator="," close=")">
             #{algoId}
         </foreach>
     </delete>
-</mapper>
+</mapper>

+ 12 - 5
jjt-admin/src/main/resources/mapper/biz/DeviceConfigMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.jjt.biz.mapper.DeviceConfigMapper">
-    
+
     <resultMap type="DeviceConfig" id="DeviceConfigResult">
         <result property="autoId"    column="AUTO_ID"    />
         <result property="houseId"    column="HOUSE_ID"    />
@@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectDeviceConfigList" parameterType="DeviceConfig" resultMap="DeviceConfigResult">
         <include refid="selectDeviceConfigVo"/>
-        <where>  
+        <where>
             <if test="houseId != null "> and HOUSE_ID = #{houseId}</if>
             <if test="houseName != null  and houseName != ''"> and HOUSE_NAME like concat('%', #{houseName}, '%')</if>
             <if test="houseCode != null  and houseCode != ''"> and HOUSE_CODE = #{houseCode}</if>
@@ -38,9 +38,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="status != null  and status != ''"> and STATUS = #{status}</if>
             <if test="createTime != null "> and CREATE_TIME = #{createTime}</if>
             <if test="updateBy != null  and updateBy != ''"> and UPDATE_BY = #{updateBy}</if>
+            <if test="params.deptId != null and params.deptId!=''">
+                and house_id in(
+                SELECT house_id FROM house_config WHERE dept_id IN( select dept_id
+                from sys_dept
+                where FIND_IN_SET(#{params.deptId}, ancestors) OR dept_id=#{params.deptId})
+                )
+            </if>
         </where>
     </select>
-    
+
     <select id="selectDeviceConfigByAutoId" parameterType="Long" resultMap="DeviceConfigResult">
         <include refid="selectDeviceConfigVo"/>
         where AUTO_ID = #{autoId}
@@ -105,9 +112,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteDeviceConfigByAutoIds" parameterType="String">
-        delete from device_config where AUTO_ID in 
+        delete from device_config where AUTO_ID in
         <foreach item="autoId" collection="array" open="(" separator="," close=")">
             #{autoId}
         </foreach>
     </delete>
-</mapper>
+</mapper>

+ 12 - 5
jjt-admin/src/main/resources/mapper/biz/FlowsConfigMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.jjt.biz.mapper.FlowsConfigMapper">
-    
+
     <resultMap type="FlowsConfig" id="FlowsConfigResult">
         <result property="flowsId"    column="FLOWS_ID"    />
         <result property="flowsName"    column="FLOWS_NAME"    />
@@ -22,14 +22,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectFlowsConfigList" parameterType="FlowsConfig" resultMap="FlowsConfigResult">
         <include refid="selectFlowsConfigVo"/>
-        <where>  
+        <where>
             <if test="flowsId != null "> and FLOWS_ID = #{flowsId}</if>
             <if test="flowsName != null  and flowsName != ''"> and FLOWS_NAME like concat('%', #{flowsName}, '%')</if>
             <if test="houseId != null "> and HOUSE_ID = #{houseId}</if>
             <if test="areaId != null "> and AREA_ID = #{areaId}</if>
+            <if test="params.deptId != null and params.deptId!=''">
+                and house_id in(
+                SELECT house_id FROM house_config WHERE dept_id IN( select dept_id
+                from sys_dept
+                where FIND_IN_SET(#{params.deptId}, ancestors) OR dept_id=#{params.deptId})
+                )
+            </if>
         </where>
     </select>
-    
+
     <select id="selectFlowsConfigByFlowsId" parameterType="Long" resultMap="FlowsConfigResult">
         <include refid="selectFlowsConfigVo"/>
         where FLOWS_ID = #{flowsId}
@@ -81,9 +88,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteFlowsConfigByFlowsIds" parameterType="String">
-        delete from flows_config where FLOWS_ID in 
+        delete from flows_config where FLOWS_ID in
         <foreach item="flowsId" collection="array" open="(" separator="," close=")">
             #{flowsId}
         </foreach>
     </delete>
-</mapper>
+</mapper>

+ 60 - 32
jjt-admin/src/main/resources/mapper/biz/SensorConfigMapper.xml

@@ -1,43 +1,69 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.jjt.biz.mapper.SensorConfigMapper">
-    
+
     <resultMap type="SensorConfig" id="SensorConfigResult">
-        <result property="sensorId"    column="SENSOR_ID"    />
-        <result property="houseId"    column="HOUSE_ID"    />
-        <result property="houseName"    column="HOUSE_NAME"    />
-        <result property="houseNum"    column="HOUSE_NUM"    />
-        <result property="houseCode"    column="HOUSE_CODE"    />
-        <result property="sensorName"    column="SENSOR_NAME"    />
-        <result property="subscribAddr"    column="SUBSCRIB_ADDR"    />
-        <result property="topic"    column="TOPIC"    />
-        <result property="smokeThreshold"    column="SMOKE_THRESHOLD"    />
-        <result property="tmpThreshold"    column="TMP_THRESHOLD"    />
-        <result property="rhThreshold"    column="RH_THRESHOLD"    />
-        <result property="alarmTime"    column="ALARM_TIME"    />
-        <result property="lastTime"    column="LAST_TIME"    />
-        <result property="createBy"    column="CREATE_BY"    />
-        <result property="createTime"    column="CREATE_TIME"    />
-        <result property="updateBy"    column="UPDATE_BY"    />
-        <result property="updateTime"    column="UPDATE_TIME"    />
-        <result property="remark"    column="REMARK"    />
+        <result property="sensorId" column="SENSOR_ID"/>
+        <result property="houseId" column="HOUSE_ID"/>
+        <result property="houseName" column="HOUSE_NAME"/>
+        <result property="houseNum" column="HOUSE_NUM"/>
+        <result property="houseCode" column="HOUSE_CODE"/>
+        <result property="sensorName" column="SENSOR_NAME"/>
+        <result property="subscribAddr" column="SUBSCRIB_ADDR"/>
+        <result property="topic" column="TOPIC"/>
+        <result property="smokeThreshold" column="SMOKE_THRESHOLD"/>
+        <result property="tmpThreshold" column="TMP_THRESHOLD"/>
+        <result property="rhThreshold" column="RH_THRESHOLD"/>
+        <result property="alarmTime" column="ALARM_TIME"/>
+        <result property="lastTime" column="LAST_TIME"/>
+        <result property="createBy" column="CREATE_BY"/>
+        <result property="createTime" column="CREATE_TIME"/>
+        <result property="updateBy" column="UPDATE_BY"/>
+        <result property="updateTime" column="UPDATE_TIME"/>
+        <result property="remark" column="REMARK"/>
     </resultMap>
 
     <sql id="selectSensorConfigVo">
-        select SENSOR_ID, HOUSE_ID, HOUSE_NAME, HOUSE_NUM, HOUSE_CODE, SENSOR_NAME, SUBSCRIB_ADDR, TOPIC, SMOKE_THRESHOLD, TMP_THRESHOLD, RH_THRESHOLD, ALARM_TIME, LAST_TIME, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME, REMARK from sensor_config
+        select SENSOR_ID,
+               HOUSE_ID,
+               HOUSE_NAME,
+               HOUSE_NUM,
+               HOUSE_CODE,
+               SENSOR_NAME,
+               SUBSCRIB_ADDR,
+               TOPIC,
+               SMOKE_THRESHOLD,
+               TMP_THRESHOLD,
+               RH_THRESHOLD,
+               ALARM_TIME,
+               LAST_TIME,
+               CREATE_BY,
+               CREATE_TIME,
+               UPDATE_BY,
+               UPDATE_TIME,
+               REMARK
+        from sensor_config
     </sql>
 
     <select id="selectSensorConfigList" parameterType="SensorConfig" resultMap="SensorConfigResult">
         <include refid="selectSensorConfigVo"/>
-        <where>  
-            <if test="houseName != null  and houseName != ''"> and HOUSE_NAME like concat('%', #{houseName}, '%')</if>
-            <if test="houseCode != null  and houseCode != ''"> and HOUSE_CODE = #{houseCode}</if>
-            <if test="sensorName != null  and sensorName != ''"> and SENSOR_NAME like concat('%', #{sensorName}, '%')</if>
+        <where>
+            <if test="houseName != null  and houseName != ''">and HOUSE_NAME like concat('%', #{houseName}, '%')</if>
+            <if test="houseCode != null  and houseCode != ''">and HOUSE_CODE = #{houseCode}</if>
+            <if test="sensorName != null  and sensorName != ''">and SENSOR_NAME like concat('%', #{sensorName}, '%')
+            </if>
+            <if test="params.deptId != null and params.deptId!=''">
+                and house_id in(
+                    SELECT house_id FROM house_config WHERE dept_id IN( select dept_id
+                    from sys_dept
+                    where FIND_IN_SET(#{params.deptId}, ancestors) OR dept_id=#{params.deptId})
+                )
+            </if>
         </where>
     </select>
-    
+
     <select id="selectSensorConfigBySensorId" parameterType="Long" resultMap="SensorConfigResult">
         <include refid="selectSensorConfigVo"/>
         where SENSOR_ID = #{sensorId}
@@ -63,7 +89,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateBy != null">UPDATE_BY,</if>
             <if test="updateTime != null">UPDATE_TIME,</if>
             <if test="remark != null">REMARK,</if>
-         </trim>
+        </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="houseId != null">#{houseId},</if>
             <if test="houseName != null">#{houseName},</if>
@@ -82,7 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateBy != null">#{updateBy},</if>
             <if test="updateTime != null">#{updateTime},</if>
             <if test="remark != null">#{remark},</if>
-         </trim>
+        </trim>
     </insert>
 
     <update id="updateSensorConfig" parameterType="SensorConfig">
@@ -110,13 +136,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </update>
 
     <delete id="deleteSensorConfigBySensorId" parameterType="Long">
-        delete from sensor_config where SENSOR_ID = #{sensorId}
+        delete
+        from sensor_config
+        where SENSOR_ID = #{sensorId}
     </delete>
 
     <delete id="deleteSensorConfigBySensorIds" parameterType="String">
-        delete from sensor_config where SENSOR_ID in 
+        delete from sensor_config where SENSOR_ID in
         <foreach item="sensorId" collection="array" open="(" separator="," close=")">
             #{sensorId}
         </foreach>
     </delete>
-</mapper>
+</mapper>