package com.fjhx.stock.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.stock.StockTag;
import com.fjhx.params.stock.StockTagVo;
import com.fjhx.stock.mapper.StockTagMapper;
import com.fjhx.stock.service.StockTagService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * <p>
 * 物料库存明细 服务实现类
 * </p>
 *
 * @author ${author}
 * @since 2022-11-14
 */
@Service
public class StockTagServiceImpl extends ServiceImpl<StockTagMapper, StockTag> implements StockTagService {

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

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

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

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

    @Override
    public void add(StockTagVo stockTagVo) {
        save(stockTagVo);
    }

    @Override
    public void edit(StockTagVo stockTagVo) {
        updateById(stockTagVo);
    }

    @Override
    public void delete(StockTagVo stockTagVo) {
        removeById(stockTagVo.getId());
    }

}
