Skip to content

Commit cde2bf5

Browse files
refactor: Simplify the code structure of Dtos and entity classes using Lombok
1 parent 4dc5f23 commit cde2bf5

File tree

11 files changed

+92
-699
lines changed

11 files changed

+92
-699
lines changed

spring-ai-alibaba-data-agent-chat/src/main/java/com/alibaba/cloud/ai/dto/BusinessKnowledgeDTO.java

Lines changed: 5 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,14 @@
1515
*/
1616
package com.alibaba.cloud.ai.dto;
1717

18+
import lombok.Data;
19+
import lombok.NoArgsConstructor;
20+
1821
/**
1922
* Business knowledge management entity class
2023
*/
24+
@Data
25+
@NoArgsConstructor
2126
public class BusinessKnowledgeDTO {
2227

2328
private String businessTerm; // Business term
@@ -32,9 +37,6 @@ public class BusinessKnowledgeDTO {
3237

3338
private String agentId; // Associated agent ID
3439

35-
public BusinessKnowledgeDTO() {
36-
}
37-
3840
public BusinessKnowledgeDTO(String businessTerm, String description, String synonyms, Boolean defaultRecall,
3941
String datasetId) {
4042
this.businessTerm = businessTerm;
@@ -55,54 +57,4 @@ public BusinessKnowledgeDTO(String businessTerm, String description, String syno
5557
this.agentId = agentId;
5658
}
5759

58-
// Getters and Setters
59-
60-
public String getBusinessTerm() {
61-
return businessTerm;
62-
}
63-
64-
public void setBusinessTerm(String businessTerm) {
65-
this.businessTerm = businessTerm;
66-
}
67-
68-
public String getDescription() {
69-
return description;
70-
}
71-
72-
public void setDescription(String description) {
73-
this.description = description;
74-
}
75-
76-
public String getSynonyms() {
77-
return synonyms;
78-
}
79-
80-
public void setSynonyms(String synonyms) {
81-
this.synonyms = synonyms;
82-
}
83-
84-
public Boolean getDefaultRecall() {
85-
return defaultRecall;
86-
}
87-
88-
public void setDefaultRecall(Boolean defaultRecall) {
89-
this.defaultRecall = defaultRecall;
90-
}
91-
92-
public String getDatasetId() {
93-
return datasetId;
94-
}
95-
96-
public void setDatasetId(String datasetId) {
97-
this.datasetId = datasetId;
98-
}
99-
100-
public String getAgentId() {
101-
return agentId;
102-
}
103-
104-
public void setAgentId(String agentId) {
105-
this.agentId = agentId;
106-
}
107-
10860
}

spring-ai-alibaba-data-agent-chat/src/main/java/com/alibaba/cloud/ai/dto/SemanticModelDTO.java

Lines changed: 7 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,18 @@
1515
*/
1616
package com.alibaba.cloud.ai.dto;
1717

18+
import lombok.Data;
19+
import lombok.NoArgsConstructor;
20+
import lombok.AllArgsConstructor;
21+
1822
/**
1923
* Semantic model configuration entity class
2024
*
2125
* @author jast
2226
*/
27+
@Data
28+
@NoArgsConstructor
29+
@AllArgsConstructor
2330
public class SemanticModelDTO {
2431

2532
private Long id; // Unique identifier
@@ -42,9 +49,6 @@ public class SemanticModelDTO {
4249

4350
private String originalDescription; // Original field description
4451

45-
public SemanticModelDTO() {
46-
}
47-
4852
public SemanticModelDTO(Long agentId, String originalFieldName, String agentFieldName, String fieldSynonyms,
4953
String fieldDescription, Boolean defaultRecall, Boolean enabled, String fieldType,
5054
String originalDescription) {
@@ -72,88 +76,6 @@ public SemanticModelDTO(String originalFieldName, String agentFieldName, String
7276
this.enabled = enabled;
7377
}
7478

75-
// Getters and Setters
76-
public Long getAgentId() {
77-
return agentId;
78-
}
79-
80-
public void setAgentId(Long agentId) {
81-
this.agentId = agentId;
82-
}
83-
84-
// Getters and Setters
85-
public Long getId() {
86-
return id;
87-
}
88-
89-
public void setId(Long id) {
90-
this.id = id;
91-
}
92-
93-
public String getOriginalFieldName() {
94-
return originalFieldName;
95-
}
96-
97-
public void setOriginalFieldName(String originalFieldName) {
98-
this.originalFieldName = originalFieldName;
99-
}
100-
101-
public String getAgentFieldName() {
102-
return agentFieldName;
103-
}
104-
105-
public void setAgentFieldName(String agentFieldName) {
106-
this.agentFieldName = agentFieldName;
107-
}
108-
109-
public String getFieldSynonyms() {
110-
return fieldSynonyms;
111-
}
112-
113-
public void setFieldSynonyms(String fieldSynonyms) {
114-
this.fieldSynonyms = fieldSynonyms;
115-
}
116-
117-
public String getFieldDescription() {
118-
return fieldDescription;
119-
}
120-
121-
public void setFieldDescription(String fieldDescription) {
122-
this.fieldDescription = fieldDescription;
123-
}
124-
125-
public Boolean getDefaultRecall() {
126-
return defaultRecall;
127-
}
128-
129-
public void setDefaultRecall(Boolean defaultRecall) {
130-
this.defaultRecall = defaultRecall;
131-
}
132-
133-
public Boolean getEnabled() {
134-
return enabled;
135-
}
136-
137-
public void setEnabled(Boolean enabled) {
138-
this.enabled = enabled;
139-
}
140-
141-
public String getFieldType() {
142-
return fieldType;
143-
}
144-
145-
public void setFieldType(String fieldType) {
146-
this.fieldType = fieldType;
147-
}
148-
149-
public String getOriginalDescription() {
150-
return originalDescription;
151-
}
152-
153-
public void setOriginalDescription(String originalDescription) {
154-
this.originalDescription = originalDescription;
155-
}
156-
15779
@Override
15880
public String toString() {
15981
return String.format("智能体字段名: %s, 数据库字段名: %s, 字段同义词: %s, 智能体字段描述: %s, 字段类型: %s, 数据库字段描述: %s",

spring-ai-alibaba-data-agent-chat/src/main/java/com/alibaba/cloud/ai/dto/schema/ColumnDTO.java

Lines changed: 4 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@
1818
import com.alibaba.cloud.ai.util.JsonUtil;
1919
import com.fasterxml.jackson.core.JsonProcessingException;
2020
import com.fasterxml.jackson.databind.ObjectMapper;
21+
import lombok.Data;
22+
import lombok.NoArgsConstructor;
2123

2224
import java.util.List;
2325
import java.util.Map;
2426

27+
@Data
28+
@NoArgsConstructor
2529
public class ColumnDTO {
2630

2731
private String name;
@@ -40,70 +44,6 @@ public class ColumnDTO {
4044

4145
private Map<String, String> mapping;
4246

43-
public String getName() {
44-
return name;
45-
}
46-
47-
public void setName(String name) {
48-
this.name = name;
49-
}
50-
51-
public String getDescription() {
52-
return description;
53-
}
54-
55-
public void setDescription(String description) {
56-
this.description = description;
57-
}
58-
59-
public int getEnumeration() {
60-
return enumeration;
61-
}
62-
63-
public void setEnumeration(int enumeration) {
64-
this.enumeration = enumeration;
65-
}
66-
67-
public String getRange() {
68-
return range;
69-
}
70-
71-
public void setRange(String range) {
72-
this.range = range;
73-
}
74-
75-
public String getType() {
76-
return type;
77-
}
78-
79-
public void setType(String type) {
80-
this.type = type;
81-
}
82-
83-
public List<String> getSamples() {
84-
return samples;
85-
}
86-
87-
public void setSamples(List<String> samples) {
88-
this.samples = samples;
89-
}
90-
91-
public List<String> getData() {
92-
return data;
93-
}
94-
95-
public void setData(List<String> data) {
96-
this.data = data;
97-
}
98-
99-
public Map<String, String> getMapping() {
100-
return mapping;
101-
}
102-
103-
public void setMapping(Map<String, String> mapping) {
104-
this.mapping = mapping;
105-
}
106-
10747
@Override
10848
public String toString() {
10949
ObjectMapper objectMapper = JsonUtil.getObjectMapper();

spring-ai-alibaba-data-agent-chat/src/main/java/com/alibaba/cloud/ai/dto/schema/SchemaDTO.java

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@
1616
package com.alibaba.cloud.ai.dto.schema;
1717

1818
import java.util.List;
19+
import lombok.Data;
20+
import lombok.NoArgsConstructor;
1921

22+
@Data
23+
@NoArgsConstructor
2024
public class SchemaDTO {
2125

2226
private String name;
@@ -29,46 +33,6 @@ public class SchemaDTO {
2933

3034
private List<List<String>> foreignKeys;
3135

32-
public String getName() {
33-
return name;
34-
}
35-
36-
public void setName(String name) {
37-
this.name = name;
38-
}
39-
40-
public String getDescription() {
41-
return description;
42-
}
43-
44-
public void setDescription(String description) {
45-
this.description = description;
46-
}
47-
48-
public Integer getTableCount() {
49-
return tableCount;
50-
}
51-
52-
public void setTableCount(Integer tableCount) {
53-
this.tableCount = tableCount;
54-
}
55-
56-
public List<TableDTO> getTable() {
57-
return table;
58-
}
59-
60-
public void setTable(List<TableDTO> table) {
61-
this.table = table;
62-
}
63-
64-
public List<List<String>> getForeignKeys() {
65-
return foreignKeys;
66-
}
67-
68-
public void setForeignKeys(List<List<String>> foreignKeys) {
69-
this.foreignKeys = foreignKeys;
70-
}
71-
7236
@Override
7337
public String toString() {
7438
return "SchemaDTO{" + "name='" + name + '\'' + ", description='" + description + '\'' + ", tableCount="

spring-ai-alibaba-data-agent-chat/src/main/java/com/alibaba/cloud/ai/dto/schema/TableDTO.java

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@
1818
import com.alibaba.cloud.ai.util.JsonUtil;
1919
import com.fasterxml.jackson.core.JsonProcessingException;
2020
import com.fasterxml.jackson.databind.ObjectMapper;
21+
import lombok.Data;
22+
import lombok.NoArgsConstructor;
2123

2224
import java.util.ArrayList;
2325
import java.util.List;
2426

27+
@Data
28+
@NoArgsConstructor
2529
public class TableDTO {
2630

2731
private String name;
@@ -32,38 +36,6 @@ public class TableDTO {
3236

3337
private List<String> primaryKeys;
3438

35-
public String getName() {
36-
return name;
37-
}
38-
39-
public void setName(String name) {
40-
this.name = name;
41-
}
42-
43-
public String getDescription() {
44-
return description;
45-
}
46-
47-
public void setDescription(String description) {
48-
this.description = description;
49-
}
50-
51-
public List<ColumnDTO> getColumn() {
52-
return column;
53-
}
54-
55-
public void setColumn(List<ColumnDTO> column) {
56-
this.column = column;
57-
}
58-
59-
public List<String> getPrimaryKeys() {
60-
return primaryKeys;
61-
}
62-
63-
public void setPrimaryKeys(List<String> primaryKeys) {
64-
this.primaryKeys = primaryKeys;
65-
}
66-
6739
@Override
6840
public String toString() {
6941
ObjectMapper objectMapper = JsonUtil.getObjectMapper();

0 commit comments

Comments
 (0)