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

import com.prolog.eis.dao.shelves.AllotmentTaskRecordMapper;
import com.prolog.eis.model.shelves.AllotmentTaskRecord;
import com.prolog.eis.service.shelves.AllotmentTaskRecordService;
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 AllotmentTaskRecordServiceImpl implements AllotmentTaskRecordService {

    @Autowired
    private AllotmentTaskRecordMapper allotmentTaskRecordMapper;

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

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

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

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

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

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

    /**
     * 修改数据
     *
     * @param allotmentTaskRecord 实例对象
     */
    @Override
    public long update(AllotmentTaskRecord allotmentTaskRecord) {
        return allotmentTaskRecordMapper.update(allotmentTaskRecord);
    }

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

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

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

    @Override
    public long updateMapByCriteria(Map<String, Object> map, Criteria criteria) {
        return allotmentTaskRecordMapper.updateMapByCriteria(map, criteria);
    }
}
