Browse Source

根据网段分组查询分组设备

develop
Mr.Wang 7 months ago
parent
commit
7ed71d9335
  1. 18
      zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java
  2. 2
      zc-business/src/main/java/com/zc/business/domain/DcDevice.java
  3. 13
      zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java
  4. 23
      zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java
  5. 9
      zc-business/src/main/resources/mapper/business/DcDeviceMapper.xml

18
zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java

@ -119,6 +119,24 @@ public class DcDeviceController extends BaseController {
return AjaxResult.success(dcDeviceService.getDevice(id));
}
/**
* 根据网段查询设备
*/
@ApiOperation("根据网段查询设备")
@GetMapping("/networkSegment/{networkSegment}")
public AjaxResult getDeviceByNetworkSegment(@PathVariable String networkSegment) {
return AjaxResult.success(dcDeviceService.getDeviceByNetworkSegment(networkSegment));
}
/**
* 根据网段分组查询分组设备
*/
@ApiOperation("根据网段分组查询分组设备")
@GetMapping("/networkSegment")
public AjaxResult getGroupingDeviceByNetworkSegment() {
return AjaxResult.success(dcDeviceService.getGroupingDeviceByNetworkSegment());
}
/**
* 新增

2
zc-business/src/main/java/com/zc/business/domain/DcDevice.java

@ -46,6 +46,8 @@ public class DcDevice {
private String deviceCode;
@ApiModelProperty("设备类型")
private String deviceType;
@ApiModelProperty("所属网段")
private String networkSegment;
@ApiModelProperty("设备图片")
private String deviceImg;
@ApiModelProperty("安装日期")

13
zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java

@ -73,6 +73,19 @@ public interface IDcDeviceService extends IService<DcDevice> {
*/
DcDevice getDevice(String id);
/**
* 根据网段查询设备
* @param networkSegment
* @return
*/
List<DcDevice> getDeviceByNetworkSegment(String networkSegment);
/**
* 根据网段分组查询分组设备
* @return
*/
Map<String,List<DcDevice>> getGroupingDeviceByNetworkSegment();
DcStakeMark exampleQueryTheAssociatedPileNumber(DcDevice dcDevice);
Long statisticalAnomalyDevice();

23
zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java

@ -26,6 +26,7 @@ import javax.annotation.Resource;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
* 设备Service业务层处理
@ -370,6 +371,28 @@ public class DcDeviceServiceImpl extends ServiceImpl<DcDeviceMapper, DcDevice> i
return device;
}
/**
* 根据网段查询设备
* @param networkSegment
* @return
*/
@Override
public List<DcDevice> getDeviceByNetworkSegment(String networkSegment) {
DcDevice device = new DcDevice();
device.setNetworkSegment(networkSegment);
return dcDeviceMapper.selectDcDeviceList(device);
}
/**
* 根据网段分组查询分组设备
*/
@Override
public Map<String,List<DcDevice>> getGroupingDeviceByNetworkSegment() {
List<DcDevice> deviceList = dcDeviceMapper.selectDcDeviceList(new DcDevice());
return deviceList.stream()
.collect(Collectors.groupingBy(DcDevice::getNetworkSegment));
}
@Override
public DcStakeMark exampleQueryTheAssociatedPileNumber(DcDevice dcDevice) {
DcStakeMark dcStakeMark = new DcStakeMark();

9
zc-business/src/main/resources/mapper/business/DcDeviceMapper.xml

@ -28,6 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="facilitiesType" column="facilities_type"/>
<result property="deviceIp" column="device_ip"/>
<result property="stakeMarkRange" column="stake_mark_range"/>
<result property="networkSegment" column="network_segment"/>
<result property="deviceImg" column="device_img"/>
<result property="longitude" column="longitude"/>
<result property="latitude" column="latitude"/>
@ -64,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
facilities_type,
device_ip,
stake_mark_range,
network_segment,
device_img,
child_type
from dc_device
@ -73,7 +75,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDcDeviceList" parameterType="dcDevice" resultMap="DcDevice">
select t1.id, t1.iot_device_id, t1.group_id, t1.product_id, t1.stake_mark, t1.direction, t1.device_name, t1.device_code, t1.device_type,
t1.installation_Date,t1.production_date,t1.durable_years,t1.installation_site,t1.use_state,t1.device_state,t1.other_config,t1.remark,
t1.create_time,t1.update_time,t1.facilities_type,t1.device_ip,t1.stake_mark_range,t1.device_img,t1.child_type,
t1.create_time,t1.update_time,t1.facilities_type,t1.device_ip,t1.stake_mark_range,t1.network_segment,t1.device_img,t1.child_type,
t1.facilities_type,t2.longitude,t2.latitude,t3.manufacturer
from dc_device t1
left join dc_stake_mark t2 on t1.stake_mark = t2.stake_mark and t1.direction = t2.direction
@ -101,6 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="facilitiesType != null and facilitiesType != ''">and t1.facilities_type = #{facilitiesType}</if>
<if test="deviceIp != null and deviceIp != ''">and t1.device_ip = #{deviceIp}</if>
<if test="stakeMarkRange != null and stakeMarkRange != ''">and t1.stake_mark_range = #{stakeMarkRange}</if>
<if test="networkSegment != null and networkSegment != ''">and t1.network_segment = #{networkSegment}</if>
<if test="deviceImg != null and deviceImg != ''">and t1.device_img = #{deviceImg}</if>
<if test="childType != null and childType != ''">and t1.child_type = #{childType}</if>
</where>
@ -122,7 +125,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select t1.id, t1.iot_device_id, t1.group_id, t1.product_id, t1.stake_mark, t1.direction, t1.device_name,
t1.device_code, t1.device_type,t1.installation_Date,t1.production_date,t1.durable_years,t1.installation_site,
t1.use_state,t1.device_state,t1.other_config,t1.remark,t1.create_time,t1.update_time,t1.facilities_type,
t1.device_ip,t1.stake_mark_range,t1.device_img,t1.child_type,t1.facilities_type,t2.longitude,t2.latitude
t1.device_ip,t1.stake_mark_range,t1.network_segment,t1.device_img,t1.child_type,t1.facilities_type,t2.longitude,t2.latitude
from dc_device t1
left join dc_stake_mark t2 on t1.stake_mark = t2.stake_mark and t1.direction = t2.direction
where !ISNULL(t1.iot_device_id) and t1.device_type = '1' and t1.direction = #{direction}
@ -132,7 +135,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select t1.id, t1.iot_device_id, t1.group_id, t1.product_id, t1.stake_mark, t1.direction, t1.device_name,
t1.device_code, t1.device_type,t1.installation_Date,t1.production_date,t1.durable_years,t1.installation_site,
t1.use_state,t1.device_state,t1.other_config,t1.remark,t1.create_time,t1.update_time,t1.facilities_type,
t1.device_ip,t1.stake_mark_range,t1.device_img,t1.child_type,t1.facilities_type,t2.longitude,t2.latitude
t1.device_ip,t1.stake_mark_range,t1.network_segment,t1.device_img,t1.child_type,t1.facilities_type,t2.longitude,t2.latitude
from dc_device t1
left join dc_stake_mark t2 on t1.stake_mark = t2.stake_mark and t1.direction = t2.direction
where t1.device_type = '2' and t1.direction = #{direction}

Loading…
Cancel
Save