package com.yijia.station.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yijia.station.mapper.StationPayMapper;
import com.yijia.station.domain.StationPay;
import com.yijia.station.service.IStationPayService;

/**
 * 油站支付设置Service业务层处理
 * 
 * @author yijia
 * @date 2020-12-10
 */
@Service
public class StationPayServiceImpl implements IStationPayService 
{
    @Autowired
    private StationPayMapper stationPayMapper;

    /**
     * 查询油站支付设置
     * 
     * @param payId 油站支付设置ID
     * @return 油站支付设置
     */
    @Override
    public StationPay selectStationPayById(Long payId)
    {
        return stationPayMapper.selectStationPayById(payId);
    }

    /**
     * 查询油站支付设置列表
     * 
     * @param stationPay 油站支付设置
     * @return 油站支付设置
     */
    @Override
    public List<StationPay> selectStationPayList(StationPay stationPay)
    {
        return stationPayMapper.selectStationPayList(stationPay);
    }

    /**
     * 新增油站支付设置
     * 
     * @param stationPay 油站支付设置
     * @return 结果
     */
    @Override
    public int insertStationPay(StationPay stationPay)
    {
        return stationPayMapper.insertStationPay(stationPay);
    }

    /**
     * 修改油站支付设置
     * 
     * @param stationPay 油站支付设置
     * @return 结果
     */
    @Override
    public int updateStationPay(StationPay stationPay)
    {
        return stationPayMapper.updateStationPay(stationPay);
    }

    /**
     * 批量删除油站支付设置
     * 
     * @param payIds 需要删除的油站支付设置ID
     * @return 结果
     */
    @Override
    public int deleteStationPayByIds(Long[] payIds)
    {
        return stationPayMapper.deleteStationPayByIds(payIds);
    }

    /**
     * 删除油站支付设置信息
     * 
     * @param payId 油站支付设置ID
     * @return 结果
     */
    @Override
    public int deleteStationPayById(Long payId)
    {
        return stationPayMapper.deleteStationPayById(payId);
    }

    @Override
    public StationPay selectStationPayOne(StationPay stationPay) {
        StationPay pay=new StationPay();
        List<StationPay>  list= stationPayMapper.selectStationPayList(stationPay);
        if(list!=null && list.size()>0){
            pay.setPayId(list.get(0).getPayId());
            pay.setWsPrintFlag(list.get(0).getWsPrintFlag());
            pay.setPayCallbackPage(list.get(0).getPayCallbackPage());
            pay.setPreferentialWayShareFlag(list.get(0).getPreferentialWayShareFlag());
            pay.setPayPrintNum(list.get(0).getPayPrintNum());
            pay.setPayMode(list.get(0).getPayMode());
            pay.setOtherPreferentialWay(list.get(0).getOtherPreferentialWay());
            pay.setImagePhotosFlag(list.get(0).getImagePhotosFlag());
            pay.setCardEnabledFlag(list.get(0).getCardEnabledFlag());
            pay.setActivityPic(list.get(0).getActivityPic());
        }
        return pay;
    }
}
