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

站点管理监控设备列表查询

jichaobo 3 лет назад
Родитель
Сommit
0b2d424c6a

+ 7 - 0
fiveep-controller/src/main/java/com/bizmatics/controller/web/DeviceController.java

@@ -4,7 +4,9 @@ package com.bizmatics.controller.web;
 import com.bizmatics.common.core.bean.ApiResult;
 import com.bizmatics.common.core.util.DateUtils;
 import com.bizmatics.model.Device;
+import com.bizmatics.model.DeviceList;
 import com.bizmatics.model.HtAnalogData;
+import com.bizmatics.model.TemplateData;
 import com.bizmatics.persistence.mapper.DeviceMapper;
 import com.bizmatics.persistence.mapper.HtAnalogDataMapper;
 import com.bizmatics.service.DeviceService;
@@ -76,5 +78,10 @@ public class DeviceController {
         }
         return list1;
     }
+
+    @GetMapping("DeviceList")
+    public ApiResult<List<DeviceList>> DeviceList(@RequestParam String siteId) {
+        return ApiResult.success(deviceService.DeviceList(siteId));
+    }
 }
 

+ 4 - 1
fiveep-model/src/main/java/com/bizmatics/model/DeviceAttribute.java

@@ -74,5 +74,8 @@ public class DeviceAttribute implements Serializable {
      */
     private LocalDateTime createTime;
 
-
+    /**
+     * 电能质量分析
+     */
+    private String qualityAnalysis;
 }

+ 117 - 0
fiveep-model/src/main/java/com/bizmatics/model/DeviceList.java

@@ -0,0 +1,117 @@
+package com.bizmatics.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.util.Date;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author ya
+ * @since 2021-07-07
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class DeviceList implements Serializable {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 设备信息表ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 设备编号
+     */
+    private String deviceCode;
+
+    /**
+     * 设备名称
+     */
+    private String deviceName;
+
+    /**
+     * 所属站点
+     */
+    private Integer siteId;
+
+    /**
+     * 设备安装位置
+     */
+    private String deviceAddress;
+
+    /**
+     * 1:183用电设备,2:视频监控设备,3:171用电设备,4:173用电设备,5:158智能网关,6:其他
+     */
+    private String deviceType;
+
+    /**
+     * 安装时间
+     */
+    private Date installTime;
+
+    /**
+     * 创建人
+     */
+    private String creator;
+
+    /**
+     * 使能标识(0 不生效,1生效)
+     */
+    private Integer enable;
+
+    @TableField(exist = false)
+    private Integer deviceStatus;
+
+    /**
+     * 站点里面字段信息
+     */
+    @TableField(exist = false)
+    private String installedCapacity;
+    /**
+     * 回路表计地址
+     */
+    private Integer loopMeterAddress;
+
+    /**
+     * 额定电压(kv)
+     */
+    private Double ratedVoltage;
+
+    /**
+     * 额定电流(A)
+     */
+    private Double ratedCurrent;
+
+    /**
+     * 电流负载率门限
+     */
+    private Double currentLoadRate;
+
+    /**
+     * 监控设备编号
+     */
+    private String monitoringEquipmentNo;
+
+    /**
+     * 变量列表id
+     */
+    private Integer variableListId;
+
+    /**
+     * 电能质量分析
+     */
+    private String qualityAnalysis;
+}

+ 2 - 0
fiveep-persistence/src/main/java/com/bizmatics/persistence/mapper/DeviceMapper.java

@@ -2,6 +2,7 @@ package com.bizmatics.persistence.mapper;
 
 import com.bizmatics.model.Device;
 import com.bizmatics.common.mvc.base.CrudMapper;
+import com.bizmatics.model.DeviceList;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
@@ -41,6 +42,7 @@ public interface DeviceMapper extends CrudMapper<Device> {
                       @Param("startTime") Date startTime,
                       @Param("endTime") Date endTime,
                       @Param("type") String type);
+    List<DeviceList> DeviceList(@Param("siteId") Integer siteId);
 
 
 }

+ 22 - 0
fiveep-persistence/src/main/resources/mapper/mysql/DeviceMapper.xml

@@ -74,4 +74,26 @@
         </where>
     </select>
 
+    <select id="DeviceList" resultType="com.bizmatics.model.DeviceList">
+        SELECT
+        a.*, b.device_status,
+        c.loop_meter_address,
+        c.rated_voltage,
+        c.rated_current,
+        c.current_load_rate,
+        monitoring_equipment_no,
+        c.variable_list_id,
+        c.quality_analysis
+        FROM
+        device AS a
+        JOIN device_status AS b ON a.device_code = b.device_code
+        LEFT JOIN device_attribute AS c ON a.id = c.device_id
+        <where>
+            a.enable =1
+            <if test="siteId != null and siteId != 0">
+                and a.site_id = #{siteId}
+            </if>
+        </where>
+    </select>
+
 </mapper>

+ 5 - 0
fiveep-service/src/main/java/com/bizmatics/service/DeviceService.java

@@ -2,9 +2,12 @@ package com.bizmatics.service;
 
 import com.bizmatics.model.Device;
 import com.bizmatics.common.mvc.base.CrudService;
+import com.bizmatics.model.DeviceList;
+import com.bizmatics.model.TemplateData;
 import com.bizmatics.service.vo.DeviceCountVO;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  * <p>
@@ -29,4 +32,6 @@ public interface DeviceService extends CrudService<Device> {
      * @return
      */
     DeviceCountVO selectDeviceCountByType(Integer site);
+
+    List<DeviceList> DeviceList(String siteId);
 }

+ 8 - 0
fiveep-service/src/main/java/com/bizmatics/service/impl/DeviceServiceImpl.java

@@ -2,6 +2,8 @@ package com.bizmatics.service.impl;
 
 import com.bizmatics.common.mvc.base.AbstractCrudService;
 import com.bizmatics.model.Device;
+import com.bizmatics.model.DeviceList;
+import com.bizmatics.model.TemplateData;
 import com.bizmatics.persistence.mapper.DeviceMapper;
 import com.bizmatics.service.DeviceService;
 import com.bizmatics.service.enums.DeviceStatusCode;
@@ -71,4 +73,10 @@ public class DeviceServiceImpl extends AbstractCrudService<DeviceMapper, Device>
                 .filter(device -> Optional.ofNullable(type).map(ds -> ds.equals(device.getDeviceType())).orElse(true))
                 .count();
     }
+
+    public List<DeviceList> DeviceList(String siteId){
+        List<DeviceList> DeviceList = null;
+        DeviceList = baseMapper.DeviceList(Integer.parseInt(siteId));
+        return DeviceList;
+    }
 }