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

import com.prolog.eis.dao.shelves.AllotmentTaskRecordHisMapper;
import com.prolog.eis.model.shelves.AllotmentTaskRecordHis;
import com.prolog.eis.service.shelves.AllotmentTaskRecordHisService;
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-28 11:41
 */
@Service
public class AllotmentTaskRecordHisServiceImpl implements AllotmentTaskRecordHisService {

    @Autowired
    private AllotmentTaskRecordHisMapper allotmentTaskRecordHisMapper;

    /**
     * 新增数据
     *
     * @param allotmentTaskRecordHis 分拨供包任务表记录
     */
    @Override
    public long save(AllotmentTaskRecordHis allotmentTaskRecordHis) {
        return allotmentTaskRecordHisMapper.save(allotmentTaskRecordHis);
    }

    /**
     * 新增批量数据
     *
     * @param allotmentTaskRecordHisList 分拨供包任务表记录
     */
    @Override
    public long saveBatch(List<AllotmentTaskRecordHis> allotmentTaskRecordHisList) {
        return allotmentTaskRecordHisMapper.saveBatch(allotmentTaskRecordHisList);
    }

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

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

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

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

    /**
     * 修改数据
     *
     * @param allotmentTaskRecordHis 实例对象
     */
    @Override
    public long update(AllotmentTaskRecordHis allotmentTaskRecordHis) {
        return allotmentTaskRecordHisMapper.update(allotmentTaskRecordHis);
    }

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

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

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