Skip to content

Commit 270cf6a

Browse files
committed
fix(nl2sql): 同步Mapper文件中的SQL字段名映射
1 parent 3cd2eb1 commit 270cf6a

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

spring-ai-alibaba-nl2sql/spring-ai-alibaba-nl2sql-management/src/main/java/com/alibaba/cloud/ai/mapper/BusinessKnowledgeMapper.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ public interface BusinessKnowledgeMapper extends BaseMapper<BusinessKnowledge> {
3535
/**
3636
* Query business knowledge list by dataset ID
3737
*/
38-
@Select("SELECT * FROM business_knowledge WHERE dataset_id = #{datasetId} ORDER BY created_time DESC")
38+
@Select("SELECT * FROM business_knowledge WHERE data_set_id = #{datasetId} ORDER BY created_time DESC")
3939
List<BusinessKnowledge> selectByDatasetId(@Param("datasetId") String datasetId);
4040

4141
/**
4242
* Get all dataset ID list
4343
*/
44-
@Select("SELECT DISTINCT dataset_id FROM business_knowledge WHERE dataset_id IS NOT NULL ORDER BY dataset_id")
44+
@Select("SELECT DISTINCT data_set_id FROM business_knowledge WHERE data_set_id IS NOT NULL ORDER BY data_set_id")
4545
List<String> selectDistinctDatasetIds();
4646

4747
/**
@@ -61,7 +61,7 @@ public interface BusinessKnowledgeMapper extends BaseMapper<BusinessKnowledge> {
6161
/**
6262
* Query business knowledge by dataset ID and default recall status
6363
*/
64-
@Select("SELECT * FROM business_knowledge WHERE dataset_id = #{datasetId} AND default_recall = #{defaultRecall} ORDER BY created_time DESC")
64+
@Select("SELECT * FROM business_knowledge WHERE data_set_id = #{datasetId} AND is_recall = #{defaultRecall} ORDER BY created_time DESC")
6565
List<BusinessKnowledge> selectByDatasetIdAndDefaultRecall(@Param("datasetId") String datasetId,
6666
@Param("defaultRecall") Boolean defaultRecall);
6767

spring-ai-alibaba-nl2sql/spring-ai-alibaba-nl2sql-management/src/main/java/com/alibaba/cloud/ai/mapper/SemanticModelMapper.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,27 +42,27 @@ public interface SemanticModelMapper extends BaseMapper<SemanticModel> {
4242
/**
4343
* Search semantic models by keyword
4444
*/
45-
@Select("SELECT * FROM semantic_model WHERE " + "agent_field_name LIKE CONCAT('%', #{keyword}, '%') OR "
46-
+ "field_description LIKE CONCAT('%', #{keyword}, '%') OR "
47-
+ "field_synonyms LIKE CONCAT('%', #{keyword}, '%') " + "ORDER BY created_time DESC")
45+
@Select("SELECT * FROM semantic_model WHERE " + "field_name LIKE CONCAT('%', #{keyword}, '%') OR "
46+
+ "description LIKE CONCAT('%', #{keyword}, '%') OR "
47+
+ "synonyms LIKE CONCAT('%', #{keyword}, '%') " + "ORDER BY created_time DESC")
4848
List<SemanticModel> searchByKeyword(@Param("keyword") String keyword);
4949

5050
/**
5151
* Batch enable fields
5252
*/
53-
@Update("UPDATE semantic_model SET enabled = 1 WHERE id = #{id}")
53+
@Update("UPDATE semantic_model SET status = 1 WHERE id = #{id}")
5454
int enableById(@Param("id") Long id);
5555

5656
/**
5757
* Batch disable fields
5858
*/
59-
@Update("UPDATE semantic_model SET enabled = 0 WHERE id = #{id}")
59+
@Update("UPDATE semantic_model SET status = 0 WHERE id = #{id}")
6060
int disableById(@Param("id") Long id);
6161

6262
/**
6363
* Query semantic models by agent ID and enabled status
6464
*/
65-
@Select("SELECT * FROM semantic_model WHERE agent_id = #{agentId} AND enabled = #{enabled} ORDER BY created_time DESC")
65+
@Select("SELECT * FROM semantic_model WHERE agent_id = #{agentId} AND status = #{enabled} ORDER BY created_time DESC")
6666
List<SemanticModel> selectByAgentIdAndEnabled(@Param("agentId") Long agentId, @Param("enabled") Boolean enabled);
6767

6868
}

0 commit comments

Comments
 (0)