package com.ruoyi.mall.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.mall.mapper.MallMemberIntegralMapper;
import com.ruoyi.mall.domain.MallMemberIntegral;
import com.ruoyi.mall.service.IMallMemberIntegralService;

import javax.annotation.Resource;

/**
 * 用户积分记录Service业务层处理
 *
 * @author ruoyi
 * @date 2024-06-21
 */
@Service
public class MallMemberIntegralServiceImpl implements IMallMemberIntegralService
{
    @Resource
    private MallMemberIntegralMapper mallMemberIntegralMapper;

    /**
     * 查询用户积分记录
     *
     * @param integralId 用户积分记录主键
     * @return 用户积分记录
     */
    @Override
    public MallMemberIntegral selectMallMemberIntegralByIntegralId(Long integralId)
    {
        return mallMemberIntegralMapper.selectMallMemberIntegralByIntegralId(integralId);
    }

    /**
     * 查询用户积分记录列表
     *
     * @param mallMemberIntegral 用户积分记录
     * @return 用户积分记录
     */
    @Override
    public List<MallMemberIntegral> selectMallMemberIntegralList(MallMemberIntegral mallMemberIntegral)
    {
        return mallMemberIntegralMapper.selectMallMemberIntegralList(mallMemberIntegral);
    }

    /**
     * 新增用户积分记录
     *
     * @param mallMemberIntegral 用户积分记录
     * @return 结果
     */
    @Override
    public int insertMallMemberIntegral(MallMemberIntegral mallMemberIntegral)
    {
        mallMemberIntegral.setCreateAt(DateUtils.getNowDate());
        mallMemberIntegral.setDelFlag(0);
        return mallMemberIntegralMapper.insertMallMemberIntegral(mallMemberIntegral);
    }

    /**
     * 修改用户积分记录
     *
     * @param mallMemberIntegral 用户积分记录
     * @return 结果
     */
    @Override
    public int updateMallMemberIntegral(MallMemberIntegral mallMemberIntegral)
    {
        mallMemberIntegral.setUpdateAt(DateUtils.getNowDate());
        return mallMemberIntegralMapper.updateMallMemberIntegral(mallMemberIntegral);
    }

    /**
     * 批量删除用户积分记录
     *
     * @param integralIds 需要删除的用户积分记录主键
     * @return 结果
     */
    @Override
    public int deleteMallMemberIntegralByIntegralIds(Long[] integralIds)
    {
        return mallMemberIntegralMapper.deleteMallMemberIntegralByIntegralIds(integralIds);
    }

    /**
     * 删除用户积分记录信息
     *
     * @param integralId 用户积分记录主键
     * @return 结果
     */
    @Override
    public int deleteMallMemberIntegralByIntegralId(Long integralId)
    {
        return mallMemberIntegralMapper.deleteMallMemberIntegralByIntegralId(integralId);
    }
}
