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

import com.prolog.eis.dao.out.BizOutboundTaskDetailDismantleHisMapper;
import com.prolog.eis.model.out.BizOutboundTaskDetailDismantleHis;
import com.prolog.eis.service.out.BizOutboundTaskDetailDismantleHisService;
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-14 18:59
 */
@Service
public class BizOutboundTaskDetailDismantleHisServiceImpl implements BizOutboundTaskDetailDismantleHisService {

    @Autowired
    private BizOutboundTaskDetailDismantleHisMapper bizOutboundTaskDetailDismantleHisMapper;

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

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

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

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

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

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

    /**
     * 修改数据
     *
     * @param bizOutboundTaskDetailDismantleHis 实例对象
     */
    @Override
    public long update(BizOutboundTaskDetailDismantleHis bizOutboundTaskDetailDismantleHis) {
        return bizOutboundTaskDetailDismantleHisMapper.update(bizOutboundTaskDetailDismantleHis);
    }

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

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

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