提问人:Shilpa 提问时间:11/15/2023 更新时间:11/15/2023 访问量:31
如何在 Angular 中传递数据库查询 获取 API URL
How to pass database query in Angular Get API URL
问:
我在从组件执行的服务文件中有以下函数,我想从下面的函数中准备一个获取 URL。
getStartEndTime(body) {
const query = `select min(shiftstart) starttimeofmonth,max(shiftend) endtimeofmonth from ShiftCalendarDeDup where lineid=${body.lineId} and factoryid=${body.factoryId} and businessdate between ${body.firstDay} and ${body.lastDay}`;
return this.http.get(`${environment.apiDFOS3BaseUrl}/dfosbroker/generic/query/${query}`);
}
但上面的代码在“网络”选项卡中生成以下 URL
网址 :
https://dfos-qa.unilever.com/dfosbroker/generic/query/select%20min(shiftstart)%20starttimeofmonth,max(shiftend)%20endtimeofmonth%20from%20ShiftCalendarDeDup%20where%20lineid=E_A571_A%20and%20factoryid=E_A571%20and%20businessdate%20between%202023-10-01%20and%202023-10-31
我的预期输出
https://dfos.unilever.com/dfosbroker/generic/query/select min(shiftstart) starttimeofmonth,max(shiftend) endtimeofmonth from ShiftCalendarDeDup where lineid='R_A002_MAFLRIA1' and factoryid='R_A002' and businessdate between '2023-10-01' and '2023-10-31'
谁能帮我获得预期的输出。
答: 暂无答案
评论