package com.rf.psychological.dao.model;

import com.rf.psychological.base.model.BaseEntity;
import com.rf.psychological.security.EncryptDecodeConverter;
import lombok.*;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * @author zzf
 * @description:量表维度实体类
 * @date 2021/5/13 11:02
 */
@Entity
@Data
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "t_dimension_info")
@org.hibernate.annotations.Table(appliesTo = "t_dimension_info", comment = "量表维度表")
@DynamicUpdate
public class DimensionEntity extends BaseEntity {

    @Convert(converter = EncryptDecodeConverter.class)
    @Column(name = "name", columnDefinition = "varchar(400) comment '维度名称'")
    private String name;

    @Convert(converter = EncryptDecodeConverter.class)
    @Column(name = "question_no", columnDefinition = "varchar(600) comment '所含题号'")
    private String questionNo;

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

    @Column(name = "is_icon_flag", columnDefinition = "varchar(2) default '0' comment '表示当前字段是否需要在图表展示：0---否，1---是'")
    private String isIconFlag;

    ///**
    // * 加密
    // */
    //public void encrypt() {
    //    this.questionNo = DESede.encryptString(this.questionNo);
    //    this.name = DESede.encryptString(this.name);
    //}
    //
    ///**
    // * 进行解密
    // */
    //public void decrypt() {
    //    this.questionNo = DESede.decryptString(this.questionNo);
    //    this.name = DESede.decryptString(this.name);
    //}

}
