package com.chinaweal.aiccs.aiccs.market.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.vividsolutions.jts.geom.Polygon;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 片区围点表
 * </p>
 *
 * @author <a href="https://blog.lroyia.top">lroyia</a>
 * @since 2021-11-27
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("area_slice_polygon")
public class AreaSlicePolygon extends Model<AreaSlicePolygon> {

    private static final long serialVersionUID=1L;

    /**
     * id
     */
    @TableId(value = "g_id", type = IdType.ASSIGN_UUID)
    private String gId;

    /**
     * 片区id
     */
    @TableField("slice_id")
    private String sliceId;

    /**
     * 多边形数据
     * 转成Wkb读取
     */
    @TableField("dmgeo.ST_AsBinary(polygon_data)")
    private byte[] polygonData;

    /**
     * 创建时间
     */
    @TableField("create_time")
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @TableField("update_time")
    private LocalDateTime updateTime;

    /**
     * 转换后的多边形对象
     */
    @TableField(exist = false)
    private Polygon polygon;


    @Override
    protected Serializable pkVal() {
        return this.gId;
    }

}
