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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fjhx.entity.scheduling.SchedulingActual;
import com.fjhx.params.stock.SchedulingActualVo;
import com.fjhx.scheduling.mapper.SchedulingActualMapper;
import com.fjhx.scheduling.service.SchedulingActualService;
import com.fjhx.utils.WrapperUtil;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * <p>
 * 推荐领料 实际领料结果 服务实现类
 * </p>
 *
 * @author ${author}
 * @since 2022-08-09
 */
@Service
public class SchedulingActualServiceImpl extends ServiceImpl<SchedulingActualMapper, SchedulingActual> implements SchedulingActualService {

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

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

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

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

    @Override
    public void add(SchedulingActualVo stockSchedulingActualVo) {
        save(stockSchedulingActualVo);
    }

    @Override
    public void edit(SchedulingActualVo stockSchedulingActualVo) {
        updateById(stockSchedulingActualVo);
    }

    @Override
    public void delete(SchedulingActualVo stockSchedulingActualVo) {
        removeById(stockSchedulingActualVo.getId());
    }

}
