Initial commit

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
liu
2026-02-03 10:10:11 +08:00
commit 14289beb66
45 changed files with 15479 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
package com.sftp.manager.model;
import lombok.Data;
import javax.persistence.*;
import java.time.LocalDateTime;
@Data
@Entity
@Table(name = "connections")
public class Connection {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id; // 连接ID主键
@Column(nullable = false)
private String name; // 连接名称(用户自定义)
@Column(nullable = false)
private String host; // SFTP服务器地址
private Integer port; // SFTP端口默认22
@Column(nullable = false)
private String username; // 用户名
@Column(columnDefinition = "TEXT")
private String password; // 密码(加密存储)
private String privateKeyPath; // 私钥路径(可选)
private String passPhrase; // 私钥密码(可选)
private Integer connectTimeout; // 连接超时时间
private String rootPath; // 默认登录后路径
@Column(name = "created_at")
private LocalDateTime createdAt; // 创建时间
@Column(name = "updated_at")
private LocalDateTime updatedAt; // 更新时间
@PrePersist
protected void onCreate() {
createdAt = LocalDateTime.now();
updatedAt = LocalDateTime.now();
if (port == null) {
port = 22;
}
if (connectTimeout == null) {
connectTimeout = 10000;
}
}
@PreUpdate
protected void onUpdate() {
updatedAt = LocalDateTime.now();
}
}