package com.ruoyi.common.exception;

/**
 * 部门访问拒绝异常类
 * 
 * 当用户尝试访问不属于其部门的数据时抛出此异常
 * 
 * @author ruoyi
 */
public class DepartmentAccessDeniedException extends RuntimeException
{
    private static final long serialVersionUID = 1L;

    /**
     * 错误码
     */
    private Integer code;

    /**
     * 错误提示
     */
    private String message;

    /**
     * 错误明细，内部调试错误
     */
    private String detailMessage;

    /**
     * 空构造方法，避免反序列化问题
     */
    public DepartmentAccessDeniedException()
    {
    }

    public DepartmentAccessDeniedException(String message)
    {
        this.message = message;
    }

    public DepartmentAccessDeniedException(String message, Integer code)
    {
        this.message = message;
        this.code = code;
    }

    public DepartmentAccessDeniedException(String message, Throwable e)
    {
        super(message, e);
        this.message = message;
    }

    public String getDetailMessage()
    {
        return detailMessage;
    }

    public DepartmentAccessDeniedException setDetailMessage(String detailMessage)
    {
        this.detailMessage = detailMessage;
        return this;
    }

    @Override
    public String getMessage()
    {
        return message;
    }

    public DepartmentAccessDeniedException setMessage(String message)
    {
        this.message = message;
        return this;
    }

    public Integer getCode()
    {
        return code;
    }
}