package com.hzy.project.business.balance.service.impl;

import java.util.List;
import com.hzy.common.utils.DateUtils;
import com.hzy.project.business.balance.domain.UserBalanceVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hzy.project.business.balance.mapper.UserBalanceMapper;
import com.hzy.project.business.balance.domain.UserBalance;
import com.hzy.project.business.balance.service.IUserBalanceService;
import com.hzy.common.utils.text.Convert;

/**
 * 用户结余Service业务层处理
 * 
 * @author ruoyi
 * @date 2026-01-02
 */
@Service
public class UserBalanceServiceImpl implements IUserBalanceService 
{
    @Autowired
    private UserBalanceMapper userBalanceMapper;

    /**
     * 查询用户结余
     * 
     * @param balanceId 用户结余主键
     * @return 用户结余
     */
    @Override
    public UserBalance selectUserBalanceByBalanceId(Long balanceId)
    {
        return userBalanceMapper.selectUserBalanceByBalanceId(balanceId);
    }

    /**
     * 查询用户结余列表
     *
     * @param userBalance 用户结余
     * @return 用户结余
     */
    @Override
    public List<UserBalance> selectUserBalanceList(UserBalance userBalance)
    {
        return userBalanceMapper.selectUserBalanceList(userBalance);
    }

    /**
     * 查询用户结余列表
     *
     * @param userBalance 用户结余
     * @return 用户结余
     */
    @Override
    public List<UserBalanceVo> selectUserBalanceVoList(UserBalance userBalance)
    {
        return userBalanceMapper.selectUserBalanceVoList(userBalance);
    }

    /**
     * 新增用户结余
     * 
     * @param userBalance 用户结余
     * @return 结果
     */
    @Override
    public int insertUserBalance(UserBalance userBalance)
    {
        userBalance.setCreateTime(DateUtils.getNowDate());
        return userBalanceMapper.insertUserBalance(userBalance);
    }

    /**
     * 修改用户结余
     * 
     * @param userBalance 用户结余
     * @return 结果
     */
    @Override
    public int updateUserBalance(UserBalance userBalance)
    {
        userBalance.setUpdateTime(DateUtils.getNowDate());
        return userBalanceMapper.updateUserBalance(userBalance);
    }

    /**
     * 批量删除用户结余
     * 
     * @param balanceIds 需要删除的用户结余主键
     * @return 结果
     */
    @Override
    public int deleteUserBalanceByBalanceIds(String balanceIds)
    {
        return userBalanceMapper.deleteUserBalanceByBalanceIds(Convert.toStrArray(balanceIds));
    }

    /**
     * 删除用户结余信息
     * 
     * @param balanceId 用户结余主键
     * @return 结果
     */
    @Override
    public int deleteUserBalanceByBalanceId(Long balanceId)
    {
        return userBalanceMapper.deleteUserBalanceByBalanceId(balanceId);
    }
}
