lihui001 пре 3 година
родитељ
комит
bf48aff214

+ 1 - 1
zoniot-water/zoniot-water-api/src/main/java/com/zcxk/water/api/dto/query/DeviceSceneDto.java

@@ -19,7 +19,7 @@ public class DeviceSceneDto  {
     private Integer deviceTypeId;
 
     @NotNull
-    @ApiModelProperty(value = "所属场景类型")
+    @ApiModelProperty(value = "所属场景类型: 1:水源,2:水厂,3:泵站,4:管网 5 水源水厂")
     private List<Integer> sceneTypes;
 
 }

+ 1 - 1
zoniot-water/zoniot-water-core/src/main/java/com/zcxk/water/core/dao/DeviceMapper.java

@@ -167,6 +167,6 @@ public interface DeviceMapper {
     * @param userCondition:
     * @return java.util.List<com.zcxk.water.api.vo.DeviceVo>
     **/
-    List<DeviceVo> selectListBySceneType(@Param("deviceTypeId") Integer deviceTypeId, @Param("sceneIds") List<Long> sceneIds, @Param("user")UserCondition userCondition);
+    List<DeviceVo> selectListBySceneType(@Param("deviceTypeId") Integer deviceTypeId, @Param("sceneTypeIds") List<Long> sceneTypeIds, @Param("user")UserCondition userCondition);
 
 }

+ 4 - 3
zoniot-water/zoniot-water-core/src/main/java/com/zcxk/water/core/mapper/DeviceMapper.xml

@@ -520,13 +520,14 @@
         from sms_device d
         INNER JOIN sms_device_scene sd on d.id = sd.DEVICE_ID
         INNER JOIN sms_device_type t on d.DEVICE_TYPE_ID = t.id
+        INNER JOIN sms_scene st on st.ID = sd.SCENE_ID
         where d.status = 1 and sd.status = 1 and t.status = 1
         <if test="deviceTypeId != null and deviceTypeId != 0 ">
             and d.DEVICE_TYPE_ID =#{deviceTypeId}
         </if>
-        <if test="sceneIds != null">
-            and sd.SCENE_ID in
-            <foreach collection="sceneIds" item="item" open="(" close=")" separator=",">
+        <if test="sceneTypeIds != null">
+            and st.SCENE_TYPE_ID in
+            <foreach collection="sceneTypeIds" item="item" open="(" close=")" separator=",">
                 #{item}
             </foreach>
         </if>

+ 4 - 4
zoniot-water/zoniot-water-web/src/main/java/com/zcxk/water/web/service/impl/DeviceServiceImpl.java

@@ -194,12 +194,12 @@ public class DeviceServiceImpl implements DeviceService {
     public List<DeviceVo> selectListBySceneType(DeviceSceneDto dto) {
         List<String> typeNames = SceneTypeEnum.getTypeName(dto.getSceneTypes());
         List<SceneTypeEntity> typeEntityList = sceneTypeService.findList(typeNames);
-        List<Long> sceneIds = new ArrayList<>();
+        List<Long> sceneTypeIds = new ArrayList<>();
         for (SceneTypeEntity sceneTypeEntity : typeEntityList) {
-            sceneIds.add(sceneTypeEntity.getId());
-            setSceneId(sceneTypeEntity.getChildren(), sceneIds);
+            sceneTypeIds.add(sceneTypeEntity.getId());
+            setSceneId(sceneTypeEntity.getChildren(), sceneTypeIds);
         }
-        return deviceMapper.selectListBySceneType(dto.getDeviceTypeId(), sceneIds, UserUtil.getCurrentUser().getUserCondition());
+        return deviceMapper.selectListBySceneType(dto.getDeviceTypeId(), sceneTypeIds, UserUtil.getCurrentUser().getUserCondition());
     }