package com.repair.model.pojo;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * <p>
 *
 * </p>
 *
 * @author ceshi
 * @since 2023-07-05
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="RepairAdmin对象", description="")
public class RepairAdmin implements Serializable {

    private static final long serialVersionUID = 1L;

    @ExcelProperty("数据ID")
    @ColumnWidth(25)
    @ApiModelProperty(value = "主键")
    @TableId(value = "id", type = IdType.UUID)
    private String id;

    @ExcelProperty("账号")
    @ColumnWidth(25)
    @ApiModelProperty(value = "账号")
    @NotBlank(message = "账号不能为空")
    private String account;

    @ApiModelProperty(value = "密码")
    @NotBlank(message = "密码不能为空")
    private String password;

    @ExcelProperty("昵称")
    @ColumnWidth(25)
    @ApiModelProperty(value = "昵称")
    @NotBlank(message = "昵称不能为空")
    private String username;

    @ExcelProperty("手机号")
    @ColumnWidth(25)
    @ApiModelProperty(value = "手机号")
    @NotBlank(message = "手机号不能为空")
    private String phone;

    @ApiModelProperty(value = "微校卡号")
    @NotBlank(message = "微校卡号不能为空")
    private String cardNumber;

    @ApiModelProperty(value = "校区ID 黄家湖：1；墨轩湖：2")
    @NotNull(message = "校区不能为空")
    private Integer schoolId;

    @ApiModelProperty(value = "是否是超级管理员 正常：0；超级管理员：1")
    private Integer isSuper;

    @ApiModelProperty(value = "状态 正常：0；冻结：1")
    private Integer statu;

    @ApiModelProperty(value = "是否是移动端创建 不是：0；是：1")
    @JsonIgnore
    private Integer isMobile;

    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    //这个注解不设置的话从数据库取出来会少8小时！！！！
    //@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @JsonIgnore
    private Date createTime;

    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date updateTime;

    @ExcelProperty("创建时间")
    @ColumnWidth(25)
    @TableField(exist = false)
    //@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @JsonIgnore
    private String updateTimeStr;

    public String getUpdateTimeStr() {
            return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(updateTime);
    }

    public void setUpdateTimeStr(String updateTimeStr) {
        this.updateTimeStr = updateTimeStr;
    }

    @ApiModelProperty(value = "创建人员")
    @TableField(fill = FieldFill.INSERT)
    @JsonIgnore
    private String createUser;

    @ApiModelProperty(value = "更新人员")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonIgnore
    private String updateUser;

    @ApiModelProperty(value = "逻辑删除 未删除：0；删除：1")
    @TableLogic
    @TableField(fill = FieldFill.INSERT)
    @JsonIgnore
    private Integer deleted;

}
