1
0

分页查询设备

This commit is contained in:
2025-06-28 17:18:05 +08:00
parent 1d286634c0
commit f9f5569504
22 changed files with 2078 additions and 30 deletions

View File

@ -0,0 +1,42 @@
package com.fuyuanshen.equipment.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.conditions.update.Update;
import com.fuyuanshen.common.tenant.core.TenantEntity;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
/**
* @author: 默苍璃
* @date: 2025-06-1308:57
*/
@Getter
@Setter
@TableName("customer_device")
public class CustomerDevice extends TenantEntity {
@NotNull(groups = Update.class)
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@TableField(value = "customer_id")
private Long customerId;
@TableField(value = "device_id")
private Long deviceId;
/**
* 设备状态
* 0 失效
* 1 正常
*/
@TableField(value = "assign_status")
private Byte assignStatus;
}

View File

@ -0,0 +1,112 @@
package com.fuyuanshen.equipment.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fuyuanshen.common.tenant.core.TenantEntity;
import lombok.Data;
/**
* @Description: 设备表
* @Author: WY
* @Date: 2025/5/16
**/
@Data
@TableName("device")
@JsonInclude(JsonInclude.Include.ALWAYS) // 关键注解
public class Device extends TenantEntity {
@TableId(value = "id", type = IdType.AUTO)
// @ApiModelProperty(value = "ID")
private Long id;
// @ApiModelProperty(value = "设备记录ID")
@TableField(exist = false)
private Long assignId;
// @ApiModelProperty(value = "设备类型")
private Long deviceType;
// @ApiModelProperty(value = "设备类型名称")
private String typeName;
// @ApiModelProperty(value = "客户号")
private Long customerId;
/**
* 当前所有者
* current_owner_id
*/
// @ApiModelProperty(value = "当前所有者")
private Long currentOwnerId;
/**
* 原始所有者(创建者)
* original_owner_id
*/
// @ApiModelProperty(value = "原始所有者(创建者)")
private Long originalOwnerId;
// @ApiModelProperty(value = "所属客户")
private String customerName;
/*@ApiModelProperty(value = "设备编号")
private String deviceNo;*/
// @ApiModelProperty(value = "设备名称")
private String deviceName;
// @ApiModelProperty(value = "设备图片")
private String devicePic;
// @ApiModelProperty(value = "设备MAC")
private String deviceMac;
// @ApiModelProperty(value = "设备IMEI")
private String deviceImei;
// @ApiModelProperty(value = "设备SN")
private String deviceSn;
// @ApiModelProperty(value = "经度")
private String longitude;
// @ApiModelProperty(value = "纬度")
private String latitude;
// @ApiModelProperty(value = "备注")
private String remark;
/**
* 租户ID
*/
// @TableField(value = "tenant_id")
// // @ApiModelProperty(hidden = true)
// private Long tenantId;
/**
* 设备状态
* 0 失效
* 1 正常
*/
// @ApiModelProperty(value = "设备状态")
private Integer deviceStatus;
/**
* 绑定状态
* 0 未绑定
* 1 已绑定
*/
// @ApiModelProperty(value = "绑定状态")
private Integer bindingStatus;
public void copy(Device source) {
BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
}
}

View File

@ -0,0 +1,86 @@
package com.fuyuanshen.equipment.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fuyuanshen.common.tenant.core.TenantEntity;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 设备分配记录表
*
* @TableName device_assignments
*/
@TableName(value = "device_assignments")
@Data
public class DeviceAssignments extends TenantEntity {
/**
* id
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
* 设备id
*/
private Long deviceId;
/**
* 分配方
*/
private Long fromCustomerId;
/**
* 接收方
*/
private Long toCustomerId;
/**
* 分配者
* assigner_name
*/
private Long assignerId;
private String assignerName;
/**
* 接收者
* assignee_name
*/
private Long assigneeId;
private String assigneeName;
/**
* 分配时间
*/
private LocalDateTime assignedAt;
/**
* 0 未授权
* 1 已授权
* 是否同步授权了设备类型
*/
private Integer deviceTypeGranted;
/**
* 0 否
* 1 是
* 是否直接分配(用于父级显示)
*/
private Integer direct;
/**
* 0 否
* 1 是
* 设备是否有效
*/
private Integer active;
/**
* 分配等级(用于失效)
*/
private String lever;
}

View File

@ -0,0 +1,40 @@
package com.fuyuanshen.equipment.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fuyuanshen.common.tenant.core.TenantEntity;
import lombok.Data;
/**
* @Description:
* @Author: WY
* @Date: 2025/5/24
**/
@Data
@TableName("device_log")
public class DeviceLog extends TenantEntity {
@TableId(value = "id", type = IdType.AUTO)
// @ApiModelProperty(value = "ID")
private Long id;
// @ApiModelProperty(value = "设备行为")
private String deviceAction;
// @ApiModelProperty(value = "设备名称")
private String deviceName;
// @ApiModelProperty(value = "数据来源")
private String dataSource;
// @ApiModelProperty(value = "内容")
private String content;
public void copy(DeviceLog source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}

View File

@ -0,0 +1,59 @@
package com.fuyuanshen.equipment.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fuyuanshen.common.tenant.core.TenantEntity;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
/**
* @Description: 设备类型
* @Author: WY
* @Date: 2025/5/14
**/
@Data
@TableName("device_type")
public class DeviceType extends TenantEntity {
@TableId(value = "id", type = IdType.AUTO)
// @ApiModelProperty(value = "ID", hidden = true)
private Long id;
// @ApiModelProperty(value = "客户号")
private Long customerId;
// @ApiModelProperty(value = "创建该类型的客户")
private Long ownerCustomerId;
/**
* 租户ID
*/
// @TableField(value = "tenant_id")
// @ApiModelProperty(hidden = true)
// private Long tenantId;
@NotBlank(message = "设备类型名称不能为空")
// @ApiModelProperty(value = "类型名称", required = true)
private String typeName;
// @ApiModelProperty(value = "是否支持蓝牙")
private Boolean isSupportBle;
// @ApiModelProperty(value = "定位方式", example = "0:无;1:GPS;2:基站;3:wifi;4:北斗")
private String locateMode;
// @ApiModelProperty(value = "联网方式", example = "0:无;1:4G;2:WIFI")
private String networkWay;
// @ApiModelProperty(value = "通讯方式", example = "0:4G;1:蓝牙")
private String communicationMode;
public void copy(DeviceType source) {
BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
}
}

View File

@ -0,0 +1,95 @@
package com.fuyuanshen.equipment.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fuyuanshen.common.tenant.core.TenantEntity;
import lombok.Data;
import java.util.Date;
/**
* 设备分配权限表 (解决跨客户共享)
*
* @TableName device_type_grants
*/
@TableName(value = "device_type_grants")
@Data
public class DeviceTypeGrants extends TenantEntity {
/**
* id
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
* 设备类型
*/
private Long deviceTypeId;
/**
* 被授权的客户
*/
private Long customerId;
/**
* 授权方客户
*/
private Long grantorCustomerId;
/**
* 生成日期
*/
private Date grantedAt;
/**
* 关联分配记录
*/
private Long assignmentId;
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
DeviceTypeGrants other = (DeviceTypeGrants) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) && (this.getDeviceTypeId() == null ? other.getDeviceTypeId() == null : this.getDeviceTypeId().equals(other.getDeviceTypeId())) && (this.getCustomerId() == null ? other.getCustomerId() == null : this.getCustomerId().equals(other.getCustomerId())) && (this.getGrantorCustomerId() == null ? other.getGrantorCustomerId() == null : this.getGrantorCustomerId().equals(other.getGrantorCustomerId())) && (this.getGrantedAt() == null ? other.getGrantedAt() == null : this.getGrantedAt().equals(other.getGrantedAt())) && (this.getAssignmentId() == null ? other.getAssignmentId() == null : this.getAssignmentId().equals(other.getAssignmentId()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getDeviceTypeId() == null) ? 0 : getDeviceTypeId().hashCode());
result = prime * result + ((getCustomerId() == null) ? 0 : getCustomerId().hashCode());
result = prime * result + ((getGrantorCustomerId() == null) ? 0 : getGrantorCustomerId().hashCode());
result = prime * result + ((getGrantedAt() == null) ? 0 : getGrantedAt().hashCode());
result = prime * result + ((getAssignmentId() == null) ? 0 : getAssignmentId().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", deviceTypeId=").append(deviceTypeId);
sb.append(", customerId=").append(customerId);
sb.append(", grantorCustomerId=").append(grantorCustomerId);
sb.append(", grantedAt=").append(grantedAt);
sb.append(", assignmentId=").append(assignmentId);
sb.append("]");
return sb.toString();
}
}

View File

@ -0,0 +1,64 @@
package com.fuyuanshen.equipment.domain.dto;
import lombok.Data;
import java.sql.Timestamp;
import java.util.List;
import java.util.Set;
/**
* 设备查询参数
*
* @Description:
* @Author: WY
* @Date: 2025/5/16
**/
@Data
public class DeviceQueryCriteria {
// @ApiModelProperty(value = "设备名称")
private String deviceName;
// @ApiModelProperty(value = "设备类型")
private Long deviceType;
// @ApiModelProperty(value = "设备MAC")
private String deviceMac;
// @ApiModelProperty(value = "设备IMEI")
private String deviceImei;
// @ApiModelProperty(value = "设备SN")
private String deviceSn;
/**
* 设备状态
* 0 失效
* 1 正常
*/
// @ApiModelProperty(value = "设备状态 0 失效 1 正常 ")
private Integer deviceStatus;
// @ApiModelProperty(value = "创建时间")
private List<Timestamp> createTime;
// @ApiModelProperty(value = "页码", example = "1")
private Integer page = 1;
// @ApiModelProperty(value = "每页数据量", example = "10")
private Integer size = 10;
// @ApiModelProperty(value = "客户id")
private Long customerId;
private Set<Long> customerIds;
// @ApiModelProperty(value = "当前所有者")
private Long currentOwnerId;
// @ApiModelProperty(value = "租户ID")
private Long tenantId;
// @ApiModelProperty(value = "通讯方式", example = "0:4G;1:蓝牙")
private Integer communicationMode;
}