package com.rf.psychological.scale.dao.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.rf.psychological.base.model.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;
import java.time.LocalDateTime;

/**
 * @author lpf
 * @description: 量表结果计算类注册实体类
 * @date 2022/5/28 16:15
 */
@Entity
@Data
@EqualsAndHashCode(callSuper=true)
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "t_scale_config",indexes = {
        @Index(columnList = "flag")
})
@org.hibernate.annotations.Table(appliesTo = "t_scale_config", comment = "量表注册信息量表")
@DynamicUpdate
public class ScaleConfigEntity extends BaseEntity {

    @Column(name = "flag", columnDefinition = "varchar(50) comment '标识：所属量表'")
    private String flag;

    @Column(name = "type", columnDefinition = "varchar(2) comment '类型：0-量表；1-认知任务'")
    private String type;

    @Column(name = "result_config", columnDefinition = "text comment '量表或认知任务对应的配置java类'")
    private String resultConfig;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(name = "create_time", columnDefinition = "datetime not null  comment '记录创建时间'")
    private LocalDateTime createTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(name = "update_time", columnDefinition = "timestamp default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP comment '记录修改时间'")
    private LocalDateTime updateTime;

}
