package com.tuoheng.service.impl;

import com.tuoheng.mapper.ClientMapper;
import com.tuoheng.model.dto.ClientRoleInfoDto;
import com.tuoheng.model.param.ClientRoleDto;
import com.tuoheng.model.param.GetClientTenantRoleDto;
import com.tuoheng.service.ClientSevice;
import com.tuoheng.until.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;

/**
 * @author chenjiandong
 * @description: TODO
 * @date 2022/10/8 11:35
 */
@Service
public class ClientServiceImpl implements ClientSevice {

    @Autowired
    private ClientMapper clientMapper;

    @Override
    @Transactional(readOnly = true)
    public JsonResult getAllClient(){
        return JsonResult.success(clientMapper.getAllClient());
    }

    @Override
    @Transactional(readOnly = true)
    public JsonResult getClientTenantRole(GetClientTenantRoleDto getClientTenantRoleDto){
        List<ClientRoleInfoDto> clientRoleInfoDtos = new ArrayList<>();
        ClientRoleInfoDto clientRoleInfoDto = new ClientRoleInfoDto()
                .setRoleId(1).setRoleName("租户管理员角色");
        clientRoleInfoDtos.add(clientRoleInfoDto);
        //todo:根据不同的 client 调用不同系统的接口，获取租户所对应的角色
        return JsonResult.success(clientRoleInfoDtos);
    }


}
