springboot入参直接转换时间格式

##JDK8新增了Localdate和Localdatetime,对时间操作更加方便,springboot入参可直接将string转为时间格式,如下

1554709730751

1
2
3
4
5
6
7
8
9
10
11
12
@RequestMapping("/view/list")
@ApiOperation("获取用户信息列表")
public R list(Integer id,
String account,
String nickname,
@RequestParam(value = "startTime",required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime startTime,
@RequestParam(value = "endTime",required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate endTime,
Integer pageNum,
Integer pageSize){
List<UserInfo> list = userInfoService.getList();
return R.ok().put("list",list);
}
0%