package com.bonus.canteen.core.supply.purchase.api;

import cn.hutool.core.util.ObjectUtil;
import com.bonus.canteen.core.supply.purchase.domain.vo.DrpSupplierVO;
import com.bonus.canteen.core.supply.purchase.mapper.DrpPurchaseSupplierMapper;
import com.bonus.common.security.utils.SecurityUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;

@Service
public class DrpAuthorityPurchaseApi {
   public static final String DRP_DEVICE_NOT_BIND_AREA = "drp.device-not-bind-area";
   @Lazy
   private DrpPurchaseSupplierMapper drpPurchaseSupplierMapper;


   public Long listSupplierAuthority() {
      Long userId = SecurityUtils.getUserId();
      DrpSupplierVO drpSupplierVO = this.drpPurchaseSupplierMapper.listSupplierByUserId(userId);
      return ObjectUtil.isEmpty(drpSupplierVO) ? -1L : drpSupplierVO.getSupplierId();
   }
}
