| package com.xzx.gc.role.service; | 
|   | 
|   | 
| import com.xzx.gc.entity.CoreRole; | 
| import com.xzx.gc.entity.CoreUserRole; | 
| import com.xzx.gc.role.mapper.CoreRoleMapper; | 
| import org.slf4j.Logger; | 
| import org.slf4j.LoggerFactory; | 
| import org.springframework.beans.factory.annotation.Autowired; | 
| import org.springframework.stereotype.Service; | 
| import org.springframework.transaction.annotation.Transactional; | 
|   | 
| import java.util.List; | 
|   | 
| /** | 
|  * 描述: 字典 service,包含常规字典和级联字典的操作。 | 
|  * @author : xiandafu | 
|  */ | 
| @Service | 
| @Transactional | 
| public class CoreRoleService{ | 
|   | 
|     @Autowired | 
|     private CoreRoleMapper roleMapper; | 
|   | 
|     public List<CoreRole> getAllRoles(String type){ | 
|         CoreRole template = new CoreRole(); | 
|         template.setType(type); | 
|         return roleMapper.select(template); | 
|     } | 
|   | 
|     public CoreUserRole getRoleByUserId(Long userId, Long orgId){ | 
|         return roleMapper.getRoleByUserId(userId,orgId); | 
|     } | 
|   | 
|     public CoreRole findById(Long id){ | 
|         return roleMapper.selectByPrimaryKey(id); | 
|     } | 
|   | 
|   | 
|      | 
|      | 
|    | 
| } |