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

import com.prolog.eis.dao.out.BizOutboundTaskDetailDismantleMapper;
import com.prolog.eis.model.out.BizOutboundTaskDetailDismantle;
import com.prolog.eis.service.out.BizOutboundTaskDetailDismantleService;
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 BizOutboundTaskDetailDismantleServiceImpl implements BizOutboundTaskDetailDismantleService {

    @Autowired
    private BizOutboundTaskDetailDismantleMapper bizOutboundTaskDetailDismantleMapper;

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

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

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

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

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

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

    /**
     * 修改数据
     *
     * @param bizOutboundTaskDetailDismantle 实例对象
     */
    @Override
    public long update(BizOutboundTaskDetailDismantle bizOutboundTaskDetailDismantle) {
        return bizOutboundTaskDetailDismantleMapper.update(bizOutboundTaskDetailDismantle);
    }

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

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

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


    @Override
    public void updateMapByCriteria(Map<String,Object> map,Criteria criteria) {
        bizOutboundTaskDetailDismantleMapper.updateMapByCriteria(map, criteria);
    }
}
