package com.zsc.bill.service;

import com.zsc.bill.modules.system.entity.Authority;
import com.zsc.bill.modules.system.entity.RoleAuthority;
import com.zsc.bill.modules.system.entity.User;
import com.zsc.bill.modules.system.repo.AuthorityRepository;
import com.zsc.bill.modules.system.repo.RoleAuthoritiesRepository;
import com.zsc.bill.modules.system.repo.UserRepository;
import jakarta.annotation.Resource;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * @author ftz
 * 创建时间:29/12/2023 上午11:21
 * 描述: TODO
 */
@SpringBootTest
public class UserServiceTest {
    @Resource
    private RoleAuthoritiesRepository roleAuthoritiesRepository;
    @Resource
    private  UserRepository userRepository;
    @Resource
    private AuthorityRepository authorityRepository;
    @Test
    void test() {
        User user=userRepository.selectByUsername("admin");
        Set<Authority> authorities= authorityRepository.selectAuthoritiesByRoleId(user.getRoleId());
        user.role.authorities=authorities;
        System.out.println(user);

    }
    @Test
    void test1() {
        User user=userRepository.selectByUsername("admin");
        System.out.println(user);

    }
}
