package com.ruoyi.bst.locationLog.service.impl;

import java.util.HashSet;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.bst.locationLog.domain.LocationLogQuery;
import com.ruoyi.bst.locationLog.mapper.LocationLogMapper;
import com.ruoyi.bst.locationLog.service.LocationLogValidator;
import com.ruoyi.common.utils.collection.CollectionUtils;

@Service
public class LocationLogValidatorImpl implements LocationLogValidator {

    @Autowired
    private LocationLogMapper locationLogMapper;

    @Override
    public boolean canDeleteAll(List<Long> ids) {
        return canView(ids);
    }

    private boolean canView(List<Long> ids) {
        if (CollectionUtils.isEmptyElement(ids)) {
            return true;
        }
        LocationLogQuery query = new LocationLogQuery();
        query.setIds(ids);
        List<Long> idList = locationLogMapper.selectIdList(query);
        return new HashSet<>(idList).containsAll(ids);
    }
    
}
