package com.zhiqiyun.open.core.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zhiqiyun.open.core.models.user.AuthorityInfo;
import com.zhiqiyun.open.core.mapper.AuthorityInfoMapper;
import com.zhiqiyun.open.core.service.AuthorityInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author jtoms
 */
@Service
public class OauthAuthorityInfoServiceImpl implements AuthorityInfoService {

    @Autowired
    private AuthorityInfoMapper authorityInfoMapper;

    @Override
    public List<AuthorityInfo> findChildren(Long parentId) {
        if (parentId == null) {
            parentId = 0L;
        }
        QueryWrapper<AuthorityInfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("parent_id", parentId);
        return authorityInfoMapper.selectList(queryWrapper);
    }
}
