فهرست منبع

新增 创建告警配置查询设备类型列表接口

zhaiyifei 9 ماه پیش
والد
کامیت
9319d5d76e

+ 18 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/controller/IotWarnconfigController.java

@@ -14,10 +14,13 @@ import com.yunfeiyun.agmp.common.utils.SecurityUtils;
 import com.yunfeiyun.agmp.common.utils.StringUtils;
 import com.yunfeiyun.agmp.common.utils.poi.ExcelUtil;
 import com.yunfeiyun.agmp.iot.common.domain.IotWarnconfig;
+import com.yunfeiyun.agmp.iot.common.domain.TosDevicetype;
 import com.yunfeiyun.agmp.iotm.web.domain.reqvo.IotWarnconfigAddReqVo;
 import com.yunfeiyun.agmp.iotm.web.domain.reqvo.IotWarnconfigEditReqVo;
+import com.yunfeiyun.agmp.iotm.web.domain.resvo.IotDevicetypeListResVo;
 import com.yunfeiyun.agmp.iotm.web.domain.resvo.IotWarnconfigResVo;
 import com.yunfeiyun.agmp.iotm.web.service.IIotWarnconfigService;
+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.*;
@@ -39,6 +42,10 @@ public class IotWarnconfigController extends BaseController{
     private IIotWarnconfigService iotWarnconfigService;
     @Autowired
     private ISysUserService userService;
+
+    @Autowired
+    private ITosDevicetypeService iotDevicetypeService;
+
     @GetMapping("/select/user/list")
     public AjaxResult selectUserList() {
         SysUser user = new SysUser();
@@ -138,4 +145,15 @@ public class IotWarnconfigController extends BaseController{
     public AjaxResult remove(@PathVariable String[] wcBids){
         return toAjax(iotWarnconfigService.deleteIotWarnconfigWcBids(wcBids,SecurityUtils.getTid()));
     }
+
+    /**
+     * 查询告警配置列表
+     */
+    @PreAuthorize("@ss.hasPermi('iot:warn:config:devicetype:list')")
+    @GetMapping("/devicetype/list")
+    public TableDataInfo deviceTypeList(TosDevicetype tosDevicetype){
+        startPage();
+        List<IotDevicetypeListResVo> list = iotDevicetypeService.selectWarnConfigDevicetypeList(tosDevicetype);
+        return getDataTable(list);
+    }
 }

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

@@ -70,4 +70,12 @@ public interface TosDevicetypeMapper {
     TosDevicetype selectTosDevicetypeByDevtypeCode(@Param("devtypeCode") String devtypeCode);
 
     List<TosDevicetype> selectTosDevicetypeByDevtypeBids(List<String> devTypeBids);
+
+    /**
+     * 创建设备时查询设备类型列表
+     *
+     * @param tosDevicetype 设备类型
+     * @return 设备类型集合
+     */
+    public List<TosDevicetype> selectWarnConfigDevicetypeList(TosDevicetype tosDevicetype);
 }

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

@@ -79,4 +79,12 @@ public interface ITosDevicetypeService {
     public List<IotDevicetypeListResVo> listByCreateDev(TosDevicetype tosDevicetype);
 
     TosDevicetype selectTosDevicetypeByDevtypeCode(String devtypeCode);
+
+    /**
+     * 获取预警设备类型列表
+     *
+     * @param tosDevicetype 设备类型
+     * @return 设备类型集合
+     */
+    public List<IotDevicetypeListResVo> selectWarnConfigDevicetypeList(TosDevicetype tosDevicetype);
 }

+ 19 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/service/impl/TosDevicetypeServiceImpl.java

@@ -179,4 +179,23 @@ public class TosDevicetypeServiceImpl implements ITosDevicetypeService {
 
         return tosDevicetypeMapper.selectTosDevicetypeByDevtypeCode(devtypeCode);
     }
+
+    /**
+     * 获取预警设备类型列表
+     *
+     * @param tosDevicetype 设备类型
+     * @return 设备类型集合
+     */
+    @Override
+    public List<IotDevicetypeListResVo> selectWarnConfigDevicetypeList(TosDevicetype tosDevicetype) {
+        tosDevicetype.setTid(SecurityUtils.getTid());
+        List<TosDevicetype> tosDevicetypeList = tosDevicetypeMapper.selectWarnConfigDevicetypeList(tosDevicetype);
+        List<IotDevicetypeListResVo> iotDevicetypeListResVoList = new ArrayList<>();
+        for (TosDevicetype devicetype : tosDevicetypeList) {
+            IotDevicetypeListResVo iotDevicetypeListResVo = new IotDevicetypeListResVo();
+            BeanUtils.copyProperties(devicetype, iotDevicetypeListResVo);
+            iotDevicetypeListResVoList.add(iotDevicetypeListResVo);
+        }
+        return iotDevicetypeListResVoList;
+    }
 }

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

@@ -182,4 +182,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </select>
 
+    <select id="selectWarnConfigDevicetypeList" parameterType="TosDevicetype" resultType="com.yunfeiyun.agmp.iot.common.domain.TosDevicetype">
+        SELECT dt.*
+        FROM IotDeviceconn AS dc
+            LEFT JOIN IotDevice AS d ON d.devtypeBid = dc.devtypeBid
+            LEFT JOIN TosDevicetype AS dt ON dt.devtypeBid = dc.devtypeBid
+            WHERE dc.tid = #{tid} AND d.devtypeBid IS NOT NULL
+        GROUP BY dc.devtypeBid
+        ORDER BY dt.devtypeBid ASC
+    </select>
+
 </mapper>