package me.zhengjie.modules.dm.printingCount.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import me.zhengjie.base.BaseEntity;
import me.zhengjie.modules.dm.device.domain.DmDevice;
import me.zhengjie.modules.dm.device.service.dto.DmDeviceDto;
import me.zhengjie.modules.dm.floor.domain.DmFloor;
import me.zhengjie.modules.dm.printingApproval.domain.DmPrintingApproval;
import me.zhengjie.modules.dm.user.domain.DmUser;
import me.zhengjie.modules.dm.user.service.dto.DmUserDto;
import me.zhengjie.modules.system.domain.Dept;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;

@Entity
@Data
@Table(name="dm_printing_request")
@NoArgsConstructor
@AllArgsConstructor
public class DmPrintingCount implements Serializable {
    @Id
    @Column(name = "id")
    @ApiModelProperty(value = "主键")
    private Long id;

//    @Column(name = "create_time",nullable = false)
//    @NotBlank
//    @ApiModelProperty(value = "统计时段")
//    private String createTime;

    @OneToOne
    @JoinColumn(name = "request_user")//找不到
    @ApiModelProperty(value = "姓名")
    private DmUser countUser;

    @Column(name = "task_name",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "打印文档名称")
    private String taskName;

    @Column(name = "file_repeat_num",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "份数")
    private String fileRepeatNum;

    @Column(name = "file_page_num",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "页数")
    private String filePageNum;

    @OneToOne
//    @JoinColumn(name = "printer_code",referencedColumnName="code")
    @JoinColumn(name = "printer_code",referencedColumnName="id")
    @ApiModelProperty(value = "打印机code")
    private DmDevice countDevice;


    public void copy(DmPrintingCount source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
