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

import com.prolog.eis.dao.carry.WmsCarryTaskHisMapper;
import com.prolog.eis.model.carry.WmsCarryTaskHis;
import com.prolog.eis.service.carry.WmsCarryTaskHisService;
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: wms下发搬运任务-服务实现类
 * @date 2023-04-23 17:30
 */
@Service
public class WmsCarryTaskHisServiceImpl implements WmsCarryTaskHisService {

    @Autowired
    private WmsCarryTaskHisMapper wmsCarryTaskHisMapper;

    /**
     * 新增数据
     *
     * @param wmsCarryTaskHis wms下发搬运任务
     */
    @Override
    public long save(WmsCarryTaskHis wmsCarryTaskHis) {
        return wmsCarryTaskHisMapper.save(wmsCarryTaskHis);
    }

    /**
     * 新增批量数据
     *
     * @param wmsCarryTaskHisList wms下发搬运任务
     */
    @Override
    public long saveBatch(List<WmsCarryTaskHis> wmsCarryTaskHisList) {
        return wmsCarryTaskHisMapper.saveBatch(wmsCarryTaskHisList);
    }

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

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

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

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

    /**
     * 修改数据
     *
     * @param wmsCarryTaskHis 实例对象
     */
    @Override
    public long update(WmsCarryTaskHis wmsCarryTaskHis) {
        return wmsCarryTaskHisMapper.update(wmsCarryTaskHis);
    }

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

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

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