前后端date类型参数交互问题

添加如下两个注解即可:

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;  


    /**
     * 上线时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date onlineDate;

请求体范例:

{
    "id": null,
    "fundCode": "888888",
    "fundName": "基金名称",
    "onlineDate": "2020-01-06 10:00:00",
    "offlineDate": "2020-01-18 15:30:00",
    "isEffective": 1,
    "clientIds": [],
    "haveUploaded": true
}

响应体范例:

{
    "code":200,
    "message":"",
    "status":"success",
    "info":{
        "id":88,
        "fundCode":"888888",
        "fundName":"基金名称",
        "onlineDate": "2020-01-06 10:00:00",
        "offlineDate": "2020-01-18 15:30:00",
        "isEffective":1,
        "clientIds":null,
        "haveUploaded":null
    }
}

猜你喜欢

转载自blog.csdn.net/xiangwang2016/article/details/112622001