package org.ta.pddserver.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.ta.pddserver.entity.OutboundNoticeEntity;
import org.ta.pddserver.mapper.OutboundNoticeMapper;
import org.ta.pddserver.model.api.request.OutboundNoticeListRequest;
import org.ta.pddserver.model.api.request.UnpackNoticeListRequest;
import org.ta.pddserver.model.api.response.OutboundNoticeListResponse;
import org.ta.pddserver.model.api.response.UnpackNoticeListResponse;
import org.ta.pddserver.service.OutboundNoticeService;

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

@Service
public class OutboundNoticeImpl extends ServiceImpl<OutboundNoticeMapper, OutboundNoticeEntity> implements OutboundNoticeService {


    public Map<String, Object> getListByRequest(OutboundNoticeListRequest param) {
        Integer count = baseMapper.countUsable(param);
        param.checkPage(count,20);
        List<OutboundNoticeListResponse> 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 void updateStatusByOrderCode(String orderCode, int status) {
        baseMapper.updateStatusByOrderCode(orderCode, status);
    }
}