package com.yunyan.web;

import com.yunyan.common.core.domain.entity.SysDept;
import com.yunyan.common.utils.StringUtils;
import com.yunyan.system.service.ISysDeptService;
import com.yunyan.system.service.ISysUserService;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit.jupiter.SpringExtension;

@Slf4j
@ExtendWith(SpringExtension.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
class SysUserTests {

    @Autowired
    private ISysUserService sysUserService;



    @Test
    void importData() {
        setBobaiUser();
    }

    /**
     * 生成 田东的用户
     */
    private void setTiandongUser() {
        String result = sysUserService.importUserByDept(false, "admin", "田东", "TD", "田东");
        Assertions.assertTrue(StringUtils.isNoneBlank(result));
    }

    /**
     * 生成 平果的用户
     */
    private void setPingguoUser() {
        String result = sysUserService.importUserByDept(false, "admin", "平果", "PG", "平果");
        Assertions.assertTrue(StringUtils.isNoneBlank(result));
    }

    /**
     * 生成 百色市的用户
     */
    private void setBaiseshiUser() {
        String result = sysUserService.importUserByDept(false, "admin", "百色市", "BS", "百色市");
        Assertions.assertTrue(StringUtils.isNoneBlank(result));
    }

    /**
     * 生成 百色市的主管用户
     */
    private void setBaiseshiUserManage() {
        String result = sysUserService.importUserByDeptBy3Code(false, "admin", "百色市", "BS", "百色市");
        Assertions.assertTrue(StringUtils.isNoneBlank(result));
    }

    /**
     * 生成 博白的用户
     */
    private void setBobaiUser() {
        String result = sysUserService.importUserByDept(false, "admin", "博白", "BB", "博白");
        Assertions.assertTrue(StringUtils.isNoneBlank(result));
    }

    /**
     * 生成 凭祥的主管用户
     */
    private void setPingxiangUser() {
        String result = sysUserService.importUserByDept(false, "admin", "凭祥", "PS", "凭祥");
        Assertions.assertTrue(StringUtils.isNoneBlank(result));
    }

}
