package com.goldenwater.gx.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.goldenwater.gx.domain.GxExchangeBiz;
import com.goldenwater.gx.mapper.GxExchangeBizMapper;
import com.goldenwater.gx.service.IGxExchangeBizService;

/**
 * 数据交换业务域Service业务层处理
 */
@Service
public class GxExchangeBizServiceImpl implements IGxExchangeBizService
{
    @Autowired
    private GxExchangeBizMapper gxExchangeBizMapper;

    @Override
    public GxExchangeBiz selectGxExchangeBizById(Long id)
    {
        return gxExchangeBizMapper.selectGxExchangeBizById(id);
    }

    @Override
    public GxExchangeBiz selectByBizCode(String bizCode)
    {
        return gxExchangeBizMapper.selectByBizCode(bizCode);
    }

    @Override
    public List<GxExchangeBiz> selectGxExchangeBizList(GxExchangeBiz gxExchangeBiz)
    {
        return gxExchangeBizMapper.selectGxExchangeBizList(gxExchangeBiz);
    }

    @Override
    public int insertGxExchangeBiz(GxExchangeBiz gxExchangeBiz)
    {
        if (gxExchangeBiz.getOrderNum() == null || gxExchangeBiz.getOrderNum() == 0)
        {
            Integer maxOrderNum = gxExchangeBizMapper.selectMaxOrderNum();
            gxExchangeBiz.setOrderNum(maxOrderNum + 1);
        }
        return gxExchangeBizMapper.insertGxExchangeBiz(gxExchangeBiz);
    }

    @Override
    public int updateGxExchangeBiz(GxExchangeBiz gxExchangeBiz)
    {
        return gxExchangeBizMapper.updateGxExchangeBiz(gxExchangeBiz);
    }

    @Override
    public int deleteGxExchangeBizByIds(Long[] ids)
    {
        return gxExchangeBizMapper.deleteGxExchangeBizByIds(ids);
    }

    @Override
    public int deleteGxExchangeBizById(Long id)
    {
        return gxExchangeBizMapper.deleteGxExchangeBizById(id);
    }

    @Override
    public Integer selectMaxOrderNum()
    {
        return gxExchangeBizMapper.selectMaxOrderNum();
    }
 }
