package com.goldenwater.gx.service.impl;

import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.goldenwater.gx.domain.GxExchangeApply;
import com.goldenwater.gx.mapper.GxExchangeApplyMapper;
import com.goldenwater.gx.service.IGxExchangeApplyService;

/**
 * 数据共享申请Service业务层处理
 */
@Service
public class GxExchangeApplyServiceImpl implements IGxExchangeApplyService
{
    @Autowired
    private GxExchangeApplyMapper gxExchangeApplyMapper;

    @Override
    public GxExchangeApply selectGxExchangeApplyById(Long id)
    {
        return gxExchangeApplyMapper.selectGxExchangeApplyById(id);
    }

    @Override
    public List<GxExchangeApply> selectGxExchangeApplyList(GxExchangeApply apply)
    {
        return gxExchangeApplyMapper.selectGxExchangeApplyList(apply);
    }

    @Override
    public int insertGxExchangeApply(GxExchangeApply apply)
    {
        return gxExchangeApplyMapper.insertGxExchangeApply(apply);
    }

    @Override
    public int updateGxExchangeApply(GxExchangeApply apply)
    {
        return gxExchangeApplyMapper.updateGxExchangeApply(apply);
    }

    @Override
    @Transactional
    public int auditApply(Long id, String applyState, String approveUser, String approveRemark)
    {
        GxExchangeApply apply = new GxExchangeApply();
        apply.setId(id);
        apply.setApplyState(applyState);
        apply.setApproveUser(approveUser);
        apply.setApproveRemark(approveRemark);
        apply.setApproveTime(new Date());
        return gxExchangeApplyMapper.updateGxExchangeApply(apply);
    }

    @Override
    public int deleteGxExchangeApplyByIds(Long[] ids)
    {
        return gxExchangeApplyMapper.deleteGxExchangeApplyByIds(ids);
    }

    @Override
    public int deleteGxExchangeApplyById(Long id)
    {
        return gxExchangeApplyMapper.deleteGxExchangeApplyById(id);
    }
}
