Home > Back-end >  In Java Web layer by id and query data problem in the past a period of time?
In Java Web layer by id and query data problem in the past a period of time?

Time:09-30



When my GetMapping configured to @ GetMapping ("/baseline/{id} "), the browser enter localhost/SSM/baseline/32 returns the id=32 data is normal,


But I want to query data over a long period under the id=32 GetMapping how configuration, such as query id=32 2020-04-01 00:00:00 to 2020-04-01 surf data GetMapping
how to configure!

//browser input query historical data
@ GetMapping ("/baseline/{id}/{startDateTime} {endDateTime} ")
@ ResponseBody
Public List FindHistoryData (@ PathVariable (" id "), an Integer id,
@ PathVariable (" startDateTime ") Date startDateTime,
@ PathVariable (" endDateTime ") Date endDateTime
)
{
System. The out. Println (" site id: "+ id);
List Data=https://bbs.csdn.net/topics/service.findByStation1 (id, startDateTime, endDateTime);
The Collections. Reverse (data);
return data;
}

I not such a configuration,, every brother please give advice or comments??

CodePudding user response:

https://www.liangzl.com/get-article-detail-128536.html
Try this one

CodePudding user response:

reference response: 1/f friendship dream

https://www.liangzl.com/get-article-detail-128536.htmlTry this
00

CodePudding user response:

Posts don't heavy, who can help me with it again

CodePudding user response:

You must use the @ PathVariable? Even if you use the @ RequestBody, @ RequestParam are better than the right...

A novice, don't know what do you think? Novice in principle is not contact me first say that two kinds of parameter passing way yao...

CodePudding user response:

Done well, thank you for your reply, all into RequestParam with respect to ok

CodePudding user response:

@ GetMapping ("/baseline/{id}/{startDateTime}/{endDateTime} ")
StartDateTime and endDateTime parameters to use/division
As the upstairs said, more @ RequestBody @ RequestParam parameters is recommended to be used

CodePudding user response:

refer to 6th floor annhey response:
@ GetMapping ("/baseline/{id}/{startDateTime}/{endDateTime} ")
StartDateTime and endDateTime parameters to use/division
As the upstairs said, many parameters suggest using the @ RequestBody @ RequestParam
thank you, have already done
  • Related