package com.czg.account.entity;

import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.Table;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serial;
import java.io.Serializable;
import java.util.Objects;

/**
 * 角色菜单关联 实体类。
 *
 * @author Administrator
 * @since 2025-02-10
 */
@Data

@NoArgsConstructor
@AllArgsConstructor
@Table("sys_roles_menus")
public class SysRolesMenus implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 菜单ID
     */
    @Id
    private Long menuId;

    /**
     * 角色ID
     */
    @Id
    private Long roleId;

    /**
     * 0 管理端及小程序 1收银机
     */
    private Integer type;
    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof SysRolesMenus that)) {
            return false;
        }
        return Objects.equals(menuId, that.menuId) &&
                Objects.equals(roleId, that.roleId) &&
                Objects.equals(type, that.type);
    }

    @Override
    public int hashCode() {
        return Objects.hash(menuId, roleId, type);
    }
}
