package cn.lihongjie.coal.employeeRecord.entity;

import cn.lihongjie.coal.base.entity.OrgCommonEntity;
import cn.lihongjie.coal.employee.entity.EmployeeEntity;

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;

@Data
@Entity
public class EmployeeRecordEntity extends OrgCommonEntity {
    
    
    @ManyToOne
    private EmployeeEntity employee;


    @Comment("记录时间")
    private java.time.LocalDateTime recordTime;

    @Comment("记录类型")
    private String recordType;

    @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 = 'emp.record.type'\n"
                    + "  and i.code = record_type)")
    private String recordTypeName;



    @Comment("记录内容")
    private String recordContent;


    @Comment("奖惩分数")
    private Double score;


    @Comment("奖惩金额")
    private Double money;


    @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;







}
