AdminScopeGuard.java 518 Bytes
package com.diligrp.rider.common.auth;

import com.diligrp.rider.common.exception.BizException;
import org.springframework.stereotype.Component;

@Component
public class AdminScopeGuard {

    public void assertCityAccessible(Long currentCityId, Long targetCityId) {
        if (currentCityId == null || currentCityId < 1) {
            return;
        }
        if (targetCityId == null || !currentCityId.equals(targetCityId)) {
            throw new BizException("只能操作当前城市数据");
        }
    }
}