
package com.tmerclub.cloud.platform.feign;

import com.tmerclub.cloud.api.platform.feign.SysUserFeignClient;
import com.tmerclub.cloud.api.platform.vo.SysUserVO;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.common.util.BeanUtil;
import com.tmerclub.cloud.platform.service.SysUserService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @author Citrus
 * @date 2021/8/14 16:27
 */
@DubboService
public class SysUserFeignController implements SysUserFeignClient {

    @Autowired
    private SysUserService sysUserService;

    @Override
    public ServerResponseEntity<List<SysUserVO>> getSysUserList(List<Long> userIds) {
        return ServerResponseEntity.success(sysUserService.getUserNameMap(userIds));
    }

    @Override
    public List<SysUserVO> getImSysUserList(List<Long> userIds) {
        return sysUserService.getUserNameMap(userIds);
    }

    @Override
    public ServerResponseEntity<SysUserVO> getSysUserByUserId(Long userId) {
        return ServerResponseEntity.success(sysUserService.getByUserId(userId));
    }

    @Override
    public SysUserVO getSimpleByUserId(Long userId) {
        return BeanUtil.map(sysUserService.getSimpleByUserId(userId), SysUserVO.class);
    }
}
