修改绑定1
This commit is contained in:
@ -181,12 +181,14 @@ public class DeviceBizService {
|
|||||||
|
|
||||||
QueryWrapper<AppDeviceBindRecord> bindRecordQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<AppDeviceBindRecord> bindRecordQueryWrapper = new QueryWrapper<>();
|
||||||
bindRecordQueryWrapper.eq("device_id", device.getId());
|
bindRecordQueryWrapper.eq("device_id", device.getId());
|
||||||
|
bindRecordQueryWrapper.eq("communication_mode", 0);
|
||||||
AppDeviceBindRecord appDeviceBindRecord = appDeviceBindRecordMapper.selectOne(bindRecordQueryWrapper);
|
AppDeviceBindRecord appDeviceBindRecord = appDeviceBindRecordMapper.selectOne(bindRecordQueryWrapper);
|
||||||
if (appDeviceBindRecord != null) {
|
if (appDeviceBindRecord != null) {
|
||||||
UpdateWrapper<AppDeviceBindRecord> deviceUpdateWrapper = new UpdateWrapper<>();
|
UpdateWrapper<AppDeviceBindRecord> deviceUpdateWrapper = new UpdateWrapper<>();
|
||||||
deviceUpdateWrapper.eq("device_id", device.getId())
|
deviceUpdateWrapper.eq("device_id", device.getId())
|
||||||
.set("binding_status", BindingStatusEnum.BOUND.getCode())
|
.set("binding_status", BindingStatusEnum.BOUND.getCode())
|
||||||
.set("binding_user_id", userId)
|
.set("binding_user_id", userId)
|
||||||
|
.set("communication_mode", 0)
|
||||||
.set("update_time", new Date())
|
.set("update_time", new Date())
|
||||||
.set("binding_time", new Date());
|
.set("binding_time", new Date());
|
||||||
return appDeviceBindRecordMapper.update(null, deviceUpdateWrapper);
|
return appDeviceBindRecordMapper.update(null, deviceUpdateWrapper);
|
||||||
@ -195,6 +197,7 @@ public class DeviceBizService {
|
|||||||
bindRecord.setDeviceId(device.getId());
|
bindRecord.setDeviceId(device.getId());
|
||||||
bindRecord.setBindingUserId(userId);
|
bindRecord.setBindingUserId(userId);
|
||||||
bindRecord.setBindingTime(new Date());
|
bindRecord.setBindingTime(new Date());
|
||||||
|
bindRecord.setCommunicationMode(0);
|
||||||
bindRecord.setCreateBy(userId);
|
bindRecord.setCreateBy(userId);
|
||||||
appDeviceBindRecordMapper.insert(bindRecord);
|
appDeviceBindRecordMapper.insert(bindRecord);
|
||||||
}
|
}
|
||||||
@ -224,6 +227,7 @@ public class DeviceBizService {
|
|||||||
deviceUpdateWrapper.eq("device_id", device.getId())
|
deviceUpdateWrapper.eq("device_id", device.getId())
|
||||||
.eq("binding_user_id", userId)
|
.eq("binding_user_id", userId)
|
||||||
.set("binding_user_id", userId)
|
.set("binding_user_id", userId)
|
||||||
|
.set("communication_mode", 1)
|
||||||
.set("binding_time", new Date());
|
.set("binding_time", new Date());
|
||||||
return appDeviceBindRecordMapper.update(null, deviceUpdateWrapper);
|
return appDeviceBindRecordMapper.update(null, deviceUpdateWrapper);
|
||||||
} else {
|
} else {
|
||||||
@ -231,6 +235,7 @@ public class DeviceBizService {
|
|||||||
bindRecord.setDeviceId(device.getId());
|
bindRecord.setDeviceId(device.getId());
|
||||||
bindRecord.setBindingUserId(userId);
|
bindRecord.setBindingUserId(userId);
|
||||||
bindRecord.setBindingTime(new Date());
|
bindRecord.setBindingTime(new Date());
|
||||||
|
bindRecord.setCommunicationMode(1);
|
||||||
bindRecord.setCreateBy(userId);
|
bindRecord.setCreateBy(userId);
|
||||||
appDeviceBindRecordMapper.insert(bindRecord);
|
appDeviceBindRecordMapper.insert(bindRecord);
|
||||||
}
|
}
|
||||||
|
@ -50,5 +50,6 @@ public class AppDeviceBindRecord extends TenantEntity {
|
|||||||
*/
|
*/
|
||||||
private Date bindingTime;
|
private Date bindingTime;
|
||||||
|
|
||||||
|
private Integer communicationMode;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -254,9 +254,9 @@
|
|||||||
c.binding_time
|
c.binding_time
|
||||||
from device d
|
from device d
|
||||||
inner join device_type dt on d.device_type = dt.id
|
inner join device_type dt on d.device_type = dt.id
|
||||||
inner join app_device_bind_record c on d.id = c.device_id
|
inner join app_device_bind_record c on d.id = c.device_id and c.communication_mode = 0
|
||||||
left join app_personnel_info ap on ap.device_id = d.id
|
left join app_personnel_info ap on ap.device_id = d.id
|
||||||
where dt.communication_mode = 0
|
where dt.communication_mode in (0, 2)
|
||||||
<if test="criteria.deviceType != null">
|
<if test="criteria.deviceType != null">
|
||||||
and d.device_type = #{criteria.deviceType}
|
and d.device_type = #{criteria.deviceType}
|
||||||
</if>
|
</if>
|
||||||
|
Reference in New Issue
Block a user