package com.muyu.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.muyu.common.core.web.domain.BaseEntity;
import com.muyu.domain.req.MiddleReq;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

/**
 * 围栏组与电子围栏关联表
 */
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@TableName(value = "middle", autoResultMap = true)
public class Middle extends BaseEntity {

    /**
     * 主键
     */
    @TableId(value = "middle_id", type = IdType.AUTO)
    @Schema(type = "Long",description = "主键")
    private Long middleId;

    /**
     * 电子围栏主键id
     */
    @Schema(type = "Long",description = "电子围栏主键id")
    private Long fenceId;

    /**
     * 围栏主键id
     */
    @Schema(type = "Long",description = "围栏主键id")
    private Long fenceGroupId;


    //添加
    public static Middle build(MiddleReq req) {
        return Middle.builder()
                .fenceGroupId(req.getFenceGroupId())
                .fenceId(req.getFenceId())
                .build();
    }

    /**
     * 描述
     */
    @Schema(type = "String",description = "描述")
    private String description;

    /**
     * 围栏名称
     */
    @Schema(type = "String",description = "围栏名称")
    private String fenceName;

    /**
     * 经纬度
     */
    @Schema(type = "String",description = "经纬度")
    private String coordinates;

}
