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.Inventory;
import com.foreverwin.mesnac.meapi.mapper.InventoryMapper;
import com.foreverwin.mesnac.meapi.service.InventoryService;
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 Philip
 * @since 2021-07-09
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory> implements InventoryService {


    @Autowired
    private InventoryMapper inventoryMapper;

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

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


}