package com.ssm.manage.entity;

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

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

    /**
     * 权限编码
     */
    @Id
    @Column(name = "power_id")
    private Integer powerId;

    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 power_id - 权限编码
     */
    public Integer getPowerId() {
        return powerId;
    }

    /**
     * 设置权限编码
     *
     * @param powerId 权限编码
     */
    public void setPowerId(Integer powerId) {
        this.powerId = powerId;
    }

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

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getRoleId() == null) ? 0 : getRoleId().hashCode());
        result = prime * result + ((getPowerId() == null) ? 0 : getPowerId().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(", powerId=").append(powerId);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}