suerprisePlus
2024-10-18 1efa47bc58fe0673a231233f644d3a5f8277e42c
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);
    }
}