package cn.com.qmth.stmms.biz.exam.model;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import java.io.Serializable;

@Embeddable
public class SubjectiveScorePK implements Serializable {

    private static final long serialVersionUID = 7186961625210327765L;

    @Column(name = "student_id", nullable = false)
    private Integer studentId;

    @Column(name = "main_number", nullable = false)
    private Integer mainNumber;

    @Column(name = "sub_number", nullable = false)
    private String subNumber;

    public Integer getStudentId() {
        return studentId;
    }

    public void setStudentId(Integer studentId) {
        this.studentId = studentId;
    }

    public Integer getMainNumber() {
        return mainNumber;
    }

    public void setMainNumber(Integer mainNumber) {
        this.mainNumber = mainNumber;
    }

    public String getSubNumber() {
        return subNumber;
    }

    public void setSubNumber(String subNumber) {
        this.subNumber = subNumber;
    }

    @Override
    public int hashCode() {
        final int PRIME = 31;
        int result = 1;
        result = PRIME * result + ((studentId == null) ? 0 : studentId.hashCode());
        result = PRIME * result + ((mainNumber == null) ? 0 : mainNumber.hashCode());
        result = PRIME * result + ((subNumber == null) ? 0 : subNumber.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        final SubjectiveScorePK other = (SubjectiveScorePK) obj;
        if (studentId == null) {
            if (other.studentId != null)
                return false;
        } else if (!studentId.equals(other.studentId))
            return false;
        if (mainNumber == null) {
            if (other.mainNumber != null)
                return false;
        } else if (!mainNumber.equals(other.mainNumber))
            return false;
        if (subNumber == null) {
            if (other.subNumber != null)
                return false;
        } else if (!subNumber.equals(other.subNumber))
            return false;
        return true;
    }

}
