package com.nokia.service;

import java.util.List;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nokia.dao.RoleDao;
import com.nokia.pojo.Role;

@Service
public class RoleService extends ServiceImpl<RoleDao, Role> {

    private final RoleDao roleDao;

    public RoleService(RoleDao roleDao) {
        this.roleDao = roleDao;
    }

    public Role getByRoleName(String roleName) {
        Role roleEntity = new Role();
        roleEntity.setRoleName(roleName);
        return getOne(Wrappers.query(roleEntity));
    }

    public List<Role> getRoleNameLike(String roleName) {
        return roleDao.findRoleNameLike(roleName);
    }
}
