/*
 * Copyright (c) 2023 codvision.com All Rights Reserved.
 */

package com.codvision.auth.core;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.codvision.auth.entity.dto.SysUserQueryDTO;
import com.codvision.auth.entity.vo.SysUserVO;
import com.codvision.auth.mapper.SysUserMapper;
import com.codvision.auth.service.ISysUserService;
import com.codvision.webapi.api.SysUserApi;
import com.codvision.webapi.bean.RemoteOrg;
import com.codvision.webapi.bean.RemoteSysUser;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 系统用户扩展
 * <p>
 * 通过策略模式切换单体程序和微服务的用户接口
 *
 * @author lingee
 * @date 2023/12/1
 */
@Service
public class SysUserExtension implements SysUserApi {

    @Resource
    private ISysUserService sysUserService;

    @Resource
    private SysUserMapper sysUserMapper;

    @Override
    public IPage<RemoteSysUser> pageUserList(String keyword, Integer oid, Integer roleId, List<Integer> uidList, int pageNum, int pageSize) {
        return null;
    }

    @Override
    public List<RemoteSysUser> getAllUserList(String keyword, Integer oid, Integer roleId) {
        SysUserQueryDTO queryDTO = new SysUserQueryDTO(keyword, oid, roleId, null, null, null);
        List<SysUserVO> sysUserList = sysUserMapper.findAll(null, queryDTO);
        return BeanUtil.copyToList(sysUserList, RemoteSysUser.class);
    }

    @Override
    public IPage<RemoteOrg> pageOrgList(String keyword, Boolean isAll, int pageNum, int pageSize) {
        return null;
    }

    @Override
    public Integer addUser(RemoteSysUser sysUser) {
        return null;
    }

    @Override
    public RemoteSysUser getUserDetail(Integer uid) {
        return null;
    }

    @Override
    public RemoteSysUser getUserDetail(String loginName) {
        return null;
    }

    @Override
    public void updateUserOrgRole(Integer uid, Integer oid, String roleCode) {

    }
}
