/*
 * Author: wangjian
 * 生成entity
 */
package com.tofly.base.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.tofly.common.core.constant.ToflySqlCondition;
import com.tofly.common.entity.CommonCode;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.List;
import java.util.stream.Collectors;


/**
 * 车辆管理测试
 *
 * @author wangjian
 * @date Mon Jul 06 00:00:00 CST 2020
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value="TF_TEST_CAR",resultMap = "carMap")
@KeySequence("TF_TEST_CAR")
@ApiModel
public class Car extends Model<Car> {
    private static final long serialVersionUID = 1L;

        /**
     * 车辆型号
     */
            @ApiModelProperty(value = "车辆型号")
                private String carModel;
                /**
     * 车牌号
     */
            @ApiModelProperty(value = "车牌号")
                private String carNumber;
                /**
     * 车辆类型
     */
            @ApiModelProperty(value = "车辆类型")
                private String carType;
        @ApiModelProperty(hidden = true)
    private String carTypeName;

    public void setCarTypeName(List<CommonCode> datas) {
            this.carTypeName =datas.stream().filter(k->k.getKey().equals("cartype")).map(CommonCode::getNotes).collect(Collectors.toList()).get(0);
    }
                /**
     * 创建时间
     */
            @ApiModelProperty(value = "创建时间")
        @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
            @TableField(value = "CREATE_TIME",fill = FieldFill.INSERT)
            private Date createTime;
                /**
     * 创建人
     */
            @ApiModelProperty(value = "创建人")
            @TableField(value = "CREATE_USER",fill = FieldFill.INSERT)
            private Long createUser;
            @ApiModelProperty(hidden = true)
    private String createUserName;
            /**
     * 保管人
     */
            @ApiModelProperty(value = "保管人")
                private String custodian;
                /**
     * 主键ID
     */
        @TableId(value = "ID",type= IdType.INPUT)
            @ApiModelProperty(value = "主键ID")
                private Long id;
                /**
     * 购买日期
     */
            @ApiModelProperty(value = "购买日期")
        @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
                private Date purchaseDate;
            
}
