package com.nokia.dao;

import com.nokia.pojo.Role;
import com.nokia.pojo.User;
import com.nokia.vo.flow.FlowRoleVo;
import com.nokia.vo.flow.FlowUserVo;

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

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
public class UserDaoTest {

    @Autowired
    UserDao userDao;

    @Test
    void testFindRoleList() {
        List<FlowRoleVo> flowRoleVos = userDao.findRoleList("测试用户_全省");
        System.out.println(flowRoleVos);
    }

    @Test
    void testFindRoleList2() {
        List<FlowRoleVo> flowRoleVos = userDao.findRoleList2();
        System.out.println(flowRoleVos);
    }

    @Test
    void testFindToPage() {
        List<FlowUserVo> flowRoleVos = userDao.findToPage();
        System.out.println(flowRoleVos);
    }

    @Test
    void testGetFlowUserVoByLoginId() {
        FlowUserVo flowUserVo = userDao.getFlowUserVoByLoginId("test_hengshui");
        System.out.println(flowUserVo);
    }

    @Test
    void testGetFlowUserVoByUserId() {
        FlowUserVo flowUserVo = userDao.getFlowUserVoByUserId(3);
        System.out.println(flowUserVo);
    }

    @Test
    void testFindRoleIdByUserId() {
        List<Integer> roleIds = userDao.findRoleIdByUserId(4);
        System.out.println(roleIds);
    }

    @Test
    void testFindUserIdByRoleId() {
        List<Integer> userIds = userDao.findUserIdByRoleId(6);
        System.out.println(userIds);
    }

    @Test
    void testFindAuthorizedUser() {
        List<FlowUserVo> flowUserVos = userDao.findAuthorizedUser(null, null, null);
        System.out.println(flowUserVos);
    }

    @Test
    void testGetRoleCityByUserId() {
        List<Role> roles = userDao.getRoleCityByUserId(4);
        System.out.println(roles);
    }

    @Test
    void testGetByLoginName() {
        User user = userDao.getByLoginName("test_hengshui");
        System.out.println(user);
    }

    @Test
    void testGetByRoleIds() {
        List<Integer> roleIds = new ArrayList<>();
        roleIds.add(4);
        // roleIds.add(3);

        List<Integer> cityIds = new ArrayList<>();
        cityIds.add(-1);
        cityIds.add(130100);

        List<User> users = userDao.getByRoleIds(roleIds, cityIds);
        System.out.println(users);
    }
}