|
@@ -25,9 +25,8 @@ import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
- * @description Text2SqlService
|
|
|
- *
|
|
|
* @author GaoKunW
|
|
|
+ * @description Text2SqlService
|
|
|
* @date 2025/3/12 10:54
|
|
|
*/
|
|
|
@Slf4j
|
|
@@ -88,16 +87,25 @@ public class Text2SqlService implements IText2SqlService {
|
|
|
return new JSONArray().put("只支持查询");
|
|
|
}
|
|
|
List<Map<String, Object>> mapList = text2SqlMapper.executeSql(sql);
|
|
|
- List<CommentVo> tableNames = this.commentByTableName("eco-boot", question.getTableName());
|
|
|
+ List<CommentVo> tableNames = this.commentByTableName(DataBaseHelper.getSchema(), question.getTableName());
|
|
|
return this.getCommentData(mapList, tableNames);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public ContentVo getQuestion(String question) {
|
|
|
String tableName = this.tableNameByNl(question);
|
|
|
- Map<String, String> map = text2SqlMapper.selectTableDdl(tableName);
|
|
|
+ Map<String, String> map = Collections.emptyMap();
|
|
|
+ if (DataBaseHelper.isMySql()) {
|
|
|
+ map = text2SqlMapper.selectTableDdlByMysql(tableName);
|
|
|
+ } else if (DataBaseHelper.isDmSql()) {
|
|
|
+ map = text2SqlMapper.selectTableDdlDm(DataBaseHelper.getSchema(), tableName);
|
|
|
+ }
|
|
|
String ddl = map.get("create table");
|
|
|
- return ContentVo.builder().content(ddl + "\n" + question + ",根据需求生成Mysql的查询SQL,不要需求外的条件,只输出sql语句不需要任何格式样式,就是一串sql").tableName(tableName).build();
|
|
|
+ return ContentVo.builder().content(ddl + "\n" + question + ",根据需求生成Mysql的查询SQL.\n" +
|
|
|
+ "1.不要需求外的条件.\n" +
|
|
|
+ "2.只输出sql语句不需要任何格式样式,就是一串sql.\n" +
|
|
|
+ "3.不需要带Schema:" + DataBaseHelper.getSchema()).
|
|
|
+ tableName(tableName).build();
|
|
|
|
|
|
}
|
|
|
|