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

import com.ruoyi.bst.userApp.domain.UserAppQuery;
import com.ruoyi.bst.userApp.mapper.UserAppMapper;
import com.ruoyi.bst.userApp.service.UserAppValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserAppValidatorImpl implements UserAppValidator {

    @Autowired
    private UserAppMapper userAppMapper;

    @Override
    public boolean isBind(Long userId, Long appId) {
        if (userId == null || appId == null) {
            return false;
        }
        UserAppQuery query = new UserAppQuery();
        query.setUserId(userId);
        query.setAppId(appId);
        return userAppMapper.selectCount(query) > 0;
    }
}
