package org.ta.pddserver.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.ta.pddserver.entity.LogOrderPackageEntity;
import org.ta.pddserver.mapper.LogOrderPackageMapper;
import org.ta.pddserver.model.api.request.CollectMailDetailListRequest;
import org.ta.pddserver.model.api.request.LogOrderPackageListRequest;
import org.ta.pddserver.model.api.response.CollectMailDetailListResponse;
import org.ta.pddserver.service.LogOrderPackageService;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class LogOrderPackageImpl extends ServiceImpl<LogOrderPackageMapper, LogOrderPackageEntity> implements LogOrderPackageService {



    public Object getList(LogOrderPackageListRequest param) {

        Integer count = baseMapper.countUsable(param);
        param.checkPage(count,20);
        List<CollectMailDetailListResponse> list = baseMapper.getListByRequest(param);
        Map<String, Object> map = new HashMap<>();
        map.put("total", count);
        map.put("list", list);
        map.put("page", param.getPage());
        return map;
    }

    public LogOrderPackageEntity getInfoByCode(String logisticsOrderCode) {
        return baseMapper.getInfoByCode(logisticsOrderCode);
    }
}