package org.ta.pddserver.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.ta.pdd.entity.CollectOutMailDetailIoEntity;
import org.ta.pddserver.mapper.CollectOutMailDetailIoMapper;
import org.ta.pddserver.model.api.request.CollectOutMailDetailIoRequest;
import org.ta.pddserver.model.api.response.CollectOutMailDetailIoListResponse;
import org.ta.pddserver.service.CollectOutMailDetailIoService;

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

@Service
public class CollectOutMailDetailIoImpl extends ServiceImpl<CollectOutMailDetailIoMapper, CollectOutMailDetailIoEntity> implements CollectOutMailDetailIoService {


    public Map<String, Object> getListByRequest(CollectOutMailDetailIoRequest param) {
        Integer count = baseMapper.countUsable(param);
        param.checkPage(count,20);
        List<CollectOutMailDetailIoListResponse> 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;
    }


}