package com.ruoyi.demo.entity.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.ruoyi.demo.entity.DlUser;
import lombok.Data;

import java.time.LocalDateTime;

@Data
public class DlUserListVo {
    private String userId;
    private String userName;
    private String userTelephone;
    private String startEquipmentId;
    private String startEquipmentName;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime startTime;
    private String endEquipmentId;
    private String endEquipmentName;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime endTime;
    private Float totalPrice;

    public DlUserListVo(){}
    public DlUserListVo(DlUser user){
        this.userId = user.getUserId();
        this.userName = user.getUserName();
        this.userTelephone = user.getUserTelephone();
        this.startEquipmentId = user.getStartEquipmentId();
        this.startEquipmentName = user.getStartEquipmentName();
        this.startTime = user.getStartTime();
        this.endEquipmentId = user.getEndEquipmentId();
        this.endEquipmentName = user.getEndEquipmentName();
        this.endTime = user.getEndTime();
        this.totalPrice = user.getTotalPrice();
    }
}
