package com.ssm.manage.entity;

import java.io.Serializable;
import javax.persistence.*;

@Table(name = "sys_role_user")
public class SysRoleUser implements Serializable {
    /**
     * 角色编码
     */
    @Id
    @Column(name = "role_id")
    private Long roleId;

    /**
     * 用户编码
     */
    @Id
    @Column(name = "user_id")
    private Long userId;

    /**
     * 角色名称
     */
    @Column(name = "role_name")
    private String roleName;

    /**
     * 用户名称
     */
    @Column(name = "user_name")
    private String userName;

    private static final long serialVersionUID = 1L;

    /**
     * 获取角色编码
     *
     * @return role_id - 角色编码
     */
    public Long getRoleId() {
        return roleId;
    }

    /**
     * 设置角色编码
     *
     * @param roleId 角色编码
     */
    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    /**
     * 获取用户编码
     *
     * @return user_id - 用户编码
     */
    public Long getUserId() {
        return userId;
    }

    /**
     * 设置用户编码
     *
     * @param userId 用户编码
     */
    public void setUserId(Long userId) {
        this.userId = userId;
    }

    /**
     * 获取角色名称
     *
     * @return role_name - 角色名称
     */
    public String getRoleName() {
        return roleName;
    }

    /**
     * 设置角色名称
     *
     * @param roleName 角色名称
     */
    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }

    /**
     * 获取用户名称
     *
     * @return user_name - 用户名称
     */
    public String getUserName() {
        return userName;
    }

    /**
     * 设置用户名称
     *
     * @param userName 用户名称
     */
    public void setUserName(String userName) {
        this.userName = userName;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        SysRoleUser other = (SysRoleUser) that;
        return (this.getRoleId() == null ? other.getRoleId() == null : this.getRoleId().equals(other.getRoleId()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getRoleName() == null ? other.getRoleName() == null : this.getRoleName().equals(other.getRoleName()))
            && (this.getUserName() == null ? other.getUserName() == null : this.getUserName().equals(other.getUserName()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getRoleId() == null) ? 0 : getRoleId().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getRoleName() == null) ? 0 : getRoleName().hashCode());
        result = prime * result + ((getUserName() == null) ? 0 : getUserName().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", roleId=").append(roleId);
        sb.append(", userId=").append(userId);
        sb.append(", roleName=").append(roleName);
        sb.append(", userName=").append(userName);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}