package cn.lihongjie.coal.warehouseReceiptReason.dto;

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

import io.hypersistence.utils.hibernate.type.array.ListArrayType;

import jakarta.persistence.Column;

import lombok.Data;

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

import java.util.List;

@Data
public class UpdateWarehouseReceiptReasonDto extends OrgCommonDto {

    @Comment("单据类型")
    private String receiptType;

    @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 = 'warehouse.receiptType'\n"
            + "  and i.code = receipt_type)")
    private String receiptTypeName;



    @Comment("事由")
    private String reason;



    @Comment("用于存储多个事由说明, 用于下拉框展示和快速填写")
    @Column(columnDefinition = "text[]")
    @Type(ListArrayType.class)
    private List<String> reasonDesc;

}
