Procházet zdrojové kódy

新增 创建设备时候获取设备型号列表接口

zhaiyifei před 1 rokem
rodič
revize
29250b5614

+ 11 - 2
src/main/java/com/yunfeiyun/agmp/iotm/web/controller/IotDevicetypeController.java

@@ -7,14 +7,12 @@ import com.yunfeiyun.agmp.common.core.page.TableDataInfo;
 import com.yunfeiyun.agmp.common.enums.BusinessType;
 import com.yunfeiyun.agmp.common.utils.poi.ExcelUtil;
 import com.yunfeiyun.agmp.iot.common.domain.TosDevicetype;
-import com.yunfeiyun.agmp.iot.common.service.TypeCacheService;
 import com.yunfeiyun.agmp.iotm.web.domain.resvo.IotDevicetypeListResVo;
 import com.yunfeiyun.agmp.iotm.web.service.ITosDevicetypeService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
-import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
@@ -44,6 +42,17 @@ public class IotDevicetypeController extends BaseController
     }
 
     /**
+     * 创建编辑设备时候查询设备类型列表
+     */
+    @PreAuthorize("@ss.hasPermi('iot:devicetype:list')")
+    @GetMapping("/create/list")
+    public TableDataInfo listByCreateDev(TosDevicetype tosDevicetype) {
+        startPage();
+        List<IotDevicetypeListResVo> list = tosDevicetypeService.listByCreateDev(tosDevicetype);
+        return getDataTable(list);
+    }
+
+    /**
      * 导出设备类型列表
      */
     @PreAuthorize("@ss.hasPermi('tos:devicetype:export')")

+ 9 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/mapper/TosDevicetypeMapper.java

@@ -56,4 +56,13 @@ public interface TosDevicetypeMapper {
 
 
     List<TosDevicetypeResVo> selectTosDevicetypeResVoList(TosDevicetype tosDevicetype);
+
+
+    /**
+     * 创建设备时查询设备类型列表
+     *
+     * @param tosDevicetype 设备类型
+     * @return 设备类型集合
+     */
+    public List<TosDevicetype> selectTosDevicetypeListyCreateDev(TosDevicetype tosDevicetype);
 }

+ 8 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/service/ITosDevicetypeService.java

@@ -69,4 +69,12 @@ public interface ITosDevicetypeService {
      * @return 设备类型集合
      */
     public List<IotDevicetypeListResVo> list(TosDevicetype tosDevicetype);
+
+    /**
+     * 创建设备时查询设备类型列表
+     *
+     * @param tosDevicetype 设备类型
+     * @return 设备类型集合
+     */
+    public List<IotDevicetypeListResVo> listByCreateDev(TosDevicetype tosDevicetype);
 }

+ 20 - 1
src/main/java/com/yunfeiyun/agmp/iotm/web/service/impl/TosDevicetypeServiceImpl.java

@@ -1,6 +1,7 @@
 package com.yunfeiyun.agmp.iotm.web.service.impl;
 
 
+import com.yunfeiyun.agmp.common.utils.SecurityUtils;
 import com.yunfeiyun.agmp.iot.common.domain.IotDeviceconn;
 import com.yunfeiyun.agmp.iot.common.domain.TosDevicetype;
 import com.yunfeiyun.agmp.iot.common.enums.IotDeviceconnTypeEnum;
@@ -10,7 +11,6 @@ import com.yunfeiyun.agmp.iotm.web.domain.resvo.IotDevicetypeListResVo;
 import com.yunfeiyun.agmp.iotm.web.domain.resvo.TosDevicetypeResVo;
 import com.yunfeiyun.agmp.iotm.web.mapper.IotDeviceconnMapper;
 import com.yunfeiyun.agmp.iotm.web.mapper.TosDevicetypeMapper;
-import com.yunfeiyun.agmp.iotm.web.service.IIotDeviceconnService;
 import com.yunfeiyun.agmp.iotm.web.service.ITosDevicetypeService;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -156,4 +156,23 @@ public class TosDevicetypeServiceImpl implements ITosDevicetypeService
         }
         return iotDevicetypeListResVoList;
     }
+
+    /**
+     * 创建设备时查询设备类型列表
+     *
+     * @param tosDevicetype 设备类型
+     * @return 设备类型集合
+     */
+    @Override
+    public List<IotDevicetypeListResVo> listByCreateDev(TosDevicetype tosDevicetype) {
+        tosDevicetype.setTid(SecurityUtils.getTid());
+        List<TosDevicetype> tosDevicetypeList = tosDevicetypeMapper.selectTosDevicetypeListyCreateDev(tosDevicetype);
+        List<IotDevicetypeListResVo> iotDevicetypeListResVoList = new ArrayList<>();
+        for (TosDevicetype devicetype : tosDevicetypeList) {
+            IotDevicetypeListResVo iotDevicetypeListResVo = new IotDevicetypeListResVo();
+            BeanUtils.copyProperties(devicetype, iotDevicetypeListResVo);
+            iotDevicetypeListResVoList.add(iotDevicetypeListResVo);
+        }
+        return iotDevicetypeListResVoList;
+    }
 }

+ 22 - 0
src/main/resources/mapper/TosDevicetypeMapper.xml

@@ -140,4 +140,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         delete from TosDevicetype where devtypeBid = #{devtypeBid}
     </delete>
 
+    <select id="selectTosDevicetypeListyCreateDev" parameterType="TosDevicetype" resultMap="TosDevicetypeResult">
+        SELECT dt.*
+        FROM IotDeviceconn AS dc
+            LEFT JOIN TosDevicetype AS dt ON dt.devtypeBid = dc.devtypeBid
+        <where>
+            dc.tid = 'ee47a6b6-5313-4f4d-8bc4-982b75f529ae' AND dt.devtypeBid IS NOT NULL
+            <if test="devtypeBid != null  and devtypeBid != ''"> and dt.devtypeBid = #{devtypeBid}</if>
+            <if test="devclassBid != null  and devclassBid != ''"> and dt.devclassBid = #{devclassBid}</if>
+            <if test="devtypeName != null  and devtypeName != ''"> and dt.devtypeName like concat('%', #{devtypeName}, '%')</if>
+            <if test="devtypeCode != null  and devtypeCode != ''"> and dt.devtypeCode = #{devtypeCode}</if>
+            <if test="firmBid != null  and firmBid != ''"> and dt.firmBid = #{firmBid}</if>
+            <if test="devtypePreview != null  and devtypePreview != ''"> and dt.devtypePreview = #{devtypePreview}</if>
+            <if test="devtypeRemark != null  and devtypeRemark != ''"> and dt.devtypeRemark = #{devtypeRemark}</if>
+            <if test="devTypeConfig != null  and devTypeConfig != ''"> and dt.devTypeConfig = #{devTypeConfig}</if>
+            <if test="devtypeCreator != null  and devtypeCreator != ''"> and dt.evtypeCreator = #{devtypeCreator}</if>
+            <if test="devtypeModifier != null  and devtypeModifier != ''"> and dt.devtypeModifier = #{devtypeModifier}</if>
+            <if test="devtypeModifieddate != null  and devtypeModifieddate != ''"> and dt.devtypeModifieddate = #{devtypeModifieddate}</if>
+            <if test="devtypeCreateddate != null  and devtypeCreateddate != ''"> and dt.devtypeCreateddate = #{devtypeCreateddate}</if>
+        </where>
+        group by dt.devtypeBid
+    </select>
+
 </mapper>