Sfoglia il codice sorgente

新增获取设备型号列表接口

zhaiyifei 1 anno fa
parent
commit
6961251cdc

+ 65 - 0
src/main/java/com/yunfeiyun/agmp/iotm/device/controller/IotDevicetypeController.java

@@ -0,0 +1,65 @@
+package com.yunfeiyun.agmp.iotm.device.controller;
+
+import com.yunfeiyun.agmp.common.annotation.Log;
+import com.yunfeiyun.agmp.common.core.controller.BaseController;
+import com.yunfeiyun.agmp.common.core.domain.AjaxResult;
+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.iotm.device.domain.resvo.IotDevicetypeListResVo;
+import com.yunfeiyun.agmp.iotm.device.domain.resvo.TosDevicetypeResVo;
+import com.yunfeiyun.agmp.iotm.device.service.ITosDevicetypeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 设备类型Controller
+ * 
+ * @author 杨晓辉
+ * @date 2024-11-06
+ */
+@RestController
+@RequestMapping("/iot/devicetype")
+public class IotDevicetypeController extends BaseController
+{
+    @Autowired
+    private ITosDevicetypeService tosDevicetypeService;
+
+    /**
+     * 查询设备类型列表
+     */
+    @PreAuthorize("@ss.hasPermi('iot:devicetype:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(TosDevicetype tosDevicetype) {
+        startPage();
+        List<IotDevicetypeListResVo> list = tosDevicetypeService.list(tosDevicetype);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出设备类型列表
+     */
+    @PreAuthorize("@ss.hasPermi('tos:devicetype:export')")
+    @Log(title = "设备类型", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, TosDevicetype tosDevicetype) {
+        List<TosDevicetype> list = tosDevicetypeService.selectTosDevicetypeList(tosDevicetype);
+        ExcelUtil<TosDevicetype> util = new ExcelUtil<TosDevicetype>(TosDevicetype.class);
+        util.exportExcel(response, list, "设备类型数据");
+    }
+
+    /**
+     * 获取设备类型详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('tos:devicetype:query')")
+    @GetMapping(value = "/info/{devtypeBid}")
+    public AjaxResult getInfo(@PathVariable("devtypeBid") String devtypeBid) {
+        return success(tosDevicetypeService.selectTosDevicetypeByDevtypeBid(devtypeBid));
+    }
+
+}

+ 31 - 0
src/main/java/com/yunfeiyun/agmp/iotm/device/domain/resvo/IotDevicetypeListResVo.java

@@ -0,0 +1,31 @@
+package com.yunfeiyun.agmp.iotm.device.domain.resvo;
+
+import com.yunfeiyun.agmp.common.annotation.Excel;
+import com.yunfeiyun.agmp.iot.common.domain.IotBaseEntity;
+import lombok.Data;
+
+/**
+ * 设备类型对象 TosDevicetype
+ * 
+ * @author 杨晓辉
+ * @date 2024-11-06
+ */
+@Data
+public class IotDevicetypeListResVo {
+
+    /** 设备型号业务标识 */
+    @Excel(name = "设备型号业务标识")
+    private String devtypeBid;
+
+    /** 设备类型 */
+    @Excel(name = "设备类型")
+    private String devclassBid;
+
+    /** 型号名称 */
+    @Excel(name = "型号名称")
+    private String devtypeName;
+
+    /** 型号代码 */
+    @Excel(name = "型号代码")
+    private String devtypeCode;
+}

+ 9 - 0
src/main/java/com/yunfeiyun/agmp/iotm/device/service/ITosDevicetypeService.java

@@ -3,6 +3,7 @@ package com.yunfeiyun.agmp.iotm.device.service;
 
 
 
 
 import com.yunfeiyun.agmp.iot.common.domain.TosDevicetype;
 import com.yunfeiyun.agmp.iot.common.domain.TosDevicetype;
+import com.yunfeiyun.agmp.iotm.device.domain.resvo.IotDevicetypeListResVo;
 import com.yunfeiyun.agmp.iotm.device.domain.resvo.TosDevicetypeResVo;
 import com.yunfeiyun.agmp.iotm.device.domain.resvo.TosDevicetypeResVo;
 
 
 import java.util.List;
 import java.util.List;
@@ -60,4 +61,12 @@ public interface ITosDevicetypeService {
      * */
      * */
     public int deleteTosDevicetypeByTosMsg(TosDevicetype tosDevicetype);
     public int deleteTosDevicetypeByTosMsg(TosDevicetype tosDevicetype);
     List<TosDevicetypeResVo> selectTosDevicetypeResVoList(TosDevicetype tosDevicetype);
     List<TosDevicetypeResVo> selectTosDevicetypeResVoList(TosDevicetype tosDevicetype);
+
+    /**
+     * 查询设备类型列表
+     *
+     * @param tosDevicetype 设备类型
+     * @return 设备类型集合
+     */
+    public List<IotDevicetypeListResVo> list(TosDevicetype tosDevicetype);
 }
 }

+ 21 - 0
src/main/java/com/yunfeiyun/agmp/iotm/device/service/impl/TosDevicetypeServiceImpl.java

@@ -2,12 +2,15 @@ package com.yunfeiyun.agmp.iotm.device.service.impl;
 
 
 
 
 import com.yunfeiyun.agmp.iot.common.domain.TosDevicetype;
 import com.yunfeiyun.agmp.iot.common.domain.TosDevicetype;
+import com.yunfeiyun.agmp.iotm.device.domain.resvo.IotDevicetypeListResVo;
 import com.yunfeiyun.agmp.iotm.device.domain.resvo.TosDevicetypeResVo;
 import com.yunfeiyun.agmp.iotm.device.domain.resvo.TosDevicetypeResVo;
 import com.yunfeiyun.agmp.iotm.device.mapper.TosDevicetypeMapper;
 import com.yunfeiyun.agmp.iotm.device.mapper.TosDevicetypeMapper;
 import com.yunfeiyun.agmp.iotm.device.service.ITosDevicetypeService;
 import com.yunfeiyun.agmp.iotm.device.service.ITosDevicetypeService;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 
 
 
 
@@ -93,4 +96,22 @@ public class TosDevicetypeServiceImpl implements ITosDevicetypeService
     public List<TosDevicetypeResVo> selectTosDevicetypeResVoList(TosDevicetype tosDevicetype) {
     public List<TosDevicetypeResVo> selectTosDevicetypeResVoList(TosDevicetype tosDevicetype) {
         return tosDevicetypeMapper.selectTosDevicetypeResVoList(tosDevicetype);
         return tosDevicetypeMapper.selectTosDevicetypeResVoList(tosDevicetype);
     }
     }
+
+    /**
+     * 查询设备类型列表
+     *
+     * @param tosDevicetype 设备类型
+     * @return 设备类型集合
+     */
+    @Override
+    public List<IotDevicetypeListResVo> list(TosDevicetype tosDevicetype) {
+        List<TosDevicetype> tosDevicetypeList = selectTosDevicetypeList(tosDevicetype);
+        List<IotDevicetypeListResVo> iotDevicetypeListResVoList = new ArrayList<>();
+        for (TosDevicetype devicetype : tosDevicetypeList) {
+            IotDevicetypeListResVo iotDevicetypeListResVo = new IotDevicetypeListResVo();
+            BeanUtils.copyProperties(devicetype, iotDevicetypeListResVo);
+            iotDevicetypeListResVoList.add(iotDevicetypeListResVo);
+        }
+        return iotDevicetypeListResVoList;
+    }
 }
 }