DifyApiConfigDTO.java
1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package com.aigeo.ai.dto;
import com.aigeo.ai.entity.DifyApiConfig;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.beans.BeanUtils;
/**
* Dify API配置DTO
*/
@Data
@Schema(description = "Dify API配置DTO")
public class DifyApiConfigDTO {
@Schema(description = "配置ID")
private Integer id;
@Schema(description = "公司ID")
private Integer companyId;
@Schema(description = "配置名称")
private String name;
@Schema(description = "API Key")
private String apiKey;
@Schema(description = "API地址")
private String apiUrl;
@Schema(description = "是否启用")
private Boolean isActive;
@Schema(description = "备注")
private String remark;
/**
* 将DTO转换为实体类
*/
public DifyApiConfig toEntity() {
DifyApiConfig entity = new DifyApiConfig();
BeanUtils.copyProperties(this, entity);
return entity;
}
/**
* 将实体类转换为DTO
*/
public static DifyApiConfigDTO fromEntity(DifyApiConfig entity) {
DifyApiConfigDTO dto = new DifyApiConfigDTO();
BeanUtils.copyProperties(entity, dto);
return dto;
}
}