Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/main/java/com/yunfeiyun/agmp/iotm/web/controller/IotDeviceController.java
liuyaowen 1 год назад
Родитель
Сommit
384d641017

+ 4 - 5
src/main/java/com/yunfeiyun/agmp/iotm/web/controller/IotDeviceController.java

@@ -4,11 +4,10 @@ import java.util.List;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 
-import com.yunfeiyun.agmp.common.utils.SecurityUtils;
 import com.yunfeiyun.agmp.iot.common.domain.IotDevice;
-import com.yunfeiyun.agmp.iotm.device.common.domin.IotDeviceBaseCtlReqVo;
 import com.yunfeiyun.agmp.iotm.web.domain.reqvo.IotDeviceAddReqVo;
-import com.yunfeiyun.agmp.iotm.device.common.domin.IotDeviceBaseListReqVo;
+import com.yunfeiyun.agmp.iotm.web.domain.reqvo.IotDeviceListReqVo;
+import com.yunfeiyun.agmp.iotm.web.domain.resvo.IotDeviceListResVo;
 import com.yunfeiyun.agmp.iotm.web.service.IIotDeviceService;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -55,9 +54,9 @@ public class IotDeviceController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('iot:device:list')")
     @GetMapping("/list")
-    public TableDataInfo list(IotDevice iotDevice) {
+    public TableDataInfo list(IotDeviceListReqVo reqVo) {
         startPage();
-        List<IotDevice> list = iotDeviceService.selectIotDeviceList(iotDevice);
+        List<IotDeviceListResVo> list = iotDeviceService.seletIotDeviceList(reqVo);
         return getDataTable(list);
     }
     /**

+ 27 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/domain/reqvo/IotDeviceListReqVo.java

@@ -0,0 +1,27 @@
+package com.yunfeiyun.agmp.iotm.web.domain.reqvo;
+
+import com.yunfeiyun.agmp.common.annotation.Excel;
+import lombok.Data;
+
+@Data
+public class IotDeviceListReqVo {
+    /** 设备编号 */
+    @Excel(name = "设备编号")
+    private String devCode;
+
+    /** 设备名称 */
+    @Excel(name = "设备名称")
+    private String devName;
+
+    /** 设备大类标识 */
+    @Excel(name = "设备类型标识")
+    private String devclassBid;
+
+    /** 设备类型标识 */
+    @Excel(name = "设备型号标识")
+    private String devtypeBid;
+
+    /** 设备状态 */
+    @Excel(name = "设备状态")
+    private String devStatus;
+}

+ 60 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/domain/resvo/IotDeviceListResVo.java

@@ -0,0 +1,60 @@
+package com.yunfeiyun.agmp.iotm.web.domain.resvo;
+
+import com.yunfeiyun.agmp.common.annotation.Excel;
+import com.yunfeiyun.agmp.iot.common.domain.IotDevice;
+import com.yunfeiyun.agmp.iot.common.enums.IotDeviceStatusTypeEnum;
+import lombok.Data;
+
+@Data
+public class IotDeviceListResVo {
+    /** 设备业务标识 */
+    @Excel(name = "设备业务标识")
+    private String devBid;
+
+    /** 设备类型标识 */
+    @Excel(name = "设备型号标识")
+    private String devtypeBid;
+
+    /** 厂商信息标识 */
+    @Excel(name = "厂商信息标识")
+    private String firmBid;
+
+    /** 设备大类标识 */
+    @Excel(name = "设备类型标识")
+    private String devclassBid;
+
+    /** 设备编号 */
+    @Excel(name = "设备型号名称")
+    private String devtypeName;
+
+    /** 设备名称 */
+    @Excel(name = "设备类型名称")
+    private String devclassName;
+
+    /** 设备编号 */
+    @Excel(name = "设备编号")
+    private String devCode;
+
+    /** 设备名称 */
+    @Excel(name = "设备名称")
+    private String devName;
+
+    /** 设备状态 */
+    @Excel(name = "设备状态")
+    private String devStatus;
+
+    private String devStatusName;
+
+    /** 更新时间 设备上报数据的时间 */
+    @Excel(name = "更新时间 设备上报数据的时间")
+    private String devUpdateddate;
+
+    /** 创建时间 */
+    @Excel(name = "创建时间")
+    private String devCreateddate;
+
+    public String getDevStatusName() {
+        return IotDeviceStatusTypeEnum.getNameByCode(devStatus);
+    }
+
+}

+ 4 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/service/IIotDeviceService.java

@@ -3,6 +3,8 @@ package com.yunfeiyun.agmp.iotm.web.service;
 import com.yunfeiyun.agmp.iot.common.domain.IotDevice;
 import com.yunfeiyun.agmp.iotm.device.common.domin.IotDeviceBaseCtlReqVo;
 import com.yunfeiyun.agmp.iotm.web.domain.reqvo.IotDeviceAddReqVo;
+import com.yunfeiyun.agmp.iotm.web.domain.reqvo.IotDeviceListReqVo;
+import com.yunfeiyun.agmp.iotm.web.domain.resvo.IotDeviceListResVo;
 
 import com.yunfeiyun.agmp.iotm.device.common.domin.IotDeviceBaseListReqVo;
 
@@ -18,6 +20,8 @@ public interface IIotDeviceService
 {
     public int addIotDevice(IotDeviceAddReqVo reqVo);
 
+    public List<IotDeviceListResVo> seletIotDeviceList(IotDeviceListReqVo reqVo);
+
     /**
      * 查询设备基础
      *

+ 23 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/service/impl/IotDeviceServiceImpl.java

@@ -1,5 +1,6 @@
 package com.yunfeiyun.agmp.iotm.web.service.impl;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
@@ -19,6 +20,8 @@ import com.yunfeiyun.agmp.iotm.device.common.domin.IotDeviceBaseListReqVo;
 import com.yunfeiyun.agmp.iotm.device.common.service.IotDeviceBaseService;
 
 import com.yunfeiyun.agmp.iotm.web.domain.reqvo.IotDeviceAddReqVo;
+import com.yunfeiyun.agmp.iotm.web.domain.reqvo.IotDeviceListReqVo;
+import com.yunfeiyun.agmp.iotm.web.domain.resvo.IotDeviceListResVo;
 import com.yunfeiyun.agmp.iotm.web.mapper.IotDeviceMapper;
 import com.yunfeiyun.agmp.iotm.web.service.IIotDeviceService;
 
@@ -105,6 +108,26 @@ public class IotDeviceServiceImpl implements IIotDeviceService
 
         return insertIotDevice(iotDevice);
     }
+
+    @Override
+    public List<IotDeviceListResVo> seletIotDeviceList(IotDeviceListReqVo reqVo) {
+        IotDevice selectIotDevice = new IotDevice();
+        selectIotDevice.setDevCode(reqVo.getDevCode());
+        selectIotDevice.setDevName(reqVo.getDevName());
+        selectIotDevice.setDevclassBid(reqVo.getDevclassBid());
+        selectIotDevice.setDevtypeBid(reqVo.getDevtypeBid());
+        selectIotDevice.setDevStatus(reqVo.getDevStatus());
+
+        List<IotDevice> iotDeviceList = selectIotDeviceList(selectIotDevice);
+        List<IotDeviceListResVo> iotDeviceListResVoList = new ArrayList<>();
+        for (IotDevice iotDevice : iotDeviceList) {
+            IotDeviceListResVo iotDeviceListResVo = new IotDeviceListResVo();
+            BeanUtils.copyProperties(iotDevice,iotDeviceListResVo);
+            iotDeviceListResVoList.add(iotDeviceListResVo);
+        }
+        return iotDeviceListResVoList;
+    }
+
     /**
      * 查询设备基础
      *

+ 44 - 36
src/main/resources/mapper/IotDeviceMapper.xml

@@ -12,6 +12,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="firmBid"    column="firmBid"    />
         <result property="devclassBid"    column="devclassBid"    />
         <result property="devconnBid"    column="devconnBid"    />
+        <result property="devtypeName"    column="devtypeName"    />
+        <result property="devclassName"    column="devclassName"    />
         <result property="devCode"    column="devCode"    />
         <result property="devName"    column="devName"    />
         <result property="devVersion"    column="devVersion"    />
@@ -43,46 +45,52 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectIotDeviceVo">
-        select id, devBid, tid, devtypeBid, firmBid, devclassBid, devconnBid, devCode, devName, devVersion, devStatus, devProvince, devCity, devDistrict, devLng, devLat, devPositionstatus, devPositiontype, devTag, devRecogtype, devNetworktype, devOfflinedate, devProvincealign, devCityalign, devDistrictalign, devLngalign, devLatalign, devContacts, devTel, devCreator, devModifier, devUpdateddate, devModifieddate, devCreateddate, devDelstatus from IotDevice
+        SELECT d.devBid, d.tid, d.devtypeBid, d.firmBid, d.devclassBid, d.devconnBid, d.devCode, d.devName, d.devVersion,
+            d.devStatus, d.devProvince, d.devCity, d.devDistrict, d.devLng, d.devLat, d.devPositionstatus, d.devPositiontype,
+            d.devTag, d.devRecogtype, d.devNetworktype, d.devOfflinedate, d.devProvincealign, d.devCityalign, d.devDistrictalign,
+            d.devLngalign, d.devLatalign, d.devContacts, d.devTel, d.devCreator, d.devModifier, d.devUpdateddate, d.devModifieddate,
+            d.devCreateddate, d.devDelstatus, dt.devtypeName, dc.devclassName
+        FROM IotDevice AS d
+            LEFT JOIN TosDevicetype AS dt ON dt.devtypeBid = d.devtypeBid
+            LEFT JOIN TosDeviceclass AS dc ON dc.devclassBid = d.devclassBid
     </sql>
 
     <select id="selectIotDeviceList" parameterType="IotDevice" resultMap="IotDeviceResult">
         <include refid="selectIotDeviceVo"/>
-        <where>  
-            <if test="devBid != null  and devBid != ''"> and devBid = #{devBid}</if>
-            <if test="tid != null  and tid != ''"> and tid = #{tid}</if>
-            <if test="devtypeBid != null  and devtypeBid != ''"> and devtypeBid = #{devtypeBid}</if>
-            <if test="firmBid != null  and firmBid != ''"> and firmBid = #{firmBid}</if>
-            <if test="devclassBid != null  and devclassBid != ''"> and devclassBid = #{devclassBid}</if>
-            <if test="devconnBid != null  and devconnBid != ''"> and devconnBid = #{devconnBid}</if>
-            <if test="devCode != null  and devCode != ''"> and devCode = #{devCode}</if>
-            <if test="devName != null  and devName != ''"> and devName like concat('%', #{devName}, '%')</if>
-            <if test="devVersion != null  and devVersion != ''"> and devVersion = #{devVersion}</if>
-            <if test="devStatus != null  and devStatus != ''"> and devStatus = #{devStatus}</if>
-            <if test="devProvince != null  and devProvince != ''"> and devProvince = #{devProvince}</if>
-            <if test="devCity != null  and devCity != ''"> and devCity = #{devCity}</if>
-            <if test="devDistrict != null  and devDistrict != ''"> and devDistrict = #{devDistrict}</if>
-            <if test="devLng != null "> and devLng = #{devLng}</if>
-            <if test="devLat != null "> and devLat = #{devLat}</if>
-            <if test="devPositionstatus != null  and devPositionstatus != ''"> and devPositionstatus = #{devPositionstatus}</if>
-            <if test="devPositiontype != null  and devPositiontype != ''"> and devPositiontype = #{devPositiontype}</if>
-            <if test="devTag != null  and devTag != ''"> and devTag = #{devTag}</if>
-            <if test="devRecogtype != null  and devRecogtype != ''"> and devRecogtype = #{devRecogtype}</if>
-            <if test="devNetworktype != null  and devNetworktype != ''"> and devNetworktype = #{devNetworktype}</if>
-            <if test="devOfflinedate != null  and devOfflinedate != ''"> and devOfflinedate = #{devOfflinedate}</if>
-            <if test="devProvincealign != null  and devProvincealign != ''"> and devProvincealign = #{devProvincealign}</if>
-            <if test="devCityalign != null  and devCityalign != ''"> and devCityalign = #{devCityalign}</if>
-            <if test="devDistrictalign != null  and devDistrictalign != ''"> and devDistrictalign = #{devDistrictalign}</if>
-            <if test="devLngalign != null "> and devLngalign = #{devLngalign}</if>
-            <if test="devLatalign != null "> and devLatalign = #{devLatalign}</if>
-            <if test="devContacts != null  and devContacts != ''"> and devContacts = #{devContacts}</if>
-            <if test="devTel != null  and devTel != ''"> and devTel = #{devTel}</if>
-            <if test="devCreator != null  and devCreator != ''"> and devCreator = #{devCreator}</if>
-            <if test="devModifier != null  and devModifier != ''"> and devModifier = #{devModifier}</if>
-            <if test="devUpdateddate != null  and devUpdateddate != ''"> and devUpdateddate = #{devUpdateddate}</if>
-            <if test="devModifieddate != null  and devModifieddate != ''"> and devModifieddate = #{devModifieddate}</if>
-            <if test="devCreateddate != null  and devCreateddate != ''"> and devCreateddate = #{devCreateddate}</if>
-            <if test="devDelstatus != null  and devDelstatus != ''"> and devDelstatus = #{devDelstatus}</if>
+        <where>
+            d.tid = #{tid} and d.devDelstatus = '0'
+            <if test="devBid != null  and devBid != ''"> and d.devBid = #{devBid}</if>
+            <if test="devtypeBid != null  and devtypeBid != ''"> and d.devtypeBid = #{devtypeBid}</if>
+            <if test="firmBid != null  and firmBid != ''"> and d.firmBid = #{firmBid}</if>
+            <if test="devclassBid != null  and devclassBid != ''"> and d.devclassBid = #{devclassBid}</if>
+            <if test="devconnBid != null  and devconnBid != ''"> and d.devconnBid = #{devconnBid}</if>
+            <if test="devCode != null  and devCode != ''"> and d.devCode = #{devCode}</if>
+            <if test="devName != null  and devName != ''"> and d.devName like concat('%', #{devName}, '%')</if>
+            <if test="devVersion != null  and devVersion != ''"> and d.devVersion = #{devVersion}</if>
+            <if test="devStatus != null  and devStatus != ''"> and d.devStatus = #{devStatus}</if>
+            <if test="devProvince != null  and devProvince != ''"> and d.devProvince = #{devProvince}</if>
+            <if test="devCity != null  and devCity != ''"> and d.devCity = #{devCity}</if>
+            <if test="devDistrict != null  and devDistrict != ''"> and d.devDistrict = #{devDistrict}</if>
+            <if test="devLng != null "> and d.devLng = #{devLng}</if>
+            <if test="devLat != null "> and d.devLat = #{devLat}</if>
+            <if test="devPositionstatus != null  and devPositionstatus != ''"> and d.devPositionstatus = #{devPositionstatus}</if>
+            <if test="devPositiontype != null  and devPositiontype != ''"> and d.devPositiontype = #{devPositiontype}</if>
+            <if test="devTag != null  and devTag != ''"> and d.devTag = #{devTag}</if>
+            <if test="devRecogtype != null  and devRecogtype != ''"> and d.devRecogtype = #{devRecogtype}</if>
+            <if test="devNetworktype != null  and devNetworktype != ''"> and d.devNetworktype = #{devNetworktype}</if>
+            <if test="devOfflinedate != null  and devOfflinedate != ''"> and d.devOfflinedate = #{devOfflinedate}</if>
+            <if test="devProvincealign != null  and devProvincealign != ''"> and d.devProvincealign = #{devProvincealign}</if>
+            <if test="devCityalign != null  and devCityalign != ''"> and d.devCityalign = #{devCityalign}</if>
+            <if test="devDistrictalign != null  and devDistrictalign != ''"> and d.devDistrictalign = #{devDistrictalign}</if>
+            <if test="devLngalign != null "> and d.devLngalign = #{devLngalign}</if>
+            <if test="devLatalign != null "> and d.devLatalign = #{devLatalign}</if>
+            <if test="devContacts != null  and devContacts != ''"> and d.devContacts = #{devContacts}</if>
+            <if test="devTel != null  and devTel != ''"> and d.devTel = #{devTel}</if>
+            <if test="devCreator != null  and devCreator != ''"> and d.devCreator = #{devCreator}</if>
+            <if test="devModifier != null  and devModifier != ''"> and d.devModifier = #{devModifier}</if>
+            <if test="devUpdateddate != null  and devUpdateddate != ''"> and d.devUpdateddate = #{devUpdateddate}</if>
+            <if test="devModifieddate != null  and devModifieddate != ''"> and d.devModifieddate = #{devModifieddate}</if>
+            <if test="devCreateddate != null  and devCreateddate != ''"> and d.devCreateddate = #{devCreateddate}</if>
         </where>
     </select>