package com.bcxin.risk.compose.dto.data;

import lombok.Data;

import java.util.Map;

/**
 * @param
 * @return
 * @auther Administrator
 * @date 2017/07/27 0027
 * @注意事项 </b>
 */
@Data
public class VwComposeDataDto {

    /**
      * 主键
	 */
    private String oid;

    /**
     *  所属对象ID
     */
    private String sourceId;

    /**
     * 类型
     */
    private String type;

    /**
     * 段落模板名称
     */
    private String name;

    /**
     * 内容
     */
    private String content;

    /**
     * 时间
     */
    private String time;


    /**
     * 图片地址
     */
    private String imgAddress;

    /**
     * 所属风评机构Id
     */
    private String orgId;

    /**
     * 数据来源表
     */
    private String dataSourceTable;

    public VwComposeDataDto(Map<String,Object> map){
        this.oid = safeTransfor(map.get("oid"));
        this.sourceId = safeTransfor(map.get("sourceId"));
        this.type = safeTransfor(map.get("type"));
        this.name = safeTransfor(map.get("name"));
        this.content = safeTransfor(map.get("content"));
        this.time = safeTransfor(map.get("time"));
        this.imgAddress = safeTransfor(map.get("imgAddress"));
        this.orgId = safeTransfor(map.get("orgId"));
        this.dataSourceTable = safeTransfor(map.get("dataSourceTable"));
    }

    private String safeTransfor(Object obj){
        if ( obj == null ) {
            return "";
        }
        return obj.toString();
    }

}
