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

import com.prolog.eis.dao.out.PickingOrderHisMapper;
import com.prolog.eis.model.pick.PickingOrderHis;
import com.prolog.eis.service.out.PickingOrderHisService;
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-08-30 12:24
 */
@Service
public class PickingOrderHisServiceImpl implements PickingOrderHisService {

    @Autowired
    private PickingOrderHisMapper pickingOrderHisMapper;

    /**
     * 新增数据
     *
     * @param pickingOrderHis 任务包表
     */
    @Override
    public long save(PickingOrderHis pickingOrderHis) {
        return pickingOrderHisMapper.save(pickingOrderHis);
    }

    /**
     * 新增批量数据
     *
     * @param pickingOrderHisList 任务包表
     */
    @Override
    public long saveBatch(List<PickingOrderHis> pickingOrderHisList) {
        return pickingOrderHisMapper.saveBatch(pickingOrderHisList);
    }

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

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

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

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

    /**
     * 修改数据
     *
     * @param pickingOrderHis 实例对象
     */
    @Override
    public long update(PickingOrderHis pickingOrderHis) {
        return pickingOrderHisMapper.update(pickingOrderHis);
    }

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

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

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