package com.ruoyi.system.service.dingding.impl;

import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.service.dingding.DingAuthService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>DingAuthServiceImpl 此类用于：</p>
 * <p>@author：hujm</p>
 * <p>@date：2021年05月20日 15:56</p>
 * <p>@remark：</p>
 */
@Slf4j
@Service
public class DingAuthServiceImpl implements DingAuthService {

    @Resource
    private SysUserMapper sysUserMapper;

    @Override
    public SysUser getUserByUserId(String userId) {

        if (userId == null) {
            log.error("根据用户手机号查询UIOT用户时，当前钉钉用户id为空！");
            return new SysUser();
        }

        SysUser sysUser = sysUserMapper.selectUserByUserName(userId);

        return sysUser;
    }

    @Override
    public SysUser getUserByUsername(String mobile) {

        if (mobile == null) {
            log.error("根据用户手机号查询UIOT用户时，当前钉钉用户id为空！");
            return new SysUser();
        }

        SysUser sysUser = sysUserMapper.selectUserByUserName(mobile);

        return sysUser;
    }
}