package com.wsk.travelf.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wsk.travelf.mapper.PermissionMapper;
import com.wsk.travelf.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> findPage(int page,int size) {
        return permissionMapper.selectPage(new Page<>(page, size), null);
    }

    //权限新增
    public void add(Permission permission) {
        permissionMapper.insert(permission);
    }

    //根据权限ID查询权限
    public Permission findById(Integer pid) {
        return permissionMapper.selectById(pid);
    }

    //根据权限ID修改权限
    public void updateById(Permission permission) {
        permissionMapper.updateById(permission);
    }

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

}
