package com.yiqi.app.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yiqi.app.domain.AppUserWelfare;
import com.yiqi.app.mapper.AppUserWelfareMapper;
import com.yiqi.app.service.IAppUserWelfareService;
import com.yiqi.common.utils.DateUtils;
import com.yiqi.common.utils.SecurityUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 会员福利金Service业务层处理
 *
 * @author ruoyi
 * @date 2024-08-09
 */
@Service
public class AppUserWelfareServiceImpl extends ServiceImpl<AppUserWelfareMapper, AppUserWelfare> implements IAppUserWelfareService {

    //<editor-folder desc="基础韩素">
    /**
     * 查询会员福利金
     *
     * @param id 会员福利金主键
     * @return 会员福利金
     */
    @Override
    public AppUserWelfare selectAppUserWelfareById(Long id) {
        return baseMapper.selectAppUserWelfareById(id);
    }

    /**
     * 查询会员福利金列表
     *
     * @param appUserWelfare 会员福利金
     * @return 会员福利金
     */
    @Override
    public List<AppUserWelfare> selectAppUserWelfareList(AppUserWelfare appUserWelfare) {
        return baseMapper.selectAppUserWelfareList(appUserWelfare);
    }

    /**
     * 新增会员福利金
     *
     * @param appUserWelfare 会员福利金
     * @return 结果
     */
    @Override
    public int insertAppUserWelfare(AppUserWelfare appUserWelfare) {
                appUserWelfare.setCreateTime(DateUtils.getNowDate());
            return baseMapper.insertAppUserWelfare(appUserWelfare);
    }

    /**
     * 修改会员福利金
     *
     * @param appUserWelfare 会员福利金
     * @return 结果
     */
    @Override
    public int updateAppUserWelfare(AppUserWelfare appUserWelfare) {
                appUserWelfare.setUpdateTime(DateUtils.getNowDate());
        return baseMapper.updateAppUserWelfare(appUserWelfare);
    }

    /**
     * 批量删除会员福利金
     *
     * @param ids 需要删除的会员福利金主键
     * @return 结果
     */
    @Override
    public int deleteAppUserWelfareByIds(Long[] ids) {
        return baseMapper.deleteAppUserWelfareByIds(ids);
    }

    /**
     * 删除会员福利金信息
     *
     * @param id 会员福利金主键
     * @return 结果
     */
    @Override
    public int deleteAppUserWelfareById(Long id) {
        return baseMapper.deleteAppUserWelfareById(id);
    }

            /**
             * 修改会员福利金状态
             *
             * @param appUserWelfare 会员福利金
             * @return 结果
             */
            @Override
            public int updateAppUserWelfareStatus(AppUserWelfare appUserWelfare) {
                        appUserWelfare.setUpdateById(SecurityUtils.getUserId());
                        appUserWelfare.setUpdateBy(SecurityUtils.getUsername());
                        appUserWelfare.setUpdateTime(DateUtils.getNowDate());
                return baseMapper.updateAppUserWelfare(appUserWelfare);
            }

    //</editor-folder>

}
