package com.persagy.adm.server.algorithm.service.impl;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.persagy.adm.server.algorithm.entity.AdmProjectUser;
import com.persagy.adm.server.algorithm.service.AdmProjectUserService;
import com.persagy.adm.server.algorithm.dao.AdmProjectUserMapper;
import com.persagy.dmp.auth.domain.Project;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * ADM项目用户关系逻辑处理接口
 * @author : lijie
 * Update By 2022/1/11 20:05
 */
@Service
@RequiredArgsConstructor
public class AdmProjectUserServiceImpl extends ServiceImpl<AdmProjectUserMapper, AdmProjectUser>
implements AdmProjectUserService{

    private final AdmProjectUserMapper admProjectUserMapper;

    /**
     * 根据用户id获取其项目权限
     * @param userId : 用户id
     * @return : java.util.List<com.persagy.dmp.auth.domain.Project>
     * @author : lijie
     * Update By 2022/1/11 20:08
     */
    @Override
    public List<Project> getProjectsByUserId(String userId) {
        if (StrUtil.isBlank(userId)){
            return CollUtil.newArrayList();
        }
        return admProjectUserMapper.getProjectsByUserId(userId);
    }
}




