package vip.xiaonuo.sale.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import vip.xiaonuo.sale.entity.SaleOverdue;
import vip.xiaonuo.sale.entity.SaleReceive;
import vip.xiaonuo.sale.mapper.SaleReceiveMapper;
import vip.xiaonuo.sale.param.SaleReceiveParam;
import vip.xiaonuo.sale.service.ISaleReceiveService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 销售应收款 服务实现类
 * </p>
 *
 * @author author
 * @since 2024-12-13
 */
@Service
public class SaleReceiveServiceImpl extends ServiceImpl<SaleReceiveMapper, SaleReceive> implements ISaleReceiveService {

    @Autowired
    private SaleReceiveMapper receiveMapper;

    @Override
    public Page<SaleReceive> getList(SaleReceiveParam receiveParam) {
        String orgId = receiveParam.getOrgId();
        QueryWrapper<SaleReceive> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq(StringUtils.isNotBlank(orgId), "org_id", orgId);
        queryWrapper.orderByDesc("create_time");
        Page<SaleReceive> page = new Page(receiveParam.getPageNum(), receiveParam.getPageSize());
        return receiveMapper.selectPage(page, queryWrapper);
    }
}
