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

import com.prolog.eis.dao.out.ContainerTaskDismantleHisMapper;
import com.prolog.eis.model.out.ContainerTaskDismantleHis;
import com.prolog.eis.service.out.ContainerTaskDismantleHisService;
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-11 16:33
 */
@Service
public class ContainerTaskDismantleHisServiceImpl implements ContainerTaskDismantleHisService {

    @Autowired
    private ContainerTaskDismantleHisMapper containerTaskDismantleHisMapper;

    /**
     * 新增数据
     *
     * @param containerTaskDismantleHis 出库任务拆零详情表
     */
    @Override
    public long save(ContainerTaskDismantleHis containerTaskDismantleHis) {
        return containerTaskDismantleHisMapper.save(containerTaskDismantleHis);
    }

    /**
     * 新增批量数据
     *
     * @param containerTaskDismantleHisList 出库任务拆零详情表
     */
    @Override
    public long saveBatch(List<ContainerTaskDismantleHis> containerTaskDismantleHisList) {
        return containerTaskDismantleHisMapper.saveBatch(containerTaskDismantleHisList);
    }

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

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

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

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

    /**
     * 修改数据
     *
     * @param containerTaskDismantleHis 实例对象
     */
    @Override
    public long update(ContainerTaskDismantleHis containerTaskDismantleHis) {
        return containerTaskDismantleHisMapper.update(containerTaskDismantleHis);
    }

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

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

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