package cn.lihongjie.coal.purchaseOrder.dto;

import cn.lihongjie.coal.base.dto.OrgCommonDto;

import jakarta.persistence.ManyToOne;

import lombok.Data;

import org.hibernate.annotations.Comment;
import org.hibernate.annotations.Formula;

import java.time.LocalDate;

@Data
public class CreatePurchaseOrderDto extends OrgCommonDto {

    @ManyToOne
    @Comment("煤炭信息")
    private String coalInfo;


    @Comment("采购数量")
    private Double amount;



    @Comment("采购单价")
    private Double price;


    @Comment("采购日期")
    private LocalDate purchaseDate;

    @Comment("预计到货日期")
    private LocalDate estimateDeliveryDate;


    @Formula("(select min(d.delivery_date) from t_delivery_information d where d.purchase_order_id = id)")
    private LocalDate firstDeliveryDate;

    @Formula("(select max(d.delivery_date) from t_delivery_information d where d.purchase_order_id = id)")
    private LocalDate lastDeliveryDate;



    
}
