package com.fjhx.stock.service.impl;

import cn.hutool.core.date.DateUtil;
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.stock.StockBackCorrect;
import com.fjhx.params.stock.StockBackCorrectVo;
import com.fjhx.stock.mapper.StockBackCorrectMapper;
import com.fjhx.stock.service.StockBackCorrectService;
import com.fjhx.utils.Assert;
import com.fjhx.utils.WrapperUtil;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author ${author}
 * @since 2022-09-01
 */
@Service
public class StockBackCorrectServiceImpl extends ServiceImpl<StockBackCorrectMapper, StockBackCorrect> implements StockBackCorrectService {

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

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

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

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

    @Override
    public void add(StockBackCorrectVo stockBackCorrectVo) {
        save(stockBackCorrectVo);
    }

    @Override
    public void edit(StockBackCorrectVo stockBackCorrectVo) {
        updateById(stockBackCorrectVo);
    }

    @Override
    public void delete(StockBackCorrectVo stockBackCorrectVo) {
        removeById(stockBackCorrectVo.getId());
    }


}
