package com.muyu.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 车辆电子组中间表
 * @Author：yang
 * @Package：com.muyu.domain
 * @Project：cloud-electronic
 * @name：carMiddle
 * @Date：2024/9/20 16:30
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Tag(name = "车辆电子组中间表")
@TableName(value = "car_middle",autoResultMap = true)
public class CarMiddle {

    /**
     * 中间表ID
     */
    @TableId(value = "id",type = IdType.AUTO)
    private Integer id;
    /**
     * 电子围栏ID
     */
    private Integer fenceGroupId;
    /**
     * 车辆ID
     */
    private Long carInformationId;

    public CarMiddle(Integer fenceGroupId, Long carInformationId) {
        this.fenceGroupId = fenceGroupId;
        this.carInformationId = carInformationId;
    }

    public static CarMiddle carMiddleBuilder(CarMiddle carMiddle) {
        return CarMiddle.builder()
                .id(carMiddle.getId())
                .fenceGroupId(carMiddle.getFenceGroupId())
                .carInformationId(carMiddle.getCarInformationId())
                .build();
    }
}
