新增绑定时间字段

This commit is contained in:
2025-07-14 14:23:17 +08:00
parent f938716e2d
commit 530ee83488
2 changed files with 11 additions and 4 deletions

View File

@ -9,6 +9,8 @@ import com.fuyuanshen.common.tenant.core.TenantEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.Date;
/**
* @Description: 设备表
* @Author: WY
@ -114,4 +116,6 @@ public class Device extends TenantEntity {
private String createByName;
private Long bindingUserId;
private Date bindingTime;
}

View File

@ -527,8 +527,9 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
UpdateWrapper<Device> deviceUpdateWrapper = new UpdateWrapper<>();
deviceUpdateWrapper.eq("id", device.getId())
.set("binding_status", BindingStatusEnum.BOUND.getCode())
.set("binding_user_id", userId);
;
.set("binding_user_id", userId)
.set("binding_time", new Date());
return baseMapper.update(null, deviceUpdateWrapper);
} else if (mode == CommunicationModeEnum.BLUETOOTH.getValue()) {
@ -546,7 +547,8 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
UpdateWrapper<Device> deviceUpdateWrapper = new UpdateWrapper<>();
deviceUpdateWrapper.eq("id", device.getId())
.set("binding_status", BindingStatusEnum.BOUND.getCode())
.set("binding_user_id", userId);
.set("binding_user_id", userId)
.set("binding_time", new Date());
return baseMapper.update(null, deviceUpdateWrapper);
} else {
throw new RuntimeException("通讯方式错误");
@ -565,7 +567,8 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
UpdateWrapper<Device> deviceUpdateWrapper = new UpdateWrapper<>();
deviceUpdateWrapper.eq("id", device.getId())
.set("binding_status", BindingStatusEnum.UNBOUND.getCode())
.set("binding_user_id", null);
.set("binding_user_id", null)
.set("binding_time", null);
return baseMapper.update(null, deviceUpdateWrapper);
}