package com.xingxi.business.MerchantWxpay.service.impl;

import com.xingxi.common.core.text.Convert;
import com.xingxi.common.utils.DateUtils;
import com.xingxi.business.MerchantWxpay.domain.MerchantWxpay;
import com.xingxi.business.MerchantWxpay.mapper.MerchantWxpayMapper;
import com.xingxi.business.MerchantWxpay.service.IMerchantWxpayService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 店铺微信支付信息Service业务层处理
 *
 * @author xingxi
 * @date 2025-03-06
 */
@Service
public class MerchantWxpayServiceImpl implements IMerchantWxpayService {
    @Resource
    private MerchantWxpayMapper merchantWxpayMapper;

    /**
     * 查询店铺微信支付信息
     *
     * @param mercWxpayId 店铺微信支付信息主键
     * @return 店铺微信支付信息
     */
    @Override
    public MerchantWxpay selectMerchantWxpayByMercWxpayId(Long mercWxpayId) {
        return merchantWxpayMapper.selectMerchantWxpayByMercWxpayId(mercWxpayId);
    }

    /**
     * 查询店铺微信支付信息列表
     *
     * @param merchantWxpay 店铺微信支付信息
     * @return 店铺微信支付信息
     */
    @Override
    public List<MerchantWxpay> selectMerchantWxpayList(MerchantWxpay merchantWxpay) {
        return merchantWxpayMapper.selectMerchantWxpayList(merchantWxpay);
    }

    /**
     * 新增店铺微信支付信息
     *
     * @param merchantWxpay 店铺微信支付信息
     * @return 结果
     */
    @Override
    public int insertMerchantWxpay(MerchantWxpay merchantWxpay) {
        merchantWxpay.setCreateTime(DateUtils.getNowDate());
        return merchantWxpayMapper.insertMerchantWxpay(merchantWxpay);
    }

    /**
     * 新增店铺微信支付信息
     *
     * @param merchantWxpayList 店铺微信支付信息
     * @return 结果
     */
    @Override
    public int batchInsertMerchantWxpay(List<MerchantWxpay> merchantWxpayList) {
        return merchantWxpayMapper.batchInsertMerchantWxpay(merchantWxpayList);
    }

    /**
     * 修改店铺微信支付信息
     *
     * @param merchantWxpay 店铺微信支付信息
     * @return 结果
     */
    @Override
    public int updateMerchantWxpay(MerchantWxpay merchantWxpay) {
        merchantWxpay.setUpdateTime(DateUtils.getNowDate());
        return merchantWxpayMapper.updateMerchantWxpay(merchantWxpay);
    }

    /**
     * 批量删除店铺微信支付信息
     *
     * @param mercWxpayIds 需要删除的店铺微信支付信息主键
     * @return 结果
     */
    @Override
    public int deleteMerchantWxpayByMercWxpayIds(String mercWxpayIds) {
        return merchantWxpayMapper.deleteMerchantWxpayByMercWxpayIds(Convert.toStrArray(mercWxpayIds));
    }

    /**
     * 删除店铺微信支付信息信息
     *
     * @param mercWxpayId 店铺微信支付信息主键
     * @return 结果
     */
    @Override
    public int deleteMerchantWxpayByMercWxpayId(Long mercWxpayId) {
        return merchantWxpayMapper.deleteMerchantWxpayByMercWxpayId(mercWxpayId);
    }

    /**
     * 逻辑删除店铺微信支付信息
     *
     * @param mercWxpayId 店铺微信支付信息主键
     * @return 结果
     */
    @Override
    public int logicDeleteMerchantWxpayByMercWxpayId(Long mercWxpayId) {
        return merchantWxpayMapper.logicDeleteMerchantWxpayByMercWxpayId(mercWxpayId);
    }

    /**
     * 逻辑批量删除店铺微信支付信息
     *
     * @param mercWxpayIds 需要删除的数据主键集合
     * @return 结果
     */
    @Override
    public int logicDeleteMerchantWxpayByMercWxpayIds(String[] mercWxpayIds) {
        return merchantWxpayMapper.logicDeleteMerchantWxpayByMercWxpayIds(mercWxpayIds);
    }

    /**
     * 逻辑批量删除店铺微信支付信息
     *
     * @param merchantWxpay 店铺微信支付信息
     * @return 结果
     */
    @Override
    public int logicDeleteMerchantWxpayByCondition(MerchantWxpay merchantWxpay) {
        return merchantWxpayMapper.logicDeleteMerchantWxpayByCondition(merchantWxpay);
    }
}
