package cn.lihongjie.coal.notice.entity;

import cn.lihongjie.coal.base.entity.CommonEntity;
import cn.lihongjie.coal.noticeStatus.entity.NoticeStatusEntity;

import jakarta.persistence.*;

import lombok.Data;

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

import java.util.List;

@Data
@Entity
public class NoticeEntity extends CommonEntity {
    @Comment("标题")
    private String title;


    @Comment("内容类型 0 html 1 markdown")
    private String contentType;

    @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 = 'notebook.contentType'\n"
            + "  and i.code = content_type)")
    private String contentTypeName;

    @Comment("内容")
    private String content;


    @Comment("是否全体")
    private Boolean allUser;


    @OneToMany(cascade = CascadeType.REMOVE)
    private List<NoticeStatusEntity> noticeStatus;




}
