package com.xy.dto.SysWorkUser;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.xy.utils.PageBean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.time.LocalDate;
import java.time.LocalDateTime;

@Data
@ApiModel("业务用户分页请求")
@Accessors(chain = true)
public class PageDto {

    @ApiModelProperty("分页对象")
    private PageBean page;

    @ApiModelProperty(value = "用户ID")
    private Long id;

    @ApiModelProperty(value = "系统ID")
    private Long sysId;

    @ApiModelProperty(value = "账号")
    private String account;

    @ApiModelProperty(value = "邮箱")
    private String email;

    @ApiModelProperty(value = "手机")
    private String phone;

    @ApiModelProperty(value = "状态")
    private Boolean status;

    @ApiModelProperty(value = "角色ID")
    private Long roleId;

    @ApiModelProperty(value = "部门ID")
    private Long deptId;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "创建时间-起")
    private LocalDate beginCreateTime;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "创建时间-始")
    private LocalDate endCreateTime;

    public LocalDateTime getBeginCreateTime() {
        return beginCreateTime == null ? null : beginCreateTime.atTime(0, 0, 0);
    }

    public LocalDateTime getEndCreateTime() {
        return endCreateTime == null ? null : endCreateTime.atTime(23, 59, 59);
    }

}
