<repo_name>chensiyou123/security<file_sep>/README.md
# security
权限认证学习
<file_sep>/spring-security-oauth2/spring-security-oauth2-server/src/main/java/com/csy/oauth2/service/TbUserService.java
package com.csy.oauth2.service;

import com.csy.oauth2.domain.TbUser;

public interface TbUserService {
    default TbUser getByUsername(String username) {
        return null;
    }
}
<file_sep>/spring-security-oauth2/spring-security-oauth2-server/src/main/java/com/csy/oauth2/mapper/TbPermissionMapper.java
package com.csy.oauth2.mapper;

import com.csy.oauth2.domain.TbPermission;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface TbPermissionMapper {
    List<TbPermission> query(Map map);
}
<file_sep>/spring-security-oauth2/spring-security-oauth2-server/src/main/java/com/csy/oauth2/service/impl/TbPermissionServiceImpl.java
package com.csy.oauth2.service.impl;

import com.csy.oauth2.domain.TbPermission;
import com.csy.oauth2.mapper.TbPermissionMapper;
import com.csy.oauth2.service.TbPermissionService;
import org.springframework.stereotype.Service;

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

@Service
public class TbPermissionServiceImpl implements TbPermissionService {
    @Resource
    private TbPermissionMapper tbPermissionMapper;
    @Override
    public List<TbPermission> selectByUserId(Long userId) {
        Map map = new HashMap();
        map.put(userId,userId);
        return tbPermissionMapper.query(map);
    }
}
