compuser.java

来自「hibernate应用测试,初学hibernate 的会员可以看看.」· Java 代码 · 共 95 行

JAVA
95
字号
package com.bean;

import org.apache.struts.action.ActionForm;

public class CompUser extends ActionForm {
    private int compUserId;
    private String realName;
    private String department;
    private String position;
    private String sex;
    private int delFlag;
    private int isUsed;

    public CompUser() {};

    public void setCompUserId(int compUserId) {
        this.compUserId = compUserId;
    }

    public int getCompUserId() {
        return this.compUserId;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public String getRealName() {
//        if(this.realName==null) this.realName="";
        return this.realName;
    }

    public void setDepartment(String department) {
        this.department = department;
//         System.out.println("in compUser department!!!");
    }

    public String getDepartment() {
        if (this.department == null)this.department = "";
        return this.department;
    }

    public void setPosition(String position) {
        this.position = position;
    }

    public String getPosition() {
        if (this.position == null)this.position = "";
        return this.position;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getSex() {
        if (this.sex == null)this.sex = "";
        return this.sex;
    }

    public void setDelFlag(int delFlag) {
        this.delFlag = delFlag;
    }

    public int getDelFlag() {
        return this.delFlag;
    }

    public void setIsUsed(int isUsed) {
        this.isUsed = isUsed;
    }

    public int getIsUsed() {
        return this.isUsed;
    }

    /**
     * 判断是否同一个用户
     * @param obj Object  要比较的用户
     * @return boolean  false 表示不同的用户;true表示同一个用户
     */
    public boolean equals(Object obj) {
        boolean flag = false;
        if (!(obj instanceof CompUser))return false;
        CompUser tmpUser = (CompUser) obj;
        if (this.compUserId == tmpUser.getCompUserId() && this.compUserId > 0)return true;
        if (this.department.equals(tmpUser.getDepartment()) &&
            this.realName.equals(tmpUser.getRealName()) &&
            this.sex.equals(tmpUser.getSex()))
            return true;
        return flag;
    }

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?