package com.fjhx.scheduling.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.utils.WrapperUtil;
import com.fjhx.entity.scheduling.StockSchedulingTest;
import com.fjhx.params.stock.StockSchedulingTestVo;
import com.fjhx.scheduling.mapper.StockSchedulingTestMapper;
import com.fjhx.scheduling.service.StockSchedulingTestService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * <p>
 * 仓库 服务实现类
 * </p>
 *
 * @author ${author}
 * @since 2022-08-12
 */
@Service
public class StockSchedulingTestServiceImpl extends ServiceImpl<StockSchedulingTestMapper, StockSchedulingTest> implements StockSchedulingTestService {

    @Override
    public Page<StockSchedulingTest> getPage(Map<String, String> condition) {

        QueryWrapper<StockSchedulingTest> wrapper = Wrappers.query();

        WrapperUtil.init(condition, wrapper)
                .createTimeDesc();

        Page<StockSchedulingTest> page = page(condition, wrapper);
        return page;
    }

    @Override
    public void add(StockSchedulingTestVo stockSchedulingTestVo) {
        save(stockSchedulingTestVo);
    }

    @Override
    public void edit(StockSchedulingTestVo stockSchedulingTestVo) {
        updateById(stockSchedulingTestVo);
    }

    @Override
    public void delete(StockSchedulingTestVo stockSchedulingTestVo) {
        removeById(stockSchedulingTestVo.getId());
    }

}
