package com.fjhx.service.check.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fjhx.entity.check.CheckDetails;
import com.fjhx.mapper.check.CheckDetailsMapper;
import com.fjhx.params.check.CheckDetailsVo;
import com.fjhx.service.check.CheckDetailsService;
import com.fjhx.utils.Assert;
import com.fjhx.utils.wrapperUtil.IWrapper;
import org.springframework.stereotype.Service;

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

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author ${author}
 * @since 2022-12-23
 */
@Service
public class CheckDetailsServiceImpl extends ServiceImpl<CheckDetailsMapper, CheckDetails> implements CheckDetailsService {

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

        IWrapper<CheckDetails> wrapper = IWrapper.getWrapper(condition);

        return page(condition, wrapper);
    }

    @Override
    public void add(CheckDetailsVo checkDetailsVo) {
        save(checkDetailsVo);
    }

    @Override
    public void edit(CheckDetailsVo checkDetailsVo) {
        updateById(checkDetailsVo);
    }

    @Override
    public void delete(CheckDetailsVo checkDetailsVo) {
        removeById(checkDetailsVo.getId());
    }

    @Override
    public List<Map<String, Object>> getList(Long checkInfoId) {
        Assert.notEmpty(checkInfoId, "盘点id不能为空");
        return baseMapper.getList(checkInfoId);
    }

}
