package vip.xiaonuo.money.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.money.entity.MoneyWarning;
import vip.xiaonuo.money.mapper.MoneyWarningMapper;
import vip.xiaonuo.money.param.MoneyOverduePageParam;
import vip.xiaonuo.money.service.IMoneyWarningService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 财务预警 服务实现类
 * </p>
 *
 * @author author
 * @since 2024-11-22
 */
@Service
public class MoneyWarningServiceImpl extends ServiceImpl<MoneyWarningMapper, MoneyWarning> implements IMoneyWarningService {

    @Autowired
    private MoneyWarningMapper warningMapper;

    @Override
    public Page<MoneyWarning> page(MoneyOverduePageParam pageParam) {
        QueryWrapper<MoneyWarning> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq(StringUtils.isNotBlank(pageParam.getOrgId()), "org_id", pageParam.getOrgId());
        queryWrapper.eq("type", pageParam.getType());
        Page page = new Page<MoneyWarning>(pageParam.getPageNum(), pageParam.getPageSize());
        return this.page(page, queryWrapper);
    }
}
