package com.younike.system.service.impl;

import java.util.List;
import java.time.LocalDateTime;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.younike.system.mapper.MerchantSettleInfoMapper;
import com.younike.system.domain.MerchantSettleInfo;
import com.younike.system.service.IMerchantSettleInfoService;

/**
 * 商户结算信息Service业务层处理
 *
 * @author elev
 * @date 2022-01-10
 */
@Service
public class MerchantSettleInfoServiceImpl implements IMerchantSettleInfoService {
    @Autowired
    private MerchantSettleInfoMapper merchantSettleInfoMapper;

    /**
     * 查询商户结算信息
     *
     * @param merchantId 商户结算信息主键
     * @return 商户结算信息
     */
    @Override
    public MerchantSettleInfo selectMerchantSettleInfoByMerchantId(Long merchantId) {
        return merchantSettleInfoMapper.selectMerchantSettleInfoByMerchantId(merchantId);
    }


    /**
     * 查询商户结算信息列表
     *
     * @param merchantSettleInfo 商户结算信息
     * @return 商户结算信息
     */
    @Override
    public List<MerchantSettleInfo> selectMerchantSettleInfoList(MerchantSettleInfo merchantSettleInfo) {
        return merchantSettleInfoMapper.selectMerchantSettleInfoList(merchantSettleInfo);
    }

    /**
     * 新增商户结算信息
     *
     * @param merchantSettleInfo 商户结算信息
     * @return 结果
     */
    @Override
    public int insertMerchantSettleInfo(MerchantSettleInfo merchantSettleInfo) {
        merchantSettleInfo.setCreateTime(LocalDateTime.now());
        return merchantSettleInfoMapper.insertMerchantSettleInfo(merchantSettleInfo);
    }

    /**
     * 修改商户结算信息
     *
     * @param merchantSettleInfo 商户结算信息
     * @return 结果
     */
    @Override
    public int updateMerchantSettleInfo(MerchantSettleInfo merchantSettleInfo) {
        merchantSettleInfo.setUpdateTime(LocalDateTime.now());
        return merchantSettleInfoMapper.updateMerchantSettleInfo(merchantSettleInfo);
    }

    /**
     * 批量删除商户结算信息
     *
     * @param merchantIds 需要删除的商户结算信息主键
     * @return 结果
     */
    @Override
    public int deleteMerchantSettleInfoByMerchantIds(String[] merchantIds) {
        return merchantSettleInfoMapper.deleteMerchantSettleInfoByMerchantIds(merchantIds);
    }

    /**
     * 删除商户结算信息信息
     *
     * @param merchantId 商户结算信息主键
     * @return 结果
     */
    @Override
    public int deleteMerchantSettleInfoByMerchantId(String merchantId)
    {
        return merchantSettleInfoMapper.deleteMerchantSettleInfoByMerchantId(merchantId);
    }

    @Override
    public List<MerchantSettleInfo> listByIds(Set<Long> merchantIds) {
        return merchantSettleInfoMapper.listByIds(merchantIds);
    }
}
