Commit 9b182977 authored by huangcb's avatar huangcb

设备实例增加字段communication_id

parent 5d7d561f
......@@ -53,6 +53,10 @@ public class DeviceInstanceEntity implements Serializable {
* 设备型号
*/
private String deviceModel;
/**
* 通信ID
*/
private String communicationId;
/**
* 是否删除:0-未删除、1-已删除
*/
......
......@@ -99,5 +99,14 @@ public interface DeviceInstanceService extends IService<DeviceInstanceEntity> {
**/
Map<String, Long> getInstanceCountByType(Long deviceTypeId);
/**
* @description 通过通信ID获取设备实例
* @param communicationId:
* @return com.esv.datacenter.iot.module.devicemodel.entity.DeviceInstanceEntity
* @author huangChaobin@esvtek.com
* @createTime 2020/08/12 13:45
**/
DeviceInstanceEntity getInstanceByCommunicationId(String communicationId);
}
......@@ -39,6 +39,7 @@ public class DeviceInstanceServiceImpl extends ServiceImpl<DeviceInstanceDao, De
DeviceInstanceEntity entity = new DeviceInstanceEntity();
BeanUtils.copyProperties(form, entity);
entity.setCommunicationId(UUID.randomUUID().toString().replaceAll("-", ""));
this.getBaseMapper().insert(entity);
return entity.getId();
......@@ -131,4 +132,10 @@ public class DeviceInstanceServiceImpl extends ServiceImpl<DeviceInstanceDao, De
return instanceCountMap;
}
@Override
public DeviceInstanceEntity getInstanceByCommunicationId(String communicationId) {
return this.getBaseMapper().selectOne(new LambdaQueryWrapper<DeviceInstanceEntity>()
.eq(DeviceInstanceEntity::getCommunicationId, communicationId));
}
}
\ No newline at end of file
......@@ -13,6 +13,7 @@
<result property="description" column="description"/>
<result property="businessId" column="business_id"/>
<result property="deviceModel" column="device_model"/>
<result property="communicationId" column="communication_id"/>
<result property="deleted" column="deleted"/>
<result property="createUser" column="create_user"/>
<result property="updateUser" column="update_user"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment