package com.ruoyi.model.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.model.mapper.AppWalletMapper;
import com.ruoyi.model.domain.AppWallet;
import com.ruoyi.model.service.IAppWalletService;

/**
 * 钱包Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-08
 */
@Service
public class AppWalletServiceImpl implements IAppWalletService 
{
    @Autowired
    private AppWalletMapper appWalletMapper;

    /**
     * 查询钱包
     * 
     * @param id 钱包主键
     * @return 钱包
     */
    @Override
    public AppWallet selectAppWalletById(Long id)
    {
        return appWalletMapper.selectAppWalletById(id);
    }

    /**
     * 查询钱包列表
     * 
     * @param appWallet 钱包
     * @return 钱包
     */
    @Override
    public List<AppWallet> selectAppWalletList(AppWallet appWallet)
    {
        return appWalletMapper.selectAppWalletList(appWallet);
    }

    /**
     * 新增钱包
     * 
     * @param appWallet 钱包
     * @return 结果
     */
    @Override
    public int insertAppWallet(AppWallet appWallet)
    {
        appWallet.setCreateTime(DateUtils.getNowDate());
        return appWalletMapper.insertAppWallet(appWallet);
    }

    /**
     * 修改钱包
     * 
     * @param appWallet 钱包
     * @return 结果
     */
    @Override
    public int updateAppWallet(AppWallet appWallet)
    {
        appWallet.setUpdateTime(DateUtils.getNowDate());
        return appWalletMapper.updateAppWallet(appWallet);
    }

    /**
     * 批量删除钱包
     * 
     * @param ids 需要删除的钱包主键
     * @return 结果
     */
    @Override
    public int deleteAppWalletByIds(Long[] ids)
    {
        return appWalletMapper.deleteAppWalletByIds(ids);
    }

    /**
     * 删除钱包信息
     * 
     * @param id 钱包主键
     * @return 结果
     */
    @Override
    public int deleteAppWalletById(Long id)
    {
        return appWalletMapper.deleteAppWalletById(id);
    }

    @Override
    public List<AppWallet> getAppWalletByUserId(Long userId) {
        return appWalletMapper.getAppWalletByUserId(userId);
    }
}
