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

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.zhiqiyun.open.core.models.place.PlaceCategory;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Data
@TableName(value = "equipment_passenger", autoResultMap = true)
public class EquipmentPassenger {
	@TableId(type = IdType.INPUT)
	private Long id;
	private Long placeBaseInfoId;
	private String brief;
	@TableField(typeHandler = FastjsonTypeHandler.class)
	private List<String> litpics;
	private BigDecimal lng;
	private BigDecimal lat;

	@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;
	@TableField(exist = false)
	private PlaceCategory dataType;

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