package vip.xiaonuo.quality.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.quality.entity.QualityEffectice;
import vip.xiaonuo.quality.mapper.QualityEffecticeMapper;
import vip.xiaonuo.quality.param.QualityEffectiveParam;
import vip.xiaonuo.quality.service.IQualityEffecticeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import vip.xiaonuo.risk.entity.RiskContractWarning;

/**
 * <p>
 * 质量管控物料有效期 服务实现类
 * </p>
 *
 * @author author
 * @since 2024-12-11
 */
@Service
public class QualityEffecticeServiceImpl extends ServiceImpl<QualityEffecticeMapper, QualityEffectice> implements IQualityEffecticeService {

    @Autowired
    private QualityEffecticeMapper effecticeMapper;

    @Override
    public Page<QualityEffectice> listPage(QualityEffectiveParam effectiveParam) {
        String orgId = effectiveParam.getOrgId();
        Page<QualityEffectice> page = new Page<>(effectiveParam.getPageNum(), effectiveParam.getPageSize());
        QueryWrapper<QualityEffectice> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq(StringUtils.isNotBlank(orgId), "org_id", orgId);
        queryWrapper.orderByDesc("income_time");
        return effecticeMapper.selectPage(page, queryWrapper);
    }
}
