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.mapper.SaleOverdueMapper;
import vip.xiaonuo.sale.param.SaleOverdueParam;
import vip.xiaonuo.sale.service.ISaleOverdueService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 销售逾期合同 服务实现类
 * </p>
 *
 * @author author
 * @since 2024-12-13
 */
@Service
public class SaleOverdueServiceImpl extends ServiceImpl<SaleOverdueMapper, SaleOverdue> implements ISaleOverdueService {

    @Autowired
    private SaleOverdueMapper overdueMapper;

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