package com.sysu.admin.controller.crop;

import com.alibaba.fastjson.annotation.JSONField;
import com.sysu.admin.controller.crop.images.CropImage;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import lombok.experimental.FieldNameConstants;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.locationtech.jts.geom.MultiPolygon;
import org.locationtech.jts.geom.Point;

import javax.persistence.*;
import java.util.Date;

@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@FieldNameConstants(innerTypeName = "FIELDS")
@Table(name = "p_crop")
@Entity
@DynamicInsert
@DynamicUpdate
public class CropPoint {
    /**
     * 主键
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

//    @JSONField(serialize = false)
//    @Column(columnDefinition = "center_point")
//    private Point centerPoint;

    @Column(name = "gridcode")
    private Integer gridcode;
    @Column
    private String name;
    @Column
    private String address;

    @Column
    private String geojson;
    /**
     * 生长期
     */
    @Column
    private Integer growingPeriod;
    /**
     * 领取人
     */
    @Column()
    private Long receiver;
    /**
     * 耕地类型
     */
    @Column
    private Integer cropType;

    /**
     * 状态
     */
    @Column
    private Integer status;


    @Transient
    public static String selectColumns = "id,gridcode,crop_type,st_asgeojson(center_point) as geojson,status,receiver,name,address,growing_period";


}
