springboot怎么把数据传给前端:springboot 如何引入前端 bootstrap?
这种问题网上一搜一大堆,你可以具体找一篇文章试试,遇到问题可以针对相关问题去提问。springboot通过jar包方式引入bootstrap_个人文章 - SegmentFault 思否 这不是查查就
顺晟科技
2022-10-19 12:50:26
157
我正在使用嵌套JSON数组。如下所示,“booking_status”数组中有多个数组,我只想在表中显示当前时间内的数组。
所以,使用filter()方法,我尝试将当前时间与每个数组签入和签出日期/时间进行比较。如果当前时间介于这两个值之间,则只应在表中返回该数组的详细信息,否则返回字符串“nothing”。我写了下面的代码,但它们不返回值。我不确定我做错了什么,请注意我对Java非常陌生,还在从教程中学习。
JSON数组:
[
{
"id": 2,
"item_name": "Rose Red",
"author": "Stephen King",
"booking_status": [
{
"check_in": "2021-09-22T08:27:00+04:00",
"check_out": "2021-09-23T08:27:00+04:00",
"status": "Currently Booked"
},
{
"check_in": "2021-09-25T08:37:00+04:00",
"check_out": "2021-09-26T08:37:00+04:00",
"status": "Currently Free"
},
{
"check_in": "2021-09-27T08:37:00+04:00",
"check_out": "2021-09-28T08:37:00+04:00",
"status": "Currently Free"
},
{
"check_in": "2021-09-22T08:27:00+04:00",
"check_out": "2021-09-23T08:27:00+04:00",
"status": "Currently Booked"
},
{
"check_in": "2021-09-25T08:37:00+04:00",
"check_out": "2021-09-26T08:37:00+04:00",
"status": "Currently Free"
}
]
}
]
脚本:
[
{
"id": 2,
"item_name": "Rose Red",
"author": "Stephen King",
"booking_status": [
{
"check_in": "2021-09-22T08:27:00+04:00",
"check_out": "2021-09-23T08:27:00+04:00",
"status": "Currently Booked"
},
{
"check_in": "2021-09-25T08:37:00+04:00",
"check_out": "2021-09-26T08:37:00+04:00",
"status": "Currently Free"
},
{
"check_in": "2021-09-27T08:37:00+04:00",
"check_out": "2021-09-28T08:37:00+04:00",
"status": "Currently Free"
},
{
"check_in": "2021-09-22T08:27:00+04:00",
"check_out": "2021-09-23T08:27:00+04:00",
"status": "Currently Booked"
},
{
"check_in": "2021-09-25T08:37:00+04:00",
"check_out": "2021-09-26T08:37:00+04:00",
"status": "Currently Free"
}
]
}
]
顺晟科技:
即使您已经筛选出所需的对象并将其存储在其中,但您没有在您的变量中使用该变量,因此您看不到筛选的结果。改用以下方式:
在数组中是string类型,而在filter方法中是将它们与类型进行比较。要解决此问题,请将check_in和check_out转换为that
要有条件地打印所有数据或“无”,还必须通过检查筛选数组的长度来有条件地构建字符串。如果这个数组的长度为零,我们可以说没有数据
05
2022-12
02
2022-12
02
2022-12
29
2022-11
29
2022-11
24
2022-11