gpt4 book ai didi

java - 如果我更改搜索条件,会停止网络服务吗?

转载 作者:行者123 更新时间:2023-12-02 09:52:02 24 4
gpt4 key购买 nike

我有一个从 Angular 前端启动的 Web 服务。我有 date: from 和 date:to 搜索条件。

这是我的服务 Angular :

downloadEmailAttachmentsByNumber(from: any, to: any) {
return
this.httpClient.get('/shared/Modal/getAttachmentsByNumber?
from=' + from + '&to=' + to);
}

我的 spring 网络服务:

@RequestMapping(value = "/getAttachmentsByNumber", method = RequestMethod.GET)
public ResponseEntity<List<Integer>> getAttachmentsByNumber(
@RequestParam(value = "from", required = false) Long from,
@RequestParam(value = "to", required = false) Long to) {
Timestamp fromDate = null;
Timestamp toDate = null;
if (from != null) {
fromDate = new Timestamp(from);
toDate = new Timestamp(to);
}
List<Integer> attachmentsList= this.downloadAttachmentService.getAttachmentsByNumber(fromDate,
toDate);
return new ResponseEntity<>(attachmentsList, HttpStatus.OK);

}

当我将搜索条件更改为 和 时,我的问题是,网络服务仍处于使用旧搜索条件和新搜索条件的执行模式:这是图像显示:enter image description here

如何解决?感谢您的提前。

最佳答案

创建单独的服务来调用您的API,在搜索和onChange事件上订阅它只需在生命周期 Hook 中调用unsubscribe()方法,它将停止您的服务从API获取数据

关于java - 如果我更改搜索条件,会停止网络服务吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56256969/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com