package com.zhiqiyun.open.core.models.bz;

import com.baomidou.mybatisplus.annotation.*;
import com.zhiqiyun.open.core.enmus.BzDataType;
import com.zhiqiyun.open.core.typeHandler.FastjsonTypeHandler;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.springframework.scheduling.annotation.Scheduled;

import java.util.Date;
import java.util.List;

@Data
@TableName(value = "passenger_equipment", autoResultMap = true)
public class PassengerEquipment {
    @TableId(type = IdType.INPUT)
    private Long id;
    private BzDataType dataType;
    private Long bzId;
    private String brief;
    @TableField(typeHandler = FastjsonTypeHandler.class)
    private List<String> litpics;

    @TableField(updateStrategy = FieldStrategy.NEVER)
    private Date createdTime;
    @TableField(updateStrategy = FieldStrategy.NEVER)
    private Long createdBy;

    private Date updatedTime;
    private Long updatedBy;

    @TableField(exist = false)
    private String litpic;
    @TableField(exist = false)
    private Long inPeopleCount;
    @TableField(exist = false)
    private Long outPeopleCount;

    public String getLitpic() {
        if (StringUtils.isBlank(this.litpic) && this.litpics != null && this.litpics.size() > 0) {
            this.litpic = this.litpics.get(0);
        }
        return this.litpic;
    }
}
