package cn.com.qmth.examcloud.core.questions.dao.entity;

import java.util.List;

import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.mapping.DBRef;

import cn.com.qmth.examcloud.core.questions.dao.entity.base.MongoBaseEntity;

public class PaperDetail extends MongoBaseEntity implements Comparable<PaperDetail> {
    /**
	 * 
	 */
	private static final long serialVersionUID = -8021835042074266092L;

	@DBRef(lazy = false)
    private Paper paper;// 关联的试卷

    private Integer number;// 大题序号

    private String name;// 大题名称

    private String title;// 大题描述

    private Double score;// 大题分数

    private Integer unitCount;// 大题下的小题数量

    private String creator;// 创建人id

    private String createTime;// 创建时间
    
    //复制数据用
    private Long orgId;
    
    /**
     * 大题排序
     */
    @Transient
    private Long sortNumber;
    
    /**
     * 大题二级排序
     */
    @Transient
    private Integer sortNumberSub;
    
    
    /**
     * 小题集合，判断大题排序用
     */
    @Transient
    private List<PaperDetailUnit> paperDetailUnits;

    public Paper getPaper() {
        return paper;
    }

    public void setPaper(Paper paper) {
        this.paper = paper;
    }

    public Integer getNumber() {
        return number;
    }

    public void setNumber(Integer number) {
        this.number = number;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Double getScore() {
        return score;
    }

    public void setScore(Double score) {
        this.score = score;
    }

    public Integer getUnitCount() {
        return unitCount;
    }

    public void setUnitCount(Integer unitCount) {
        this.unitCount = unitCount;
    }

    public String getCreator() {
        return creator;
    }

    public void setCreator(String creator) {
        this.creator = creator;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public PaperDetail() {

    }

    @Override
    public int compareTo(PaperDetail paperDetail) {
        if (paperDetail != null) {
            if (this.getNumber() == null) return -1;
            if (paperDetail.getNumber() == null) return 1;
            if (this.getNumber() > paperDetail.getNumber()) {
                return 1;
            } else if (this.getNumber() < paperDetail.getNumber()) {
                return -1;
            } else {
                return 0;
            }
        }
        return -1;
    }

	public Long getSortNumber() {
		return sortNumber;
	}

	public void setSortNumber(Long sortNumber) {
		this.sortNumber = sortNumber;
	}

	public List<PaperDetailUnit> getPaperDetailUnits() {
		return paperDetailUnits;
	}

	public void setPaperDetailUnits(List<PaperDetailUnit> paperDetailUnits) {
		this.paperDetailUnits = paperDetailUnits;
	}

	public Integer getSortNumberSub() {
		return sortNumberSub;
	}

	public void setSortNumberSub(Integer sortNumberSub) {
		this.sortNumberSub = sortNumberSub;
	}

	public Long getOrgId() {
		return orgId;
	}

	public void setOrgId(Long orgId) {
		this.orgId = orgId;
	}

	
    
}
