package cn.lihongjie.coal.deviceWorkOrderDetail.entity;

import cn.lihongjie.coal.base.entity.OrgCommonEntity;
import cn.lihongjie.coal.deviceWorkOrder.entity.DeviceWorkOrderEntity;

import jakarta.persistence.Entity;
import jakarta.persistence.ManyToOne;

import lombok.Data;

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

import java.time.LocalDateTime;

@Data
@Entity
public class DeviceWorkOrderDetailEntity extends OrgCommonEntity {

    @ManyToOne
    private DeviceWorkOrderEntity workOrder;

    private LocalDateTime startTime;
    
    private LocalDateTime endTime;


    private String content;

    
    

    

    @Comment("归档状态")
    @ColumnDefault("'0'")
    private String archiveStatus = "0";

    @Formula(
            "(select i.name\n"
                    + "from t_dictionary d,\n"
                    + "     t_dictionary_item i\n"
                    + "where d.id = i.dictionary_id\n"
                    + "  and d.code = 'archiveStatus'\n"
                    + "  and i.code = archive_status)")
    private String archiveStatusName;
}
