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.QualityManufacturer;
import vip.xiaonuo.quality.mapper.QualityManufacturerMapper;
import vip.xiaonuo.quality.param.QualityManufacturerParam;
import vip.xiaonuo.quality.service.IQualityManufacturerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 厂商质量级别评估 服务实现类
 * </p>
 *
 * @author author
 * @since 2024-12-11
 */
@Service
public class QualityManufacturerServiceImpl extends ServiceImpl<QualityManufacturerMapper, QualityManufacturer> implements IQualityManufacturerService {

    @Autowired
    private QualityManufacturerMapper manufacturerMapper;

    @Override
    public Page<QualityManufacturer> listPage(QualityManufacturerParam manufacturerParam) {
        String orgId = manufacturerParam.getOrgId();
        Page<QualityManufacturer> page = new Page<>(manufacturerParam.getPageNum(), manufacturerParam.getPageSize());
        QueryWrapper<QualityManufacturer> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq(StringUtils.isNotBlank(orgId), "org_id", orgId);
        queryWrapper.orderByDesc("create_time");
        return manufacturerMapper.selectPage(page, queryWrapper);
    }
}
