
package com.tmerclub.cloud.supplier.service.impl;

import com.tmerclub.cloud.common.database.dto.PageDTO;
import com.tmerclub.cloud.common.database.util.PageUtil;
import com.tmerclub.cloud.common.database.vo.PageVO;
import com.tmerclub.cloud.supplier.dto.AuditingSupplierInfoDTO;
import com.tmerclub.cloud.supplier.mapper.SupplierAuditingMapper;
import com.tmerclub.cloud.supplier.model.SupplierAuditing;
import com.tmerclub.cloud.supplier.service.SupplierAuditingService;
import com.tmerclub.cloud.supplier.vo.SupplierAuditingInfoVO;
import com.tmerclub.cloud.supplier.vo.SupplierAuditingVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 供应商审核信息
 *
 * @author lhd
 * @date 2022-03-14 17:04:32
 */
@Service
public class SupplierAuditingServiceImpl implements SupplierAuditingService {

    @Autowired
    private SupplierAuditingMapper supplierAuditingMapper;


    @Override
    public PageVO<SupplierAuditingVO> page(PageDTO pageDTO) {
        return PageUtil.doPage(pageDTO, () -> supplierAuditingMapper.list());
    }

    @Override
    public SupplierAuditingVO getBySupplierAuditingId(Long supplierAuditingId) {
        return supplierAuditingMapper.getBySupplierAuditingId(supplierAuditingId);
    }

    @Override
    public void save(SupplierAuditing supplierAuditing) {
        supplierAuditingMapper.save(supplierAuditing);
    }

    @Override
    public void update(SupplierAuditing supplierAuditing) {
        supplierAuditingMapper.update(supplierAuditing);
    }

    @Override
    public void deleteById(Long supplierAuditingId) {
        supplierAuditingMapper.deleteById(supplierAuditingId);
    }

    @Override
    public SupplierAuditingVO getBySupplierId(Long supplierId) {
        return supplierAuditingMapper.getBySupplierId(supplierId);
    }

    @Override
    public PageVO<SupplierAuditingInfoVO> auditingInfoPage(PageDTO pageDTO, AuditingSupplierInfoDTO auditingInfoDTO) {
        return PageUtil.doPage(pageDTO, () -> supplierAuditingMapper.auditingInfoList(auditingInfoDTO));
    }

    @Override
    public void updateToFail(List<Long> supplierIds) {
        supplierAuditingMapper.updateToFail(supplierIds);
    }

}
