package com.prolog.eis.service.out.impl;

import com.prolog.eis.dao.out.BizOutboundTaskDismantleSupplyHisMapper;
import com.prolog.eis.model.out.BizOutboundTaskDismantleSupplyHis;
import com.prolog.eis.service.out.BizOutboundTaskDismantleSupplyHisService;
import com.prolog.framework.core.restriction.Criteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

/**
 * @author zmr
 * @description: 出库任务拆零待补货数量-服务实现类
 * @date 2023-09-20 18:32
 */
@Service
public class BizOutboundTaskDismantleSupplyHisServiceImpl implements BizOutboundTaskDismantleSupplyHisService {

    @Autowired
    private BizOutboundTaskDismantleSupplyHisMapper bizOutboundTaskDismantleSupplyHisMapper;

    /**
     * 新增数据
     *
     * @param bizOutboundTaskDismantleSupplyHis 出库任务拆零待补货数量
     */
    @Override
    public long save(BizOutboundTaskDismantleSupplyHis bizOutboundTaskDismantleSupplyHis) {
        return bizOutboundTaskDismantleSupplyHisMapper.save(bizOutboundTaskDismantleSupplyHis);
    }

    /**
     * 新增批量数据
     *
     * @param bizOutboundTaskDismantleSupplyHisList 出库任务拆零待补货数量
     */
    @Override
    public long saveBatch(List<BizOutboundTaskDismantleSupplyHis> bizOutboundTaskDismantleSupplyHisList) {
        return bizOutboundTaskDismantleSupplyHisMapper.saveBatch(bizOutboundTaskDismantleSupplyHisList);
    }

    /**
     * 查询多条数据
     *
     * @param paramMap 查询起始位置
     * @return 对象列表
     */
    @Override
    public List<BizOutboundTaskDismantleSupplyHis> findByMap(Map<String, Object> paramMap) {
        return bizOutboundTaskDismantleSupplyHisMapper.findByMap(paramMap, BizOutboundTaskDismantleSupplyHis.class);
    }

    /**
     * 查询单条数据
     *
     * @param paramMap 查询起始位置
     * @return 对象
     */
    @Override
    public BizOutboundTaskDismantleSupplyHis findOneByMap(Map<String, Object> paramMap) {
        List<BizOutboundTaskDismantleSupplyHis> dataList = findByMap(paramMap);
        if(dataList.isEmpty()) {
            return null;
        }
        return dataList.get(0);
    }

    /**
     * 查询多条数据
     *
     * @param criteria 查询起始位置
     * @return 对象列表
     */
    @Override
    public List<BizOutboundTaskDismantleSupplyHis> findByCriteria(Criteria criteria) {
        return bizOutboundTaskDismantleSupplyHisMapper.findByCriteria(criteria);
    }

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public BizOutboundTaskDismantleSupplyHis findById(int id) {
        return bizOutboundTaskDismantleSupplyHisMapper.findById(id, BizOutboundTaskDismantleSupplyHis.class);
    }

    /**
     * 修改数据
     *
     * @param bizOutboundTaskDismantleSupplyHis 实例对象
     */
    @Override
    public long update(BizOutboundTaskDismantleSupplyHis bizOutboundTaskDismantleSupplyHis) {
        return bizOutboundTaskDismantleSupplyHisMapper.update(bizOutboundTaskDismantleSupplyHis);
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     */
    @Override
    public long deleteById(int id) {
        return bizOutboundTaskDismantleSupplyHisMapper.deleteById(id, BizOutboundTaskDismantleSupplyHis.class);
    }

    /**
     * 通过参数删除数据
     *
     * @param paramMap 参数
     */
    @Override
    public long deleteByMap(Map<String, Object> paramMap) {
        return bizOutboundTaskDismantleSupplyHisMapper.deleteByMap(paramMap, BizOutboundTaskDismantleSupplyHis.class);
    }

    /**
     * 通过参数查询总条数
     *
     * @param paramMap 参数
     */
    @Override
    public long findCountByMap(Map<String, Object> paramMap) {
        return bizOutboundTaskDismantleSupplyHisMapper.findCountByMap(paramMap, BizOutboundTaskDismantleSupplyHis.class);
    }
}
