package com.itbaizhan.trave.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itbaizhan.trave.mapper.PermissionMapper;
import com.itbaizhan.trave.pojo.Permission;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class PermissionService {
    @Autowired
    private PermissionMapper permissionMapper;

    //查询所有权限
    public Page<Permission> findPages(Integer pages,Integer size){
        Page page = permissionMapper.selectPage(new Page(pages, size), null);
        return page;
    }
    //新增权限
    public void add(Permission permission){
        permissionMapper.insert(permission);
    }

    public Permission findById(Integer pid){
        Permission permission = permissionMapper.selectById(pid);
        return permission;
    }

    public void update(Permission permission){
        permissionMapper.updateById(permission);
    }

    //删除权限
    public void delete(Integer pid){
        permissionMapper.deleteById(pid);
    }

}
