package com.foreverwin.mesnac.meapi.service.impl;

import com.foreverwin.modular.core.util.FrontPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.meapi.model.ResourceType;
import com.foreverwin.mesnac.meapi.mapper.ResourceTypeMapper;
import com.foreverwin.mesnac.meapi.service.ResourceTypeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Leon.L
 * @since 2021-05-26
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class ResourceTypeServiceImpl extends ServiceImpl<ResourceTypeMapper, ResourceType> implements ResourceTypeService {


    @Autowired
    private ResourceTypeMapper resourceTypeMapper;

    @Override
    public IPage<ResourceType> selectPage(FrontPage<ResourceType> frontPage, ResourceType resourceType) {
        QueryWrapper<ResourceType> queryWrapper = new QueryWrapper<>();
        queryWrapper.setEntity(resourceType);
        return super.page(frontPage.getPagePlus(), queryWrapper);
    }

    @Override
    public List<ResourceType> selectList(ResourceType resourceType) {
        QueryWrapper<ResourceType> queryWrapper = new QueryWrapper<>();
        queryWrapper.setEntity(resourceType);
        return super.list(queryWrapper);
    }


}