com.chantsoft.app.tc.org.beans Package;
Import com.chantsoft.core.base.AbstractBean;
public class OrgRelationBean the extends the AbstractBean {
/ ** Source Type: personnel resource type * /
Private Integer sourceCategory;
/ ** Source ID : * staff ID /
Private Long sourceId;
/ ** target type: departments, groups, and other resource type * /
Private Integer targetCategory;
/ ** target ID: department, ID group * /
Private Long targetId;
/ ** relationship type: * see OrgRelationCategoryEnum /
Private Integer relationCategory;
/ ** relationship type description: * / is not enabled
Private Long relationValue1;
/ ** relationship type description: not enabled * /
relationValue2 Private String;
/ ** units * /
Private Long orgCorporationId;
Private Integer state;
@Override
// equals的重写
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof OrgRelationBean) {
if (((OrgRelationBean) obj).sourceCategory.equals(this.sourceCategory)
&& ((OrgRelationBean) obj).sourceId.equals(this.sourceId)
&& ((OrgRelationBean) obj).targetCategory.equals(this.targetCategory)
&& ((OrgRelationBean) obj).targetId.equals(this.targetId)
&& ((OrgRelationBean) obj).relationCategory.equals(this.relationCategory)
&& ((OrgRelationBean) obj).relationValue1.equals(this.relationValue1)
&& ((OrgRelationBean) obj).relationValue2.equals(this.relationValue2)
&& ((OrgRelationBean) obj).orgCorporationId.equals(this.orgCorporationId)
&& ((OrgRelationBean) obj).state.equals(this.state)) {
return true;
}
}
return false;
}
@Override
//hasCode的重写
public int hashCode() {
StringBuilder sb = new StringBuilder();
sb.append(sourceCategory);
sb.append(sourceId);
sb.append(targetCategory);
sb.append(targetId);
sb.append(relationCategory);
sb.append(relationValue1);
sb.append(relationValue2);
sb.append(orgCorporationId);
sb.append(state);
char[] charArr = sb.toString().toCharArray();
int hash = 0;
for(char c : charArr) {
hash = hash * 131 + c;
}
return hash;
}
public OrgRelationBean() {
}
public OrgRelationBean(Integer sourceCategory,Long sourceId,Integer targetCategory,
Long targetId,Integer relationCategory,Long orgCorporationId) {
setNewId();
this.sourceCategory = sourceCategory;
this.sourceId = sourceId;
this.targetCategory = targetCategory;
this.targetId = targetId;
this.relationCategory = relationCategory;
this.orgCorporationId = orgCorporationId;
this.state = 0;
}
public Integer getSourceCategory() {
return this.sourceCategory;
}
public void setSourceCategory(Integer v) {
this.sourceCategory = v;
}
public Long getSourceId() {
return this.sourceId;
}
public void setSourceId(Long v) {
this.sourceId = v;
}
public Integer getTargetCategory() {
return this.targetCategory;
}
public void setTargetCategory(Integer v) {
this.targetCategory = v;
}
public Long getTargetId() {
return this.targetId;
}
public void setTargetId(Long v) {
this.targetId = v;
}
public Integer getRelationCategory() {
return this.relationCategory;
}
public void setRelationCategory(Integer v) {
this.relationCategory = v;
}
public Long getRelationValue1() {
return this.relationValue1;
}
public void setRelationValue1(Long v) {
this.relationValue1 = v;
}
public String getRelationValue2() {
return this.relationValue2;
}
public void setRelationValue2(String v) {
this.relationValue2 = v;
}
public Long getOrgCorporationId() {
return this.orgCorporationId;
}
public void setOrgCorporationId(Long v) {
this.orgCorporationId = v;
}
public Integer getState() {
return state;
}
public void setState(Integer state) {
this.state = state;
}
}
Java-- override hashCode () and euqals () method
Guess you like
Origin www.cnblogs.com/czq520/p/11647694.html
Ranking