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

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

import java.util.List;

/**
 * @author reghao
 * @date 2021-09-10 18:55:38
 */
@Service
public class MenuCrudImpl implements MenuCrud {
    private final MenuRepository menuRepository;

    public MenuCrudImpl(MenuRepository menuRepository) {
        this.menuRepository = menuRepository;
    }

    @Override
    public Menu save(Menu menu) {
        menuRepository.save(menu);
        return menu;
    }

    @Override
    public void saveAll(List<Menu> menus) {
        menuRepository.saveAll(menus);
    }

    @Override
    public void update(Menu menu) {
        menuRepository.save(menu);
    }

    @Override
    public void delete(Menu menu) {
        menuRepository.delete(menu);
    }
}
