package com.younike.system.service.impl;

import java.util.List;
import java.time.LocalDateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.younike.system.mapper.MerchantSettleRecordMapper;
import com.younike.system.domain.MerchantSettleRecord;
import com.younike.system.service.IMerchantSettleRecordService;

/**
 * 商户结算记录Service业务层处理
 * 
 * @author elev
 * @date 2022-01-10
 */
@Service
public class MerchantSettleRecordServiceImpl implements IMerchantSettleRecordService {
    @Autowired
    private MerchantSettleRecordMapper merchantSettleRecordMapper;

    /**
     * 查询商户结算记录
     * 
     * @param settleId 商户结算记录主键
     * @return 商户结算记录
     */
    @Override
    public MerchantSettleRecord selectMerchantSettleRecordBySettleId(Long settleId) {
        return merchantSettleRecordMapper.selectMerchantSettleRecordBySettleId(settleId);
    }

    /**
     * 查询商户结算记录列表
     * 
     * @param merchantSettleRecord 商户结算记录
     * @return 商户结算记录
     */
    @Override
    public List<MerchantSettleRecord> selectMerchantSettleRecordList(MerchantSettleRecord merchantSettleRecord) {
        return merchantSettleRecordMapper.selectMerchantSettleRecordList(merchantSettleRecord);
    }

    /**
     * 新增商户结算记录
     * 
     * @param merchantSettleRecord 商户结算记录
     * @return 结果
     */
    @Override
    public int insertMerchantSettleRecord(MerchantSettleRecord merchantSettleRecord) {
        merchantSettleRecord.setCreateTime(LocalDateTime.now());
        return merchantSettleRecordMapper.insertMerchantSettleRecord(merchantSettleRecord);
    }

    /**
     * 修改商户结算记录
     * 
     * @param merchantSettleRecord 商户结算记录
     * @return 结果
     */
    @Override
    public int updateMerchantSettleRecord(MerchantSettleRecord merchantSettleRecord) {
        merchantSettleRecord.setUpdateTime(LocalDateTime.now());
        return merchantSettleRecordMapper.updateMerchantSettleRecord(merchantSettleRecord);
    }

    /**
     * 批量删除商户结算记录
     * 
     * @param settleIds 需要删除的商户结算记录主键
     * @return 结果
     */
    @Override
    public int deleteMerchantSettleRecordBySettleIds(Long[] settleIds) {
        return merchantSettleRecordMapper.deleteMerchantSettleRecordBySettleIds(settleIds);
    }

    /**
     * 删除商户结算记录信息
     * 
     * @param settleId 商户结算记录主键
     * @return 结果
     */
    @Override
    public int deleteMerchantSettleRecordBySettleId(Long settleId)
    {
        return merchantSettleRecordMapper.deleteMerchantSettleRecordBySettleId(settleId);
    }

    @Override
    public boolean saveBatch(List<MerchantSettleRecord> merchantSettleRecords) {
        return merchantSettleRecordMapper.saveBatch(merchantSettleRecords);
    }
}
