package com.prolog.cs.biz.outbound.service.impl;

import com.github.pagehelper.PageHelper;
import com.prolog.cs.biz.outbound.dao.PickUpRecordMapper;
import com.prolog.cs.biz.outbound.model.PickUpRecord;
import com.prolog.cs.biz.outbound.service.PickUpRecordService;
import com.prolog.framework.authority.core.dto.UserDTO;
import com.prolog.framework.authority.user.UserTemplate;
import com.prolog.framework.core.pojo.Page;
import com.prolog.framework.dao.util.PageUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zzz
 * @desc
 * @date 2021/6/17
 */
@Service
public class PickUpRecordServiceImpl implements PickUpRecordService {

    @Autowired
    private PickUpRecordMapper mapper;

    @Autowired
    private UserTemplate userTemplate;

    /**
     * 分页查询
     * @param shipperName
     * @param srcCode
     * @param startDate
     * @param endDate
     * @param warehouseId
     * @param bldgId
     * @return
     */
    @Override
    public Page<PickUpRecord> getPickUpRecordPage(String shipperName, String srcCode, String startDate, String endDate, String warehouseId, String bldgId, Integer pageNum, Integer pageSize) {
        UserDTO userDTO = userTemplate.getUserDTO();
        String enterpriseId = userDTO.getEnterpriseId();
        PageHelper.startPage(pageNum, pageSize);
        List<PickUpRecord> list = mapper.getPickUpRecordList(shipperName,srcCode,startDate,endDate,warehouseId,enterpriseId,bldgId);
        return PageUtils.getPage(list);
    }

}
