package com.bonus.canteen.core.account.service.impl;

import com.bonus.canteen.core.account.domain.AccTradeWalletDetail;
import com.bonus.canteen.core.account.mapper.AccTradeWalletDetailMapper;
import com.bonus.canteen.core.account.service.IAccTradeWalletDetailService;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 钱包交易记录详情Service业务层处理
 * 
 * @author xsheng
 * @date 2025-04-05
 */
@Service
public class AccTradeWalletDetailServiceImpl implements IAccTradeWalletDetailService {
    @Autowired
    private AccTradeWalletDetailMapper accTradeWalletDetailMapper;

    /**
     * 查询钱包交易记录详情
     * 
     * @param id 钱包交易记录详情主键
     * @return 钱包交易记录详情
     */
    @Override
    public AccTradeWalletDetail selectAccTradeWalletDetailById(Long id) {
        return accTradeWalletDetailMapper.selectAccTradeWalletDetailById(id);
    }

    /**
     * 查询钱包交易记录详情列表
     * 
     * @param accTradeWalletDetail 钱包交易记录详情
     * @return 钱包交易记录详情
     */
    @Override
    public List<AccTradeWalletDetail> selectAccTradeWalletDetailList(AccTradeWalletDetail accTradeWalletDetail) {
        return accTradeWalletDetailMapper.selectAccTradeWalletDetailList(accTradeWalletDetail);
    }

    /**
     * 新增钱包交易记录详情
     * 
     * @param accTradeWalletDetail 钱包交易记录详情
     * @return 结果
     */
    @Override
    public int insertAccTradeWalletDetail(AccTradeWalletDetail accTradeWalletDetail) {
        accTradeWalletDetail.setCreateTime(DateUtils.getNowDate());
            return accTradeWalletDetailMapper.insertAccTradeWalletDetail(accTradeWalletDetail);
    }

    /**
     * 修改钱包交易记录详情
     * 
     * @param accTradeWalletDetail 钱包交易记录详情
     * @return 结果
     */
    @Override
    public int updateAccTradeWalletDetail(AccTradeWalletDetail accTradeWalletDetail) {
        accTradeWalletDetail.setUpdateTime(DateUtils.getNowDate());
        try {
            return accTradeWalletDetailMapper.updateAccTradeWalletDetail(accTradeWalletDetail);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 批量删除钱包交易记录详情
     * 
     * @param ids 需要删除的钱包交易记录详情主键
     * @return 结果
     */
    @Override
    public int deleteAccTradeWalletDetailByIds(Long[] ids) {
        return accTradeWalletDetailMapper.deleteAccTradeWalletDetailByIds(ids);
    }

    /**
     * 删除钱包交易记录详情信息
     * 
     * @param id 钱包交易记录详情主键
     * @return 结果
     */
    @Override
    public int deleteAccTradeWalletDetailById(Long id) {
        return accTradeWalletDetailMapper.deleteAccTradeWalletDetailById(id);
    }
}
