Commit fe28535e authored by 李超鹏's avatar 李超鹏

历史记录接口

parent 0f1badb5
Pipeline #7457 canceled with stages
...@@ -94,9 +94,15 @@ public class KnowledgeService { ...@@ -94,9 +94,15 @@ public class KnowledgeService {
return entity.getId(); return entity.getId();
} }
public List<Question> history(Long pageNum, Long pageSize) { public Page<Question> history(Long pageNum, Long pageSize) {
return questionMapper.selectList(new Page<>(pageNum, pageSize), new LambdaQueryWrapper<Question>().eq(Question::getUserId, QuestionerHolder.getId())
.orderByDesc(Question::getCreateTime)); return questionMapper.selectPage(new Page<>(pageNum, pageSize), new LambdaQueryWrapper<Question>().eq(Question::getUserId, QuestionerHolder.getId())
.orderByDesc(Question::getCreateTime).eq(Question::getDeleteFlag, 0));
}
public Boolean deleteHistory(Long questionId) {
questionMapper.update(new Question().setDeleteFlag(1), new LambdaQueryWrapper<Question>().eq(Question::getId, questionId).eq(Question::getUserId, QuestionerHolder.getId()));
return Boolean.TRUE;
} }
......
...@@ -22,7 +22,10 @@ public class Question { ...@@ -22,7 +22,10 @@ public class Question {
@TableField("answers") @TableField("answers")
private String answers; private String answers;
@TableField("correct") @TableField("correct")
private int correct; private Integer correct;
@TableField("create_time") @TableField("create_time")
private LocalDateTime createTime; private LocalDateTime createTime;
@TableField("delete_flag")
private Integer deleteFlag;
} }
...@@ -5,6 +5,8 @@ import cc.shenjiying.ai.dto.ChatAIResponse; ...@@ -5,6 +5,8 @@ import cc.shenjiying.ai.dto.ChatAIResponse;
import cc.shenjiying.ai.dto.FeedbackSaveDTO; import cc.shenjiying.ai.dto.FeedbackSaveDTO;
import cc.shenjiying.ai.manager.KnowledgeService; import cc.shenjiying.ai.manager.KnowledgeService;
import cc.shenjiying.ai.repository.entity.Question; import cc.shenjiying.ai.repository.entity.Question;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.oracle.svm.core.annotate.Delete;
import io.quarkiverse.bucket4j.runtime.RateLimited; import io.quarkiverse.bucket4j.runtime.RateLimited;
import io.smallrye.mutiny.Multi; import io.smallrye.mutiny.Multi;
import io.smallrye.mutiny.Uni; import io.smallrye.mutiny.Uni;
...@@ -70,10 +72,19 @@ public class KnowLedgeResource { ...@@ -70,10 +72,19 @@ public class KnowLedgeResource {
@Path("/history") @Path("/history")
@Operation(summary = "历史记录") @Operation(summary = "历史记录")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public List<Question> history(@RestQuery("pageNum") Long pageNum, @RestQuery("pageSize") Long pageSize) { public Page<Question> history(@RestQuery("pageNum") Long pageNum, @RestQuery("pageSize") Long pageSize) {
return knowledgeService.history(pageNum, pageSize); return knowledgeService.history(pageNum, pageSize);
} }
@DELETE
@Path("/history/{id}")
@Operation(summary = "历史记录删除")
@Produces(MediaType.APPLICATION_JSON)
public Boolean history(@PathParam("id") Long id) {
return knowledgeService.deleteHistory(id);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment