package org.ta.pddserver.service.impl;


import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.ta.pddserver.entity.StorageEntity;
import org.ta.pddserver.mapper.StorageMapper;
import org.ta.pddserver.model.api.request.StorageListRequest;
import org.ta.pddserver.model.api.response.StorageListResponse;
import org.ta.pddserver.model.api.response.StorageResponse;
import org.ta.pddserver.service.StorageService;

import java.util.List;


@Service
public class StorageImpl extends ServiceImpl<StorageMapper, StorageEntity> implements StorageService {


    public StorageEntity getInfoByLogisticsOrderCode(String logisticsOrderCode) {
        return baseMapper.getInfoByLogisticsOrderCode(logisticsOrderCode);
    }

    public StorageEntity getInfoByMailNo(String mailNo) {
        return baseMapper.getInfoByMailNo(mailNo);
    }

    public int findCountByLogisticsOrderCode(String logisticsOrderCode) {
        return baseMapper.findCountByLogisticsOrderCode(logisticsOrderCode);
    }

    public void updateNumByLogisticsOrderCode(String logisticsOrderCode) {
        baseMapper.updateNumByLogisticsOrderCode(logisticsOrderCode);
    }

    public int findAllCount(String code) {
        return baseMapper.findAllCount(code);
    }

    public Integer findReNumCount(String code) {
        return baseMapper.findReNumCount(code);
    }

    public StorageResponse storageSelect(String mailNo) {
        return baseMapper.storageSelect(mailNo);
    }

    public List<StorageListResponse> storageList(String logisticsOrderCode) {
        List<StorageListResponse> list = baseMapper.storageUnpackList(logisticsOrderCode);
        if (list == null || list.isEmpty()) {
            list = baseMapper.storageCollectList(logisticsOrderCode);
        }
        return list;
    }

    public void storageDel(String ids) {
        baseMapper.storageDel(ids);
    }
}