package com.supplier.service.impl;

import com.supplier.mapper.PrivateOrderMapper;
import com.supplier.model.Ignore;
import com.supplier.model.PrivateOrder;
import com.supplier.service.PrivateOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;

@Service
public class PrivateOrderServiceImpl implements PrivateOrderService {

    @Autowired
    private PrivateOrderMapper privateOrderMapper;

    @Override
    public List<PrivateOrder> getPrivateOrder(PrivateOrder privateOrder) {
        privateOrder.setPage((privateOrder.getPage() - 1) * privateOrder.getLimit());
        return privateOrderMapper.getPrivateOrder(privateOrder);
    }

    @Override
    public int getPrivateOrderCount(PrivateOrder privateOrder) {
        return privateOrderMapper.getPrivateOrderCount(privateOrder);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void addIgnore(Ignore ignore) {
        privateOrderMapper.addIgnore(ignore);
    }

    @Override
    public PrivateOrder getPrivateOrderById(String uuid) {
        return privateOrderMapper.getPrivateOrderById(uuid);
    }

    @Override
    public int getPrivateOrderType(PrivateOrder privateOrder) {
        return privateOrderMapper.getPrivateOrderType(privateOrder);
    }

    @Override
    public List<PrivateOrder> getPrivateOrderZeor(PrivateOrder privateOrder) {
        privateOrder.setPage((privateOrder.getPage() - 1) * privateOrder.getLimit());
        return privateOrderMapper.getPrivateOrderZeor(privateOrder);
    }

    @Override
    public int getPrivateOrderCountZeor(PrivateOrder privateOrder) {
        return privateOrderMapper.getPrivateOrderCountZeor(privateOrder);
    }

    @Override
    public List<PrivateOrder> getPrivateOrderTwo(PrivateOrder privateOrder) {
        privateOrder.setPage((privateOrder.getPage() - 1) * privateOrder.getLimit());
        return privateOrderMapper.getPrivateOrderTwo(privateOrder);
    }

    @Override
    public int getPrivateOrderCountTwo(PrivateOrder privateOrder) {
        return privateOrderMapper.getPrivateOrderCountTwo(privateOrder);
    }

    @Override
    public int getDemandCount(String uuid) {
        return privateOrderMapper.getDemandCount(uuid);
    }

    @Override
    public List<PrivateOrder> getPrivateOrderSmall(PrivateOrder privateOrder) {
        privateOrder.setPage((privateOrder.getPage() - 1) * privateOrder.getLimit());
        return privateOrderMapper.getPrivateOrderSmall(privateOrder);
    }

    @Override
    public List<PrivateOrder> getPrivateOrderOne(PrivateOrder privateOrder) {
        privateOrder.setPage((privateOrder.getPage() - 1) * privateOrder.getLimit());
        return privateOrderMapper.getPrivateOrderOne(privateOrder);
    }

    @Override
    public int getPrivateOrderCountOne(PrivateOrder privateOrder) {
        return privateOrderMapper.getPrivateOrderCountOne(privateOrder);
    }

    @Override
    public List<PrivateOrder> getPrivateOrderZeorSmall(PrivateOrder privateOrder) {
        privateOrder.setPage((privateOrder.getPage() - 1) * privateOrder.getLimit());
        return privateOrderMapper.getPrivateOrderZeorSmall(privateOrder);
    }

    @Override
    public int getPrivateOrderCountSmall(PrivateOrder privateOrder) {
        return privateOrderMapper.getPrivateOrderCountSmall(privateOrder);
    }
}
