作者 dong

按钮管理发送内容修改未textarea 并增加高度,新增修改详情同理,回答框增加高度,

@@ -137,11 +137,9 @@ public class AiragLogController extends JeecgController<AiragLog, IAiragLogServi @@ -137,11 +137,9 @@ public class AiragLogController extends JeecgController<AiragLog, IAiragLogServi
137 public Result<String> saveToQuestionLibrary(@RequestBody AiragLog airagLog) { 137 public Result<String> saveToQuestionLibrary(@RequestBody AiragLog airagLog) {
138 QuestionEmbedding questionEmbedding = new QuestionEmbedding(); 138 QuestionEmbedding questionEmbedding = new QuestionEmbedding();
139 questionEmbedding.setQuestion(airagLog.getQuestion()); 139 questionEmbedding.setQuestion(airagLog.getQuestion());
140 - List<QuestionEmbedding> list = questionEmbeddingService.findQuestion(questionEmbedding);  
141 - for (QuestionEmbedding questionEmbedding1 : list){  
142 - if(questionEmbedding1.getQuestion().equals(airagLog.getQuestion())){  
143 - return Result.error("问题库已有相同问题,不可存入");  
144 - } 140 + int questionCount = questionEmbeddingService.findQuestionCount(questionEmbedding);
  141 + if(questionCount > 0){
  142 + return Result.error("重复问题不能存入");
145 } 143 }
146 airagLog.setIsStorage(1); 144 airagLog.setIsStorage(1);
147 airagLogService.saveToQuestionLibrary(airagLog); 145 airagLogService.saveToQuestionLibrary(airagLog);
@@ -115,9 +115,9 @@ public class QuestionEmbeddingMapper { @@ -115,9 +115,9 @@ public class QuestionEmbeddingMapper {
115 } 115 }
116 116
117 // 查询所有记录 117 // 查询所有记录
118 - public List<QuestionEmbedding> findQuestion(QuestionEmbedding questionEmbedding) {  
119 - List<QuestionEmbedding> results = new ArrayList<>();  
120 - StringBuilder sql = new StringBuilder("select * from question_embedding where 1 = 1"); 118 + public Integer findQuestionCount(QuestionEmbedding questionEmbedding) {
  119 +
  120 + StringBuilder sql = new StringBuilder("select COUNT(1) AS total_count from question_embedding where 1 = 1");
121 List<Object> params = new ArrayList<>(); 121 List<Object> params = new ArrayList<>();
122 122
123 if(StringUtils.isNotBlank(questionEmbedding.getQuestion())){ 123 if(StringUtils.isNotBlank(questionEmbedding.getQuestion())){
@@ -135,16 +135,15 @@ public class QuestionEmbeddingMapper { @@ -135,16 +135,15 @@ public class QuestionEmbeddingMapper {
135 135
136 try (ResultSet rs = stmt.executeQuery()) { 136 try (ResultSet rs = stmt.executeQuery()) {
137 while (rs.next()) { 137 while (rs.next()) {
138 - results.add(mapRowToQuestionEmbedding(rs)); 138 + return rs.getInt("total_count");
139 } 139 }
  140 + return 0;
140 } 141 }
141 } catch (SQLException e) { 142 } catch (SQLException e) {
142 log.error("查询所有记录失败", e); 143 log.error("查询所有记录失败", e);
143 throw new RuntimeException("查询数据时发生数据库错误", e); 144 throw new RuntimeException("查询数据时发生数据库错误", e);
144 } 145 }
145 146
146 -  
147 - return results;  
148 } 147 }
149 148
150 // 根据ID查询单个记录 149 // 根据ID查询单个记录
@@ -30,10 +30,7 @@ @@ -30,10 +30,7 @@
30 <if test="param1.createTime_begin != '' and param1.createTime_begin != null and param1.createTime_end != null and param1.createTime_end != null"> 30 <if test="param1.createTime_begin != '' and param1.createTime_begin != null and param1.createTime_end != null and param1.createTime_end != null">
31 and create_time between #{param1.createTime_begin} and #{param1.createTime_end} 31 and create_time between #{param1.createTime_begin} and #{param1.createTime_end}
32 </if> 32 </if>
33 -  
34 -  
35 -  
36 - 33 + ORDER BY create_time DESC
37 </select> 34 </select>
38 35
39 <update id="updataIsStorage"> 36 <update id="updataIsStorage">
@@ -9,7 +9,7 @@ import java.util.List; @@ -9,7 +9,7 @@ import java.util.List;
9 9
10 public interface IQuestionEmbeddingService { 10 public interface IQuestionEmbeddingService {
11 Page<QuestionEmbedding> findAll(QuestionEmbedding questionEmbedding, Integer pageNo, Integer pageSize); 11 Page<QuestionEmbedding> findAll(QuestionEmbedding questionEmbedding, Integer pageNo, Integer pageSize);
12 - List<QuestionEmbedding> findQuestion(QuestionEmbedding questionEmbedding); 12 + Integer findQuestionCount(QuestionEmbedding questionEmbedding);
13 QuestionEmbedding findById(String id); 13 QuestionEmbedding findById(String id);
14 int insert(QuestionEmbedding record); 14 int insert(QuestionEmbedding record);
15 int update(QuestionEmbedding record); 15 int update(QuestionEmbedding record);
@@ -70,8 +70,8 @@ public class QuestionEmbeddingServiceImpl implements IQuestionEmbeddingService { @@ -70,8 +70,8 @@ public class QuestionEmbeddingServiceImpl implements IQuestionEmbeddingService {
70 } 70 }
71 71
72 @Override 72 @Override
73 - public List<QuestionEmbedding> findQuestion(QuestionEmbedding questionEmbedding) {  
74 - return questionEmbeddingMapper.findQuestion(questionEmbedding); 73 + public Integer findQuestionCount(QuestionEmbedding questionEmbedding) {
  74 + return questionEmbeddingMapper.findQuestionCount(questionEmbedding);
75 } 75 }
76 76
77 @Override 77 @Override
@@ -52,9 +52,9 @@ spring: @@ -52,9 +52,9 @@ spring:
52 datasource: 52 datasource:
53 master: 53 master:
54 ## !!!!!MYSQL 54 ## !!!!!MYSQL
55 - url: jdbc:mysql://localhost:3306/jeecg-boot-dev?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai 55 + url: jdbc:mysql://localhost:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
56 username: root 56 username: root
57 - password: 123456 57 + password: root
58 driver-class-name: com.mysql.cj.jdbc.Driver 58 driver-class-name: com.mysql.cj.jdbc.Driver
59 redis: 59 redis:
60 database: 0 60 database: 0
@@ -154,7 +154,7 @@ spring: @@ -154,7 +154,7 @@ spring:
154 master: 154 master:
155 url: jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai 155 url: jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
156 username: root 156 username: root
157 - password: 1234 157 + password: root
158 driver-class-name: com.mysql.cj.jdbc.Driver 158 driver-class-name: com.mysql.cj.jdbc.Driver
159 # 多数据源配置 159 # 多数据源配置
160 # pgvector: 160 # pgvector: