package cn.reghao.autodop.dmaster.rbac.db.crud;

import cn.reghao.autodop.dmaster.rbac.db.repository.RoleRepository;
import cn.reghao.autodop.dmaster.rbac.model.po.Role;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author reghao
 * @date 2021-05-11 18:26:15
 */
@Service
public class RoleCrudImpl implements RoleCrud {
    private final RoleRepository roleRepository;

    public RoleCrudImpl(RoleRepository roleRepository) {
        this.roleRepository = roleRepository;
    }

    @Override
    public Role save(Role role) {
        roleRepository.save(role);
        return role;
    }

    @Override
    public void saveAll(List<Role> roles) {
        roleRepository.saveAll(roles);
    }

    @Override
    public void update(Role role) {
        roleRepository.save(role);
    }

    @Override
    public void delete(Role role) {
        roleRepository.delete(role);
    }
}
