From 1efa47bc58fe0673a231233f644d3a5f8277e42c Mon Sep 17 00:00:00 2001
From: suerprisePlus <15810472099@163.com>
Date: 星期五, 18 十月 2024 14:46:22 +0800
Subject: [PATCH] 接口优化修改

---
 src/main/java/com/yb/controller/THistoryController.java |   30 ++++++++++++++++++++++++++----
 1 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/yb/controller/THistoryController.java b/src/main/java/com/yb/controller/THistoryController.java
index 6606470..e97440b 100644
--- a/src/main/java/com/yb/controller/THistoryController.java
+++ b/src/main/java/com/yb/controller/THistoryController.java
@@ -4,10 +4,11 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
-import com.alibaba.fastjson.JSON;
 import com.yb.dao.THistoryDao;
+import com.yb.service.ThistoriesServices;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -31,6 +32,8 @@
     private THistoryService tHistoryService;
     @Autowired
     private THistoryDao tHistoryDao;
+    @Autowired
+    private ThistoriesServices thistoriesServices;
 
     /**
      * 鍒楄〃
@@ -83,10 +86,10 @@
     @PostMapping("/save")
     @ApiOperation(value = "save", notes = "")
     public R save(@RequestBody THistoryEntity tHistory) {
-        int id =  tHistoryDao.insert(tHistory);
+        int id = tHistoryDao.insert(tHistory);
 //        tHistory.getId().toString()
-        HashMap<String,Object> hashMap= new HashMap<>();
-        hashMap.put("id",tHistory.getId().toString());
+        HashMap<String, Object> hashMap = new HashMap<>();
+        hashMap.put("id", tHistory.getId().toString());
         return R.ok(hashMap);
     }
 
@@ -130,4 +133,23 @@
         }
         return R.ok(list);
     }
+
+    @GetMapping("/getSessionById")
+    @ApiOperation(value = "getSessionById", notes = "")
+    public R getSessionById(@RequestParam(name = "sessionid", defaultValue = " ") String sessionid) {
+        List<THistoryEntity> list = thistoriesServices.getSessionId(sessionid);
+        List<HashMap<Object, Object>> sList = new ArrayList<>();
+        for (int i = 0; i < list.size(); i++) {
+            THistoryEntity th = list.get(i);
+            HashMap<Object, Object> hashMap = new HashMap<>();
+            hashMap.put("id", th.getId());
+            hashMap.put("human", th.getHuman());
+            hashMap.put("ai", th.getAi());
+            sList.add(hashMap);
+        }
+        PageUtils page = new PageUtils(sList,0,0,0);
+        return R.ok() .put("page", page);
+    }
+
+
 }

--
Gitblit v1.9.3