package com.schisandra.auth.infra.basic.service.impl;

import com.schisandra.auth.infra.basic.dao.SchisandraAuthPermissionDao;
import com.schisandra.auth.infra.basic.entity.SchisandraAuthPermission;
import com.schisandra.auth.infra.basic.service.SchisandraAuthPermissionService;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (SchisandraAuthPermission)表服务实现类
 *
 * @author makejava
 * @since 2024-04-11 13:00:10
 */
@Service("schisandraAuthPermissionService")
public class SchisandraAuthPermissionServiceImpl implements SchisandraAuthPermissionService {
    @Resource
    private SchisandraAuthPermissionDao schisandraAuthPermissionDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public SchisandraAuthPermission queryById(Long id) {
        return this.schisandraAuthPermissionDao.selectOneById(id);
    }


    /**
     * 新增数据
     *
     * @param schisandraAuthPermission 实例对象
     * @return 实例对象
     */
    @Override
    public SchisandraAuthPermission insert(SchisandraAuthPermission schisandraAuthPermission) {
        this.schisandraAuthPermissionDao.insert(schisandraAuthPermission);
        return schisandraAuthPermission;
    }

    /**
     * 修改数据
     *
     * @param schisandraAuthPermission 实例对象
     * @return 实例对象
     */
    @Override
    public int update(SchisandraAuthPermission schisandraAuthPermission) {
        return this.schisandraAuthPermissionDao.update(schisandraAuthPermission);
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long id) {
        return this.schisandraAuthPermissionDao.deleteById(id) > 0;
    }

    @Override
    public List<SchisandraAuthPermission> queryListByIds(List<Long> permissionIdList) {
        return schisandraAuthPermissionDao.selectListByIds(permissionIdList);
    }
}
